Ejemplo n.º 1
0
        /// <summary>
        /// Scans ahead for a possibly Identifier/Alias and returns the value
        /// if it finds one. if it does find one, it will move the Window accordingly
        /// </summary>
        /// <param name="xoToken"></param>
        /// <param name="xoList"></param>
        /// <returns></returns>
        public static String ScanAheadForAlias(SyntaxList xoList)
        {
            String sAlias = String.Empty;

            // SCAN AHEAD - To grab an alias if there is one
            if (xoList.HasTokensLeftToProcess())
            {
                ISyntax oNextNode = xoList.Peek();

                // Explicit
                if (oNextNode.ExpectedType == SyntaxKind.AsKeyword)
                {
                    // And the next node after that is an identifier
                    if (xoList.Peek(1).ExpectedType == SyntaxKind.IdentifierToken)
                    {
                        // Alias found
                        sAlias = xoList.Peek(1).RawSQLText;
                        xoList.Pop(2);
                    }
                }
                // Implicit
                else if (oNextNode.ExpectedType == SyntaxKind.IdentifierToken)
                {
                    // Alias found
                    sAlias = oNextNode.RawSQLText;
                    xoList.Pop();
                }
            }

            // Return the newly created table node
            return(sAlias);
        }