示例#1
0
        public void Parse(string fileName)
        {
            CSharpParser.Compilation_unitContext compilationUnit = ParseFile(fileName);

            if (compilationUnit.extern_alias_directives() != null)
            {
                throw new NotSupportedException("Extern alias not supported");
            }

            if (compilationUnit.global_attribute_section().Length > 0)
            {
                throw new NotImplementedException("Global attributes are not implemented yet");
            }

            IUsingStatement[] @using = compilationUnit.using_directives() != null
                ? compilationUnit.using_directives().Parse()
                : new IUsingStatement[0];

            Console.WriteLine("Using: " + string.Join <IUsingStatement>(", ", @using));

            NamespaceContext @namespace = new NamespaceContext(null, @using);

            if (compilationUnit.namespace_member_declarations() != null)
            {
                compilationUnit.namespace_member_declarations().Parse(@namespace);
            }

            Console.WriteLine("Done");
        }