Example #1
0
 // 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);
 }
Example #2
0
        private SqlParserResult CreateNewResult(TSqlTokenType type)
        {
            var r = new SqlParserResult {
                Type = type
            };

            return(r);
        }
Example #3
0
        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);
        }
Example #4
0
 // 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;
 }