public void EmptyExpressionsAreNotValid(string filter) { FilterLexer lexer = new FilterLexer(filter); Assert.IsNotNull(lexer); Assert.Count(0, lexer.Tokens); Assert.IsNull(lexer.GetNextToken()); Assert.IsNull(lexer.LookAhead(1)); Assert.IsNull(lexer.GetNextToken()); }
public void GetNextTokenLookAheadWithOneToken() { FilterLexer lexer = new FilterLexer("a"); Assert.IsNotNull(lexer); Assert.Count(1, lexer.Tokens); Assert.IsNull(lexer.LookAhead(0)); Assert.IsNotNull(lexer.LookAhead(1)); Assert.IsNull(lexer.LookAhead(2)); Assert.IsNotNull(lexer.GetNextToken()); Assert.IsNotNull(lexer.LookAhead(0)); Assert.IsNull(lexer.LookAhead(1)); Assert.IsNull(lexer.GetNextToken()); Assert.IsNull(lexer.LookAhead(0)); Assert.IsNull(lexer.LookAhead(1)); }
public void GetNextTokenAndLookAheadWithTwoTokens() { FilterLexer lexer = new FilterLexer("a:"); Assert.IsNotNull(lexer); Assert.Count(2, lexer.Tokens); Assert.IsNull(lexer.LookAhead(0)); Assert.IsNotNull(lexer.LookAhead(1)); Assert.IsNotNull(lexer.LookAhead(2)); Assert.IsNull(lexer.LookAhead(3)); Assert.IsNotNull(lexer.GetNextToken()); Assert.IsNotNull(lexer.LookAhead(0)); Assert.IsNotNull(lexer.LookAhead(1)); Assert.IsNull(lexer.LookAhead(2)); Assert.IsNotNull(lexer.GetNextToken()); Assert.IsNotNull(lexer.LookAhead(0)); Assert.IsNull(lexer.LookAhead(1)); Assert.IsNull(lexer.LookAhead(2)); Assert.IsNull(lexer.GetNextToken()); Assert.IsNull(lexer.LookAhead(0)); Assert.IsNull(lexer.LookAhead(1)); }