public CatAstNode(PegAstNode node) { if (node.GetLabel() != null) { mLabel = (AstLabel)node.GetLabel(); } else { mLabel = AstLabel.AstRoot; } msText = node.ToString(); }
public RubyAstNode(PegAstNode node) { if (node.GetLabel() != null) { mLabel = (ASTNodeType)node.GetLabel(); } else { mLabel = ASTNodeType.SELF; } mText = node.ToString(); }
public static RubyAstNode Create(PegAstNode node) { ASTNodeType label = (ASTNodeType)node.GetLabel(); if (node.GetLabel() != null) { return(new RubyTestAstNode(label, node.ToString())); } switch (label) { //case ASTNodeType.AstRoot: // return new AstRoot ( node ); //case ASTNodeType.Def: // return new AstDef ( node ); //case ASTNodeType.Name: // return new AstName ( node ); //case ASTNodeType.Param: // return new AstParam ( node ); //case ASTNodeType.Lambda: // return new AstLambda ( node ); //case ASTNodeType.Quote: // return new AstQuote ( node ); //case ASTNodeType.Char: // return new AstChar ( node ); //case ASTNodeType.String: // return new AstString ( node ); //case ASTNodeType.Float: // return new AstFloat ( node ); //case ASTNodeType.Int: // return new AstInt ( node ); //case ASTNodeType.Bin: // return new AstBin ( node ); //case ASTNodeType.Hex: // return new AstHex ( node ); //case ASTNodeType.Stack: // return new AstStack ( node ); //case ASTNodeType.FxnType: // return new AstFxnType ( node ); //case ASTNodeType.TypeVar: // return new AstTypeVar ( node ); //case ASTNodeType.TypeName: // return new AstSimpleType ( node ); //case ASTNodeType.StackVar: // return new AstStackVar ( node ); //case ASTNodeType.MacroRule: // return new AstMacro ( node ); //case ASTNodeType.MacroProp: // return new AstMacro ( node ); //case ASTNodeType.MacroPattern: // return new AstMacroPattern ( node ); //case ASTNodeType.MacroQuote: // return new AstMacroQuote ( node ); //case ASTNodeType.MacroTypeVar: // return new AstMacroTypeVar ( node ); //case ASTNodeType.MacroStackVar: // return new AstMacroStackVar ( node ); //case ASTNodeType.MacroName: // return new AstMacroName ( node ); //case ASTNodeType.MetaDataContent: // return new AstMetaDataContent ( node ); //case ASTNodeType.MetaDataLabel: // return new AstMetaDataLabel ( node ); //case ASTNodeType.MetaDataBlock: // return new AstMetaDataBlock ( node ); default: throw new Exception("unrecognized node type in AST tree: " + label); } }