OK, the parser now looks more decent.
[repair.git] / Repair / RepairCompiler / MCC / CDL.cup
index e77068d0b550de52ebbf8582d8c6b42ca4195017..76f769d58151caa7c956d27eb1982cf54b916a06 100755 (executable)
@@ -63,7 +63,19 @@ parser code {:
 
                CUP$CDLParser$actions.errors = true;
                Symbol symbol = (Symbol) current;
-               report_error(filename+":"+(symbol.line+1)+": Syntax error at column " + LineCount.getColumn(symbol.left) +": " + current.value, current);
+
+               boolean isInteger = true;
+               try{ 
+                   Integer.parseInt(current.value.toString());
+               } catch(NumberFormatException e) { isInteger = false;}
+
+                report_error(filename+":"+(symbol.line+1)+": Syntax error at column " 
+                + (LineCount.getColumn(symbol.left)+1) +": " + current.value, current);
+
+               if (current.value.equals("true") || isInteger)
+                  System.out.println("Did you mean literal("+current.value+")?");
+
+               System.out.println();
                System.exit(0);
        }