public GlobalDefinitions(Parser yyp, GlobalFunctionDefinition gfd) : base(((LSLSyntax )yyp)) { kids.Add(gfd); }
public GlobalDefinitions(Parser yyp, GlobalDefinitions gd, GlobalFunctionDefinition gfd) : base(((LSLSyntax )yyp)) { while (0 < gd.kids.Count) kids.Add(gd.kids.Pop()); kids.Add(gfd); }
/// <summary> /// Generates the code for a GlobalFunctionDefinition node. /// </summary> /// <param name="gf">The GlobalFunctionDefinition node.</param> /// <returns>String containing C# code for GlobalFunctionDefinition gf.</returns> private string GenerateGlobalFunctionDefinition(GlobalFunctionDefinition gf) { string retstr = String.Empty; // we need to separate the argument declaration list from other kids List<SYMBOL> argumentDeclarationListKids = new List<SYMBOL>(); List<SYMBOL> remainingKids = new List<SYMBOL>(); foreach (SYMBOL kid in gf.kids) if (kid is ArgumentDeclarationList) argumentDeclarationListKids.Add(kid); else remainingKids.Add(kid); retstr += GenerateIndented(String.Format("{0} {1}(", gf.ReturnType, CheckName(gf.Name)), gf); // print the state arguments, if any foreach (SYMBOL kid in argumentDeclarationListKids) retstr += GenerateArgumentDeclarationList((ArgumentDeclarationList)kid); retstr += GenerateLine(")"); foreach (SYMBOL kid in remainingKids) retstr += GenerateNode(kid); return retstr; }