private void AddStatement(Statement s) { if (s.kids.Top is IfStatement || s.kids.Top is WhileStatement || s.kids.Top is DoWhileStatement || s.kids.Top is ForLoop) kids.Add(s.kids.Pop()); else kids.Add(s); }
public WhileStatement(Parser yyp, SYMBOL s, Statement st) : base(((LSLSyntax )yyp)) { kids.Add(s); if (0 < st.kids.Count && st.kids.Top is CompoundStatement) kids.Add(st.kids.Pop()); else kids.Add(st); }
public StatementList(Parser yyp, Statement s) : base(((LSLSyntax )yyp)) { AddStatement(s); }
public StatementList(Parser yyp, StatementList sl, Statement s) : base(((LSLSyntax )yyp)) { while (0 < sl.kids.Count) kids.Add(sl.kids.Pop()); AddStatement(s); }
private void AddStatement(Statement s) { if (0 < s.kids.Count && s.kids.Top is CompoundStatement) kids.Add(s.kids.Pop()); else kids.Add(s); }
public IfStatement(Parser yyp, SYMBOL s, Statement ifs, Statement es) : base(((LSLSyntax )yyp)) { kids.Add(s); AddStatement(ifs); if (0 < es.kids.Count && es.kids.Top is IfStatement) kids.Add(es.kids.Pop()); else AddStatement(es); }
public IfStatement(Parser yyp, SYMBOL s, Statement ifs) : base(((LSLSyntax )yyp)) { kids.Add(s); AddStatement(ifs); }
public ForLoop(Parser yyp, ForLoopStatement flsa, Expression e, ForLoopStatement flsb, Statement s) : base(((LSLSyntax )yyp)) { kids.Add(flsa); kids.Add(e); kids.Add(flsb); if (0 < s.kids.Count && s.kids.Top is CompoundStatement) kids.Add(s.kids.Pop()); else kids.Add(s); }
/// <summary> /// Generates the code for a Statement node. /// </summary> /// <param name="s">The Statement node.</param> /// <returns>String containing C# code for Statement s.</returns> private string GenerateStatement(Statement s) { string retstr = String.Empty; bool printSemicolon = true; retstr += Indent(); if (0 < s.kids.Count) { // Jump label prints its own colon, we don't need a semicolon. printSemicolon = !(s.kids.Top is JumpLabel); foreach (SYMBOL kid in s.kids) retstr += GenerateNode(kid); } if (printSemicolon) retstr += GenerateLine(";"); return retstr; }