private void ParseNode(IParseTree node) { if (node is DeclarationseqContext) { DeclarationseqContext declarationseqContext = node as DeclarationseqContext; this.ParseDeclarationseq(declarationseqContext); } }
private void ParseDeclarationseq(DeclarationseqContext node) { DeclarationseqContext declareSq = node.declarationseq(); DeclarationContext declare = node.declaration(); if (declareSq != null) { this.ParseDeclarationseq(declareSq); } if (declare != null) { AttributedeclarationContext attribute = declare.attributedeclaration(); FunctiondefinitionContext function = declare.functiondefinition(); BlockdeclarationContext block = declare.blockdeclaration(); if (block != null) { UsingdirectiveContext usingDirective = block.usingdirective(); SimpledeclarationContext simpleDeclaration = block.simpledeclaration(); if (usingDirective != null) { string name = usingDirective.namespacename().GetText(); this.WriteKeyValue("Using", name); } else if (simpleDeclaration != null) { DeclspecifierseqContext[] decls = simpleDeclaration.GetRuleContexts <DeclspecifierseqContext>(); foreach (DeclspecifierseqContext decl in decls) { DeclspecifierContext declSpec = decl.declspecifier(); TypespecifierContext typeSpec = declSpec.typespecifier(); if (typeSpec != null) { ClassspecifierContext classSpec = typeSpec.classspecifier(); EnumspecifierContext enumSpec = typeSpec.enumspecifier(); if (classSpec != null) { string className = classSpec.classhead().classheadname().GetText(); this.WriteLine(); this.WriteKeyValue("Class", className); this.WriteBeginBrace(); MemberspecificationContext[] members = classSpec.GetRuleContexts <MemberspecificationContext>(); foreach (MemberspecificationContext member in members) { MemberspecificationContext[] memberSpecs = member.GetRuleContexts <MemberspecificationContext>(); foreach (MemberspecificationContext memberSpec in memberSpecs) { MemberdeclarationContext memberDeclaration = memberSpec.memberdeclaration(); MemberspecificationContext memberSpecDeclaration = memberSpec.memberspecification(); this.ParseMemberDeclaration(memberDeclaration); this.ParseMemberSpecification(memberSpecDeclaration); } } this.WriteEndBrace(); } } } } } else if (function != null) { this.ParseFunction(function); } } }