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;