Beispiel #1
0
        private bool IsKeyword(string symbol, out Token terminalToken)
        {
            var lookAheadChar = GetLookAheadChar();

            if (!IsInSymbolAsIdentifierState(lookAheadChar)
                &&
                !IsCanonicalFunctionCall(symbol, lookAheadChar)
                &&
                InternalKeywordDictionary.ContainsKey(symbol))
            {
                ResetSymbolAsIdentifierState(true);

                var keywordID = InternalKeywordDictionary[symbol];

                if (keywordID == CqlParser.AS)
                {
                    // Treat the symbol following AS keyword as an identifier.
                    // Note that this state will be turned off by a punctuator, so in case of function definitions:
                    // FUNCTION identifier(...) AS (generalExpr)
                    // the generalExpr will not be affected by the state.
                    _symbolAsAliasIdentifierState = true;
                }
                else if (keywordID == CqlParser.FUNCTION)
                {
                    // Treat the symbol following FUNCTION keyword as an identifier.
                    // Inline function names in definition section have stronger restrictions than normal identifiers
                    _symbolAsInlineFunctionNameState = true;
                }

                terminalToken = NewToken(keywordID, new TerminalToken(symbol, _iPos));
                return(true);
            }
            else
            {
                terminalToken = null;
                return(false);
            }
        }
Beispiel #2
0
 // <summary>
 // returns true if given term is a eSQL keyword
 // </summary>
 internal static bool IsReservedKeyword(string term)
 {
     return(InternalKeywordDictionary.ContainsKey(term));
 }