// read token by token's type private static bool ReadToken( IList <TSqlParserToken> tokens, TSqlTokenType type, ref string result, ref int nextToken, ref int farestError) { if (tokens.Count == nextToken) { farestError = nextToken; return(false); } if (tokens[nextToken].TokenType == type) { result = tokens[nextToken].Text; nextToken++; while (nextToken < tokens.Count && tokens[nextToken].TokenType > (TSqlTokenType)236) { nextToken++; } return(true); } farestError = Math.Max(farestError, nextToken); return(false); }
private SqlParserResult CreateNewResult(TSqlTokenType type) { var r = new SqlParserResult { Type = type }; return(r); }
private int FindNextTokenType(IList <TSqlParserToken> tokens, int index, TSqlTokenType tokenType) { while (index < tokens.Count && tokens[index].TokenType != tokenType) { ++index; } // We didnt find the token if (index == tokens.Count) { index = -1; } return(index); }
// read token by token's type private static bool ReadToken( IList<TSqlParserToken> tokens, TSqlTokenType type, ref string result, ref int nextToken, ref int farestError) { if (tokens.Count == nextToken) { farestError = nextToken; return false; } if (tokens[nextToken].TokenType == type) { result = tokens[nextToken].Text; nextToken++; while (nextToken < tokens.Count && tokens[nextToken].TokenType > (TSqlTokenType)236) nextToken++; return true; } farestError = Math.Max(farestError, nextToken); return false; }