Example #1
0
        /// <summary>
        /// Create and initialize a new TemporaryVariableNode.
        /// </summary>
        /// <param name="parent">The function node that defines this temporary variable.</param>
        /// <param name="token">Identifier token containing the variable name.</param>
        protected internal TemporaryVariableNode(FunctionNode parent, IdentifierToken token)
            : base(token)
        {
#if DEBUG
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
#endif
            this.Parent = parent;
        }
Example #2
0
 /// <summary>
 /// Create and initialize a new TemporaryVariableNode.
 /// </summary>
 /// <param name="parent">The function node that defines this temporary variable.</param>
 /// <param name="token">Identifier token containing the variable name.</param>
 protected internal TemporaryVariableNode(FunctionNode parent, IdentifierToken token)
     : base(token)
 {
     #if DEBUG
     if (parent == null)
         throw new ArgumentNullException("parent");
     #endif
     this.Parent = parent;
 }
Example #3
0
        protected virtual ParseTemporariesResult ParseTemporaries(FunctionNode function, Token token)
        {
            // PARSE: <temporaries> ::= '|' <temporary variable list> '|'
            ParseTemporariesResult result = new ParseTemporariesResult();
            if (!(token is VerticalBarToken))
            {
                this.ResidueToken = token;
                return result;
            }

            result.LeftBar = (VerticalBarToken)token;
            while (true)
            {
                token = this.GetNextTokenxx(Preference.VerticalBar);
                if (token is VerticalBarToken)
                {
                    // Done with temp variables.
                    result.RightBar = (VerticalBarToken)token;
                    return result;
                }
                if (token is IdentifierToken)
                {
                    result.Temporaries.Add(new TemporaryVariableNode(function, (IdentifierToken)token));
                }
                else
                {
                    this.ReportParserError(function, SemanticErrors.MissingClosingTempBar, token);
                    this.ResidueToken = token;
                    return result;
                }
            }
        }