()
| 991 | } |
| 992 | |
| 993 | private parseAdditive(): AST { |
| 994 | // '+', '-' |
| 995 | const start = this.inputIndex; |
| 996 | let result = this.parseMultiplicative(); |
| 997 | while (this.next.type == TokenType.Operator) { |
| 998 | const operator = this.next.strValue; |
| 999 | switch (operator) { |
| 1000 | case '+': |
| 1001 | case '-': |
| 1002 | this.advance(); |
| 1003 | let right = this.parseMultiplicative(); |
| 1004 | result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right); |
| 1005 | continue; |
| 1006 | } |
| 1007 | break; |
| 1008 | } |
| 1009 | return result; |
| 1010 | } |
| 1011 | |
| 1012 | private parseMultiplicative(): AST { |
| 1013 | // '*', '%', '/' |
no test coverage detected