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) {
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 ::=