Exemple #1
0
 public AstProgram(Peg.PegAstNode node)
     : base(node)
 {
     foreach (Peg.PegAstNode child in node.GetChildren())
     {
         CatAstNode statement = CatAstNode.Create(child);
         mStatements.Add(statement);
     }
 }
Exemple #2
0
 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);
     }
 }
Exemple #3
0
 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);
     }
 }