()
| 1549 | // factor: ('+'|'-'|'~') factor | power |
| 1550 | // power: atom_expr ['**' factor] |
| 1551 | private _parseAirthmeticFactor(): ExpressionNode { |
| 1552 | let nextOperator = this._peekOperatorType(); |
| 1553 | if (nextOperator === OperatorType.Add || |
| 1554 | nextOperator === OperatorType.Subtract || |
| 1555 | nextOperator === OperatorType.BitwiseInvert) { |
| 1556 | this._getNextToken(); |
| 1557 | let expression = this._parseAirthmeticFactor(); |
| 1558 | return new UnaryExpressionNode(expression, nextOperator); |
| 1559 | } |
| 1560 | |
| 1561 | let leftExpr = this._parseAtomExpression(); |
| 1562 | if (leftExpr instanceof ErrorExpressionNode) { |
| 1563 | return leftExpr; |
| 1564 | } |
| 1565 | |
| 1566 | if (this._consumeTokenIfOperator(OperatorType.Power)) { |
| 1567 | let rightExpr = this._parseAirthmeticFactor(); |
| 1568 | return new BinaryExpressionNode(leftExpr, rightExpr, OperatorType.Power); |
| 1569 | } |
| 1570 | |
| 1571 | return leftExpr; |
| 1572 | } |
| 1573 | |
| 1574 | // atom_expr: ['await'] atom trailer* |
| 1575 | // trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME |
no test coverage detected