@Rule(left="expression", value="symbol") protected String plainSymbol(String symbol) { return symbol; }
@Rule(left="expression", value={"expression", "'"+CIRCLED_PLUS+"'"}) protected TypeMirror plainPlus(TypeMirror type) { return type; }
@Rule(left="expression", value={"expression", "'"+INVERTED_QUESTION_MARK+"'"}) protected TypeMirror plainOpt(TypeMirror type) { return type; }
@Rule("term") protected DEH expression(DEH term) { return term; } @Rule("factor")
@Rule("andExpression") protected DEH conditionalExpression(DEH andExpression) { return andExpression; } @Rule(value={"conditionalExpression", "OR", "andExpression"})
@Rule("conditionalAtom") protected DEH orExpression(DEH conditionalAtom) { return conditionalAtom; } @Rule(left="conditionalAtom", value={"LPAREN", "conditionalExpression", "RPAREN"})
@Rule({"choices", "or", "part"}) protected List<String> choices(List<String> choices, String symbol) { choices.add(symbol); return choices; } @Rule({"'\\('", "seqs", "'\\)'"})
@Rule({"expression"}) protected List<TypeMirror> seqList(TypeMirror type) { List<TypeMirror> list = new ArrayList<>(); list.add(type); return list; } @Rule({"seqList", "comma", "expression"})
@Rule("expression") protected List<DEH> expressionList(DEH expression) { ArrayList<DEH> list = new ArrayList<>(); list.add(expression); return list; } @Rule({"expressionList", "COMMA", "expression"})
@Rule({"part"}) protected List<String> seqs(String symbol) { List<String> list = new ArrayList<>(); list.add(symbol); return list; } @Rule({"seqs", "part"})
@Rule({"'\\\\'", "'Z'"}) protected Range endOfInputOrLine() { return new Range(Range.BoundaryType.EOIL); } @Rule({"'\\\\'", "'z'"})
@Rule(left="factor", value={"CBRT", "atom"}) protected DEH cbrt( DEH atom, @ParserContext("handler") ExpressionHandler<T,M,F,P> handler ) throws Exception { List<DEH> args = new ArrayList<>(); args.add(atom); return func("cbrt", args, false, handler); } @Rule(left="atom", value={"PI"})
@Rule({"'\\.'"}) protected RangeSet charRange() { RangeSet rs = new RangeSet(); rs.add(0, Integer.MAX_VALUE); return rs; } @Rule({"character"})
@Rule(left="atom", value={"PIPE", "expression", "PIPE"}) protected DEH abs( DEH expression, @ParserContext("degrees") boolean degrees, @ParserContext("handler") ExpressionHandler<T,M,F,P> handler ) throws Exception { List<DEH> args = new ArrayList<>(); args.add(expression); return func("abs", args, degrees, handler); } @Rule(left="factor", value={"atom", "EXP", "factor"})
@Rule(left="conditionalAtom", value={"NOT", "conditionalAtom"}) protected DEH notConditional(DEH conditionalExpression) throws Exception { conditionalExpression.getProxy().not(); return conditionalExpression; } @Rule(left="conditionalAtom", value={"expression", "EQ", "expression"})
@Rule(left="term", value={"term", "SLASH", "factor"}) protected DEH div(DEH term, DEH factor) throws Exception { term.append(factor); term.getProxy().div(); return term; } @Rule(left="term", value={"term", "PERCENT", "factor"})
@Rule(left="conditionalAtom", value={"expression", "EQ", "expression"}) protected DEH eqConditional(DEH exp1, DEH exp2) throws Exception { exp1.append(exp2); exp1.getProxy().eq(); return exp1; } @Rule(left="conditionalAtom", value={"expression", "NE", "expression"})
@Rule(left="conditionalAtom", value={"expression", "NE", "expression"}) protected DEH neConditional(DEH exp1, DEH exp2) throws Exception { exp1.append(exp2); exp1.getProxy().ne(); return exp1; } @Rule(left="conditionalAtom", value={"expression", "LT", "expression"})
@Rule(left="conditionalAtom", value={"expression", "LE", "expression"}) protected DEH leConditional(DEH exp1, DEH exp2) throws Exception { exp1.append(exp2); exp1.getProxy().le(); return exp1; } @Rule(left="conditionalAtom", value={"expression", "GT", "expression"})
@Rule(value={"andExpression", "AND", "orExpression"}) protected DEH andExpression(DEH andExpression, DEH orExpression) throws Exception { andExpression.getProxy().checkAnd(); andExpression.append(orExpression); andExpression.getProxy().and(); return andExpression; } @Rule("conditionalAtom")