/// <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; }
/// <summary> /// Add formal to FunctionDefinition /// </summary> /// <param name="formal">Formal to add</param> public void AddFormal(Formal formal) { FormalList.Add(formal); }
public virtual void Visit(Formal formal) { VisitSubNodes(formal); }
/// <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); }