예제 #1
0
 public static IEnumerable <Template> GetTemplates(this DeclarationContext declarationContext)
 {
     for (var x = 0; x < declarationContext.TemplatesCount; x++)
     {
         var template = declarationContext.getTemplates((uint)x);
         yield return(template);
     }
 }
예제 #2
0
        void VisitDeclContext(DeclarationContext ctx, AST.DeclarationContext _ctx)
        {
            for (uint i = 0; i < ctx.NamespacesCount; ++i)
            {
                var decl  = ctx.getNamespaces(i);
                var _decl = Visit(decl) as AST.Namespace;
                _ctx.Namespaces.Add(_decl);
            }

            for (uint i = 0; i < ctx.EnumsCount; ++i)
            {
                var decl  = ctx.getEnums(i);
                var _decl = Visit(decl) as AST.Enumeration;
                _ctx.Enums.Add(_decl);
            }

            for (uint i = 0; i < ctx.FunctionsCount; ++i)
            {
                var decl  = ctx.getFunctions(i);
                var _decl = Visit(decl) as AST.Function;
                _ctx.Functions.Add(_decl);
            }

            for (uint i = 0; i < ctx.ClassesCount; ++i)
            {
                var decl  = ctx.getClasses(i);
                var _decl = Visit(decl) as AST.Class;
                _ctx.Classes.Add(_decl);
            }

            for (uint i = 0; i < ctx.TemplatesCount; ++i)
            {
                var decl  = ctx.getTemplates(i);
                var _decl = Visit(decl) as AST.Template;
                _ctx.Templates.Add(_decl);
            }

            for (uint i = 0; i < ctx.TypedefsCount; ++i)
            {
                var decl  = ctx.getTypedefs(i);
                var _decl = Visit(decl) as AST.TypedefDecl;
                _ctx.Typedefs.Add(_decl);
            }

            for (uint i = 0; i < ctx.VariablesCount; ++i)
            {
                var decl  = ctx.getVariables(i);
                var _decl = Visit(decl) as AST.Variable;
                _ctx.Variables.Add(_decl);
            }

            // Anonymous types
        }