From b6a33cf4c6c66d364986d7f652c8574953fac4d9 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 8 Feb 2012 09:47:20 -0700 Subject: Fixed lexer issue on -, precidence of comparisons. --- src/parser.l | 4 ++-- src/parser.y | 2 +- src/variable.h | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/parser.l b/src/parser.l index 70704b8..950c209 100644 --- a/src/parser.l +++ b/src/parser.l @@ -72,7 +72,7 @@ null { return tokNull; } [a-zA-Z_][a-zA-Z0-9_]* { yylval->sValue = new Bu::String( yytext ); return tokIdent; } --?[1-9][0-9]* { +[1-9][0-9]* { yylval->iValue = strtoll( yytext, NULL, 10 ); return tokInt; } @@ -81,7 +81,7 @@ null { return tokNull; } return tokInt; } --?([1-9][0-9]*|0)?\.[0-9]* { +([1-9][0-9]*|0)?\.[0-9]* { // printf("Parsing float: %s\n", yytext ); yylval->dValue = strtod( yytext, NULL ); // printf("Final float: %f\n", yylval->dValue ); diff --git a/src/parser.y b/src/parser.y index 47c0159..0358e48 100644 --- a/src/parser.y +++ b/src/parser.y @@ -87,9 +87,9 @@ void yyerror( YYLTYPE *llocp, yyscan_t yyscanner, GameBuilder &, const char *err %left NOT %right '=' tokPlusAssign tokMinusAssign tokTimesAssign tokDivideAssign %left tokIn tokAnd tokOr +%right '<' '>' tokLtEq tokGtEq tokCmp %left '-' '+' %left '*' '/' -%right '<' '>' tokLtEq tokGtEq tokCmp %left '(' ')' '[' ']' %left NEG diff --git a/src/variable.h b/src/variable.h index 2e84ae1..83b6d44 100644 --- a/src/variable.h +++ b/src/variable.h @@ -25,16 +25,16 @@ friend Bu::Formatter &operator<<( Bu::Formatter &f, const Variable &v ); public: enum Type { - tNull, - tBool, - tInt, - tFloat, - tSituation, - tVariable, - tVarPtr, - tList, - tDictionary, - tString, + tNull = 0, + tBool = 1, + tInt = 2, + tFloat = 3, + tSituation = 4, + tVariable = 5, + tVarPtr = 6, + tList = 7, + tDictionary = 8, + tString = 9, }; public: -- cgit v1.2.3