public AstRoot(PegAstNode node) : base(node) { foreach (PegAstNode child in node.GetChildren()) { Defs.Add(new AstDef(child)); } }
public RubyScript(PegAstNode node) : base(node) { foreach (PegAstNode child in node.GetChildren()) { RubyAstNode statement = RubyAstNode.Create(child); mStatements.Add(statement); } }
public AstMetaData(PegAstNode node) : base(node) { foreach (PegAstNode child in node.GetChildren()) { AstMetaData x = Create(child) as AstMetaData; if (x == null) { throw new Exception("Meta data-nodes can only have meta-data nodes as children"); } children.Add(x); } }
public AstMacroQuote(PegAstNode node) : base(node) { CheckLabel(AstLabel.MacroQuote); foreach (PegAstNode child in node.GetChildren()) { AstMacroTerm term = Create(child) as AstMacroTerm; if (term == null) { throw new Exception("internal grammar error: macro quotations can only contain macro terms"); } mTerms.Add(term); } }
public AstMacroPattern(PegAstNode node) : base(node) { CheckLabel(AstLabel.MacroPattern); foreach (PegAstNode child in node.GetChildren()) { AstMacroTerm tmp = CatAstNode.Create(child) as AstMacroTerm; if (tmp == null) { throw new Exception("invalid grammar: only macro terms can be children of an ast macro mPattern"); } mPattern.Add(tmp); } }
public AstStack(PegAstNode node) : base(node) { CheckLabel(AstLabel.Stack); foreach (PegAstNode child in node.GetChildren()) { CatAstNode tmp = Create(child); if (!(tmp is AstType)) { throw new Exception("stack AST node should only have type AST nodes as children"); } mTypes.Add(tmp as AstType); } }
public AstQuote(PegAstNode node) : base(node) { CheckLabel(AstLabel.Quote); foreach (PegAstNode child in node.GetChildren()) { CatAstNode tmp = CatAstNode.Create(child); if (!(tmp is AstExpr)) { throw new Exception("invalid child node " + child.ToString() + ", expected an expression node"); } mTerms.Add(tmp as AstExpr); } }