Ejemplo n.º 1
0
        /// <summary>
        /// Parser for Formal
        /// </summary>
        /// <returns>Parsed Formal</returns>
        public Formal ParseFormal()
        {
            Formal formal = new Formal();

            CurrentToken = TokenStream.NextToken();
            formal.SetIdentifier(CurrentToken.GetValue().ToString());

            return formal;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Add formal to FunctionDefinition
 /// </summary>
 /// <param name="formal">Formal to add</param>
 public void AddFormal(Formal formal)
 {
     FormalList.Add(formal);
 }
Ejemplo n.º 3
0
 public virtual void Visit(Formal formal)
 {
     VisitSubNodes(formal);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Add formal to FunctionDefinition
 /// </summary>
 /// <param name="formal">Formal to add</param>
 public void AddFormal(Formal formal)
 {
     FormalList.Add(formal);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Visit FuncBindAssignment
        /// </summary>
        /// <param name="assignment">FuncBindAssignment to check</param>
        public override void Visit(FuncBindAssignment assignment)
        {
            //FuncBind is a function, so let checking do by FunctionDefinition visitor
            FunctionDefinition function = new FunctionDefinition();
            function.SetIdentifier(assignment.GetIdentifier());

            foreach (String identifier in assignment.GetIdentifiers())
            {
                Formal formal = new Formal();
                formal.SetIdentifier(identifier);
                function.AddFormal(formal);
            }

            function.AddStatement(assignment.GetStatement());

            //Check this new function
            function.AcceptVisitor(this);
            //Add to SymbolTable
            SymbolTable.AddFunctionDefinition(function);
        }