Esempio n. 1
0
        }         // ParseSourceElements

        // Parse a FunctionDeclaration or FunctionExpression.  The "function"
        // keyword should already have been matched.
        private void ParseFunction(FunctionInfo parent, bool isExpression)
        {
            string functionName = null;

            if (isExpression)
            {
                tok.TryMatchID(out functionName);
            }
            else
            {
                functionName = tok.MatchID();
            }

            FunctionInfo info = new FunctionInfo(parent.program, parent,
                                                 (isExpression) ? null : functionName);

            tok.MatchOp("(");
            if (!tok.PeekOp(")"))
            {
                do
                {
                    info.AddParamName(tok.MatchID());
                }while (tok.TryMatchOp(","));
            }

            tok.MatchOp(")");
            tok.MatchOp("{");
            ParseSourceElements(info);
            tok.MatchOp("}");
        }         // ParseFunction
Esempio n. 2
0
		} // ParseSourceElements
	
	
	// Parse a FunctionDeclaration or FunctionExpression.  The "function"
	// keyword should already have been matched.
	private void ParseFunction(FunctionInfo parent, bool isExpression)
		{
		string functionName = null;
		
		if (isExpression)
			tok.TryMatchID(out functionName);
		else
			functionName = tok.MatchID();
		
		FunctionInfo info = new FunctionInfo( parent.program, parent,
											  (isExpression) ? null : functionName );
		
		tok.MatchOp("(");
		if (!tok.PeekOp(")"))
			{
			do
				info.AddParamName(tok.MatchID());
			while (tok.TryMatchOp(","));
			}
		
		tok.MatchOp(")");
		tok.MatchOp("{");
		ParseSourceElements(info);
		tok.MatchOp("}");
		} // ParseFunction