/// <summary> /// Generates the code for a StateEvent node. /// </summary> /// <param name="se">The StateEvent node.</param> /// <param name="parentStateName">The name of the parent state.</param> /// <returns>String containing C# code for StateEvent se.</returns> private string GenerateStateEvent(StateEvent se, string parentStateName) { 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 se.kids) if (kid is ArgumentDeclarationList) argumentDeclarationListKids.Add(kid); else remainingKids.Add(kid); // "state" (function) declaration retstr += GenerateIndented(String.Format("public void {0}_event_{1}(", parentStateName, se.Name), se); // print the state arguments, if any foreach (SYMBOL kid in argumentDeclarationListKids) retstr += GenerateArgumentDeclarationList((ArgumentDeclarationList) kid); retstr += GenerateLine(")"); foreach (SYMBOL kid in remainingKids) retstr += GenerateNode(se, kid); return retstr; }
public StateBody (Parser yyp, StateEvent se ):base(((LSLSyntax )yyp)){ kids . Add ( se ); }
public StateBody (Parser yyp, StateBody sb , StateEvent se ):base(((LSLSyntax )yyp)){ while (0< sb . kids . Count ) kids . Add ( sb . kids . Pop ()); kids . Add ( se ); }