public override bool TryMatchCurrent(LexerBuilder lexer) { var prev = lexer.Previous; var first = lexer.Current; // check for keywords if (lexer.IsDelimiter(prev, true) && char.IsLetter(first)) { // can be a keyword... var sb = new StringBuilder(); sb.Append(lexer.Current); while (!lexer.EndOfInput && char.IsLetter(lexer.PeekNext())) { sb.Append(lexer.Current); } if (keywords.Contains(sb.ToString())) { if (!lexer.EndOfInput) { lexer.RollbackBy(1); } lexer.Commit(); return(true); } return(false); } else { return(false); } }