From: Mike D. Lowis Date: Fri, 11 May 2012 13:06:44 +0000 (-0400) Subject: Fixed infinite loop in dlparser X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=5be4570e6d1323e63c5c8a7ccfa16848632a1abc;p=archive%2Fdlang.git Fixed infinite loop in dlparser --- diff --git a/source/dlparser/dlparser.cpp b/source/dlparser/dlparser.cpp index 8af9bdd..c7a9432 100644 --- a/source/dlparser/dlparser.cpp +++ b/source/dlparser/dlparser.cpp @@ -169,7 +169,6 @@ AST* DLParser::Application(void) // Register the new terminator // Consume the name - cout << "Macro Usage" << endl; ret = new AST( MACRO_APP, 1, new AST( lookaheadToken(1) )); consume(); @@ -222,7 +221,21 @@ AST* DLParser::Application(void) AST* DLParser::Literal(void) { AST* ret = new AST( lookaheadToken(1) ); - consume(); + + if( (ID == lookaheadType(1)) || + (CHAR == lookaheadType(1)) || + (STRING == lookaheadType(1)) || + (SYMBOL == lookaheadType(1)) || + (NUM == lookaheadType(1)) ) + { + consume(); + } + else + { + Exception ex( lookaheadToken(1) ); + throw ex; + } + return ret; }