private void ParseExpression() { var firstSetOfStatement5 = new[] { TokenKind.Plus, TokenKind.Minus, TokenKind.LeftParen, TokenKind.Identifier, TokenKind.NumberLiteral, TokenKind.StringLiteral }; MatchOneOf(firstSetOfStatement5); switch (_scanner.CurrentToken.TokenKind) { case TokenKind.Plus: case TokenKind.Minus: ParseSign(); ParseTerm(); _astBuilder.UnaryOpEnd(_scanner.CurrentToken); var firstSetOfKleeneStar2 = new[] { TokenKind.Plus, TokenKind.Minus }; while (firstSetOfKleeneStar2.Contains(_scanner.CurrentToken.TokenKind)) { _astBuilder.BinaryOp(_scanner.CurrentToken); ParseAddOperator(); ParseTerm(); _astBuilder.BinaryOpEnd(_scanner.CurrentToken); } break; case TokenKind.LeftParen: case TokenKind.Identifier: case TokenKind.NumberLiteral: case TokenKind.StringLiteral: ParseTerm(); var firstSetOfKleeneStar3 = new[] { TokenKind.Plus, TokenKind.Minus }; while (firstSetOfKleeneStar3.Contains(_scanner.CurrentToken.TokenKind)) { _astBuilder.BinaryOp(_scanner.CurrentToken); ParseAddOperator(); ParseTerm(); _astBuilder.BinaryOpEnd(_scanner.CurrentToken); } break; } }