From 96c448ca1e94346da1c5ab9a82dc1ba326c6a7ca Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 29 Mar 2015 23:07:18 -0400 Subject: [PATCH] Lexer: Corrected off-by-one error in ::isTripleCharOperator --- src/Lexer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Lexer.cpp b/src/Lexer.cpp index a2599cc0c..29194c4dc 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -275,6 +275,9 @@ bool Lexer::isTripleCharOperator (int c0, int c1, int c2, int c3) //////////////////////////////////////////////////////////////////////////////// bool Lexer::isBoundary (int left, int right) { + // EOS + if (right == '\0') return true; + // XOR if (isalpha (left) != isalpha (right)) return true; if (isDigit (left) != isDigit (right)) return true; @@ -928,7 +931,7 @@ bool Lexer::isOperator (std::string& token, Lexer::Type& type) return true; } - else if (_eos - marker >= 4 && + else if (_eos - marker >= 3 && isTripleCharOperator (_text[marker], _text[marker + 1], _text[marker + 2], _text[marker + 3])) { marker += 3;