OK, the parser now looks more decent.
[repair.git] / Repair / RepairCompiler / MCC / MDL.cup
index 0a3aa09..efd4942 100755 (executable)
@@ -63,7 +63,26 @@ parser code {:
 
                CUP$MDLParser$actions.errors = true;
                Symbol symbol = (Symbol) current;
-               report_error(filename+":"+(symbol.line+1)+": Syntax error at column " + LineCount.getColumn(symbol.left) +": " + current.value, current);
+
+               //System.out.println("current.value = "+current.value + " " + current.value.equals("true"));
+               //System.out.println("current = " + 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+")?");
+              
+                       if (LineCount.getColumn(symbol.left) == 0)      
+                  System.out.println("Did you forget a semicolon on the previous line?");    
+               
+
+               System.out.println();
                System.exit(0);
        }