From 5af3f71ac53e63d92773006745bbaee003133601 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 29 Mar 2015 22:56:34 -0400 Subject: [PATCH] Lexer: Fixed /from/to/g detection at EOS --- src/Lexer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 4f893df19..a2599cc0c 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -829,7 +829,7 @@ bool Lexer::isPath (std::string& token, Lexer::Type& type) //////////////////////////////////////////////////////////////////////////////// // Lexer::Type::substitution -// / / / [g] +// / / / [g] | bool Lexer::isSubstitution (std::string& token, Lexer::Type& type) { std::size_t marker = _cursor; @@ -845,8 +845,9 @@ bool Lexer::isSubstitution (std::string& token, Lexer::Type& type) if (_text[_cursor] == 'g') ++_cursor; - // Lookahread: - if (isWhitespace (_text[_cursor])) + // Lookahread: | + if (_text[_cursor] == '\0' || + isWhitespace (_text[_cursor])) { token = _text.substr (marker, _cursor - marker); type = Lexer::Type::substitution; @@ -861,7 +862,7 @@ bool Lexer::isSubstitution (std::string& token, Lexer::Type& type) //////////////////////////////////////////////////////////////////////////////// // Lexer::Type::pattern -// / / +// / / | bool Lexer::isPattern (std::string& token, Lexer::Type& type) { std::size_t marker = _cursor;