Ejemplo n.º 1
0
        /// <summary>
        /// Core function for this object. It will attempt to build a source
        /// program tree from the stored list of tokens
        /// </summary>
        /// <returns></returns>
        public SyntaxNode ParseTree()
        {
            // Initialise the Query
            QuerySyntaxNode oQuery = new QuerySyntaxNode();

            // WHILE has tokens to process
            // Anytime we get here, create a new statement?
            while (TokenList.HasTokensLeftToProcess())
            {
                // Initialise a new statement every time we get here
                StatementSyntaxNode oStatement = new StatementSyntaxNode();

                // Pull off the first node
                SyntaxNode CurrentNode = SyntaxNodeFactory.ContextSensitiveConvertTokenToNode(new ParsingContext(oQuery, TokenList));

                // If we consumed anything
                if (CurrentNode.TryConsumeFromContext(new ParsingContext(CurrentNode, TokenList)))
                {
                }

                // Append to the statement anyways
                oStatement.Add(CurrentNode);

                oQuery.Add(oStatement);
            }

            // Return the Query
            return(oQuery);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Provides context sensitive generation of a new Node
 /// </summary>
 /// <param name="xoContext.CurrentNode"></param>
 /// <param name="xoContext.List"></param>
 /// <returns></returns>
 private static SyntaxNode DefaultTryConsumeNext(ParsingContext xoContext, Boolean xbIsPreconsumption = false)
 {
     return(SyntaxNodeFactory.ContextSensitiveConvertTokenToNode(xoContext));
 }