(Lexer lexer, ASTree left, int prec)
| 199 | res.add(right); |
| 200 | } |
| 201 | private ASTree doShift(Lexer lexer, ASTree left, int prec) |
| 202 | throws ParseException |
| 203 | { |
| 204 | ArrayList<ASTree> list = new ArrayList<ASTree>(); |
| 205 | list.add(left); |
| 206 | list.add(new ASTLeaf(lexer.read())); |
| 207 | ASTree right = factor.parse(lexer); |
| 208 | Precedence next; |
| 209 | while ((next = nextOperator(lexer)) != null |
| 210 | && rightIsExpr(prec, next)) |
| 211 | right = doShift(lexer, right, next.value); |
| 212 | |
| 213 | list.add(right); |
| 214 | return factory.make(list); |
| 215 | } |
| 216 | private Precedence nextOperator(Lexer lexer) throws ParseException { |
| 217 | Token t = lexer.peek(0); |
| 218 | if (t.isIdentifier()) |
no test coverage detected