private void ParseMemberDeclaration(MemberdeclarationContext node) { if (node != null) { MemberspecificationContext[] memberSpecs = node.GetRuleContexts <MemberspecificationContext>(); MemberdeclaratorlistContext[] fields = node.GetRuleContexts <MemberdeclaratorlistContext>(); FunctiondefinitionContext[] funcs = node.GetRuleContexts <FunctiondefinitionContext>(); if (fields != null) { foreach (MemberdeclaratorlistContext field in fields) { foreach (string name in field.GetText().Split(',')) { this.WriteKeyValue("Field", name); } } } if (funcs != null) { foreach (FunctiondefinitionContext func in funcs) { this.ParseFunction(func); } } } }
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); } } }