Exemplo n.º 1
0
        public ExpressionNode ParseExpression(string source)
        {
            _lexer = new Lexer(_errorReporter, source);
            Reset();
            _rangeRecorder.Begin();

            // Start parsing

            ExpressionNode expression = ParseExpression();

            // We are done so no tokens should remain

            if (expression != null)
                Match(TokenId.Eof);

            return expression;
        }
Exemplo n.º 2
0
        public QueryNode ParseQuery(string source)
        {
            _lexer = new Lexer(_errorReporter, source);
            Reset();
            _rangeRecorder.Begin();

            // Start parsing

            QueryNode query = ParseQueryWithOptionalCTE();

            // We are done so no tokens should remain

            if (query != null)
                Match(TokenId.Eof);

            return query;
        }
Exemplo n.º 3
0
		public static TokenStream FromSource(IErrorReporter errorReporter, string source)
		{
			Lexer lexer = new Lexer(errorReporter, source);

			List<Token> tokenList = new List<Token>();

			while (lexer.NextToken())
			{
				if (lexer.TokenID == TokenId.SELECT)
					lexer.IsQuery = true;

				Token token = lexer.GetToken();
				tokenList.Add(token);
			}

			TokenStream result = new TokenStream();
			result._tokens = tokenList.ToArray();

			return result;
		}