Пример #1
0
 public override void ExitType_declaration(CSharpParser.Type_declarationContext context)
 {
     _typeNameCurrent      = null;
     _typeStartCurrent     = null;
     _typeBodyStartCurrent = null;
     _typeEndCurrent       = null;
 }
Пример #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 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();
            }
        }
Пример #4
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);
        }