]> git.mdlowis.com Git - archive/dlang.git/commitdiff
Fixed infinite loop in dlparser
authorMike D. Lowis <mike@mdlowis.com>
Fri, 11 May 2012 13:06:44 +0000 (09:06 -0400)
committerMike D. Lowis <mike@mdlowis.com>
Fri, 11 May 2012 13:06:44 +0000 (09:06 -0400)
source/dlparser/dlparser.cpp

index 8af9bdddb97fdcb1bd44935c6e3dd213950d044e..c7a9432d54139d01ad8475441bd362158957fdba 100644 (file)
@@ -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;
 }