Ejemplo n.º 1
0
        public ISyntax Pop()
        {
            ISyntax oTemp = Peek();

            // Completely remove nodes that were added
            if (!oTemp.IsNode())
            {
                Position++;
                return(oTemp);
            }
            else
            {
                aoItems.Remove(oTemp);
                return(oTemp);
            }
        }
Ejemplo n.º 2
0
        public SyntaxNode(ISyntax xoToken, NodeStrategy xoStrategy, int xiMaxChildCount = -1)
        {
            // Assign object vars
            iMaxChildCount = xiMaxChildCount;
            Comments       = new List <StatusItem>();
            Strategy       = xoStrategy;

            // Add the token according to what was given
            Type oType = xoToken.GetType();

            if (oType == typeof(SyntaxToken))
            {
                Token = (SyntaxToken)xoToken;
            }
            else if (xoToken.IsNode())
            {
                Token = ((SyntaxNode)xoToken).Token;
            }
            else
            {
                // Added trivia or something obscure
                throw new Exception("Invalid object added to SyntaxNode (" + oType.ToString() + ")");
            }
        }