Archived
1
0
Fork 0

Fixed the issue where I was only parsing a single digit for integers.

Now numbers greater than ten are supported as integers :)
This commit is contained in:
Brandon Rozek 2018-10-03 14:07:31 -04:00
parent cf0a90dda1
commit 3eb8404199

View file

@ -50,7 +50,7 @@ DIGIT [0-9]
"true" {yylval.value = new Node(VALUE, std::unique_ptr<Value>(make_true()), ""); return VALUE;}
"false" {yylval.value = new Node(VALUE, std::unique_ptr<Value>(make_false()), ""); return VALUE;}
\".*\" {yylval.value = new Node(VALUE, std::unique_ptr<Value>(make_string(substring(yytext, 1, strlen(yytext) - 1))), ""); return VALUE; }
{DIGIT} {std::vector<long> nums; nums.push_back(atoi(yytext)); yylval.value = new Node(VALUE, std::unique_ptr<Value>(make_long(nums)), ""); return VALUE;}
{DIGIT}+ {std::vector<long> nums; nums.push_back(atoi(yytext)); yylval.value = new Node(VALUE, std::unique_ptr<Value>(make_long(nums)), ""); return VALUE;}
{DIGIT}*"."?{DIGIT}+ {std::vector<double> decs; decs.push_back(atof(yytext)); yylval.value = new Node(VALUE, std::unique_ptr<Value>(make_double(decs)), ""); return VALUE;}
[_a-zA-Z][_a-zA-Z0-9]* {yylval.value = new Node(IDENTIFIER, std::unique_ptr<Value>(nullptr), yytext); return IDENTIFIER;}
[\n] {linenum++;}