private List <SyntaxNode> ReadExpressionOperands(SyntaxNode firstTerm) { List <SyntaxNode> operands = new List <SyntaxNode> { firstTerm }; while (NextTokenIsATermOperator()) { tokens.AssertCanRead(); tokens.AssertPeekIsTypeOfOne(SyntaxTreeConstants.TermOperatorTypes); AddToExpressionOperands(tokens.Next(), operands); } return(operands); }
public void AssertPeekIsTypeOfOne_AdditionToken_ThrowsException() { Tokens tokens = new Tokens(new List <Token> { new Token(TokenType.Addition) }); Assert.Throws <UnexpectedTokenException>(() => tokens.AssertPeekIsTypeOfOne( new List <TokenType> { TokenType.Subtraction } )); }