예제 #1
0
        public override void EnterType_declaration(CSharpParser.Type_declarationContext context)
        {
            if (context.class_definition() != null)
            {
                var classDefinitionListener = new ClassDefinitionListener(_parentFileName);
                context.class_definition().EnterRule(classDefinitionListener);
                OuterClassInfo = classDefinitionListener.ClassInfo;
            }

            if (context.interface_definition() != null)
            {
                throw new NotImplementedException();
            }

            if (context.enum_definition() != null)
            {
                throw new NotImplementedException();
            }

            if (context.struct_definition() != null)
            {
                throw new NotImplementedException();
            }

            if (context.delegate_definition() != null)
            {
                throw new NotImplementedException();
            }
        }
예제 #2
0
        public override void EnterType_declaration(CSharpParser.Type_declarationContext context)
        {
            string nm = null;

            foreach (var td in new ParserRuleContext[]
            {
                context.class_definition(), context.interface_definition(), context.delegate_definition(),
                context.enum_definition(), context.struct_definition()
            })
            {
                if (td == null)
                {
                    continue;
                }
                nm = GetContextName(td);
                if (!string.IsNullOrWhiteSpace(nm))
                {
                    break;
                }
            }
            Results.TypeNames.Add(nm);
            _typeNameCurrent = nm;

            var typeNameStart = GetBodyStart(context);

            _typeBodyStartCurrent = typeNameStart;
            _typeStartCurrent     = new Tuple <int, int>(context.Start.Line, context.Start.Column);
            _typeEndCurrent       = new Tuple <int, int>(context.Stop.Line, context.Stop.Column);
        }
예제 #3
0
        public static void Parse(this CSharpParser.Type_declarationContext context)
        {
            if (context.attributes() != null)
            {
                throw new NotImplementedException("Attributes are not implemented yet");
            }
            Modifiers modifiers = context.all_member_modifiers().Parse();

            if (context.class_definition() != null)
            {
                context.class_definition().Parse();
            }
            else
            {
                throw new NotImplementedException("Non class types not implemented yet");
            }


            Console.WriteLine("Modifiers " + modifiers);
        }