From e45abf48ba786e8ca87f5037b5474701606d6b70 Mon Sep 17 00:00:00 2001 From: Michael Ochmann Date: Sat, 19 Feb 2022 15:21:26 +0100 Subject: [PATCH] fixed additional comsumption of token if operator --- src/Lexer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 3c364ff..fe2fc3a 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -203,7 +203,6 @@ namespace dumb { this->tokenStream.emplace_back(type, "", this->line, this->column); - this->consume(); } void Lexer::readStringLiteral() { @@ -267,6 +266,10 @@ namespace dumb { std::cout << "Unexpected token '" << this->current() << "' on line " << this->line << " column " << this->column << std::endl; exit(1); } + if (std::isdigit(this->current())) { + std::cout << "Unexpected token '" << this->current() << "' on line " << this->line << " column " << this->column << std::endl; + exit(1); + } this->tokenStream.emplace_back(Token::Type::INTEGER_LITERAL, std::to_string(value), line, column); this->resetBuffer(); }