Additional enhancements to compute mustremove and cantremove sets for
[repair.git] / Repair / RepairCompiler / MCC / CDL.cup
index 74216907c51832266c2d7d183ce58c13f59d7466..76f769d58151caa7c956d27eb1982cf54b916a06 100755 (executable)
@@ -56,13 +56,27 @@ action code {:
 init with {: :}
 
 parser code {:
+
+       public String filename;
        
        public void syntax_error (java_cup.runtime.Symbol current) {
 
                CUP$CDLParser$actions.errors = true;
                Symbol symbol = (Symbol) current;
-               report_error("CDL: Syntax error at line " + (symbol.line + 1)
-               + ", 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);
        }
 
        public void report_fatal_error (String message, Object info) {
@@ -299,6 +313,15 @@ quantifier ::=
        q.addChild(set);
        RESULT = q;
        :}
+       | FORALL LT ID:r1 COMMA ID:r2 GT IN ID:relation
+       {:
+       debugMessage(PRODSTRING);
+       ParseNode q = new ParseNode("quantifier", parser.curLine(7));
+       q.addChild("relation", parser.curLine(1)).addChild(relation);
+       q.addChild("left", parser.curLine(5)).addChild(r1);
+       q.addChild("right", parser.curLine(3)).addChild(r2);
+       RESULT = q;
+       :}
        ;
 
 set ::=