public override void Output(TextWriter writer, int nIndent) { string s = "define " + mName; if (mType != null) { s += " : " + mType.ToString(); } if (mParams.Count > 0) { s += " // ( "; foreach (AstParam p in mParams) { s += p.ToString() + " "; } s += ")"; } writer.WriteLine(IndentedString(nIndent, s)); writer.WriteLine(IndentedString(nIndent, "{")); foreach (AstExpr x in mTerms) { x.Output(writer, nIndent + 1); } writer.WriteLine(IndentedString(nIndent, "}")); }
public AstMacroStackVar(PegAstNode node) : base(node) { if (node.GetNumChildren() < 1) { throw new Exception("invalid macro stack variable"); } if (node.GetNumChildren() > 2) { throw new Exception("invalid macro stack variable"); } msName = node.GetChild(0).ToString(); if (node.GetNumChildren() == 2) { AstFxnType typeNode = new AstFxnType(node.GetChild(1)); mType = CatFxnType.Create(typeNode) as CatFxnType; if (mType == null) { throw new Exception("expected function type " + typeNode.ToString()); } } CheckLabel(AstLabel.MacroStackVar); }
public AstMacroStackVar(PegAstNode node) : base(node) { if (node.GetNumChildren() < 1) throw new Exception("invalid macro stack variable"); if (node.GetNumChildren() > 2) throw new Exception("invalid macro stack variable"); msName = node.GetChild(0).ToString(); if (node.GetNumChildren() == 2) { AstFxnType typeNode = new AstFxnType(node.GetChild(1)); mType = CatFxnType.Create(typeNode) as CatFxnType; if (mType == null) throw new Exception("expected function type " + typeNode.ToString()); } CheckLabel(AstLabel.MacroStackVar); }