From 3eb840419978c8badc370cf4bec66e4adac41eae Mon Sep 17 00:00:00 2001 From: Brandon Rozek Date: Wed, 3 Oct 2018 14:07:31 -0400 Subject: [PATCH] Fixed the issue where I was only parsing a single digit for integers. Now numbers greater than ten are supported as integers :) --- src/parser/lexer.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser/lexer.l b/src/parser/lexer.l index d31d458..ed19a27 100644 --- a/src/parser/lexer.l +++ b/src/parser/lexer.l @@ -50,7 +50,7 @@ DIGIT [0-9] "true" {yylval.value = new Node(VALUE, std::unique_ptr(make_true()), ""); return VALUE;} "false" {yylval.value = new Node(VALUE, std::unique_ptr(make_false()), ""); return VALUE;} \".*\" {yylval.value = new Node(VALUE, std::unique_ptr(make_string(substring(yytext, 1, strlen(yytext) - 1))), ""); return VALUE; } -{DIGIT} {std::vector nums; nums.push_back(atoi(yytext)); yylval.value = new Node(VALUE, std::unique_ptr(make_long(nums)), ""); return VALUE;} +{DIGIT}+ {std::vector nums; nums.push_back(atoi(yytext)); yylval.value = new Node(VALUE, std::unique_ptr(make_long(nums)), ""); return VALUE;} {DIGIT}*"."?{DIGIT}+ {std::vector decs; decs.push_back(atof(yytext)); yylval.value = new Node(VALUE, std::unique_ptr(make_double(decs)), ""); return VALUE;} [_a-zA-Z][_a-zA-Z0-9]* {yylval.value = new Node(IDENTIFIER, std::unique_ptr(nullptr), yytext); return IDENTIFIER;} [\n] {linenum++;}