示例#1
0
        public override void EnterRule(ParseArgs e)
        {
            switch (e.Context.RuleIndex)
            {
            case CppClassesParser.RULE_returnType:
                Method.ResulTypeName = e.Context.GetText();
                break;

            case CppClassesParser.RULE_typeParameterConst:
                Method.ReturnConst = true;
                break;

            case CppClassesParser.RULE_typeParameterLink:
                Method.ReturnLink = true;
                break;

            case CppClassesParser.RULE_methodPure:
                Method.IsPure = true;
                break;

            case CppClassesParser.RULE_methodName:
                Method.Name = e.Context.GetText();
                break;

            case CppClassesParser.RULE_methodParameter:
                var parameter = new MethodParameter();
                Method.Parameters.Add(parameter);
                e.Listener.StateMethodParameter.Parameter = parameter;
                e.Listener.PushState(e.Listener.StateMethodParameter, CppClassesParser.RULE_methodParameter);
                break;
            }
        }
示例#2
0
 public override void EnterRule(ParseArgs e)
 {
     switch (e.Context.RuleIndex)
     {
     case CppClassesParser.RULE_namespaceDeclaration:
         e.Listener.StateNamespace.Namespace = new Namespace();
         File.Namespaces.Add(e.Listener.StateNamespace.Namespace);
         e.Listener.PushState(e.Listener.StateNamespace, CppClassesParser.RULE_namespaceDeclaration);
         break;
     }
 }
示例#3
0
        public override void EnterRule(ParseArgs e)
        {
            switch (e.Context.RuleIndex)
            {
            case CppClassesParser.RULE_fieldType:
                Field.TypeName = e.Context.GetText();
                break;

            case CppClassesParser.RULE_fieldName:
                Field.Name = e.Context.GetText();
                break;
            }
        }
示例#4
0
        public override void EnterRule(ParseArgs e)
        {
            switch (e.Context.RuleIndex)
            {
            case CppClassesParser.RULE_structDeclarationName:
                Struct.Name = e.Context.GetText();
                break;

            case CppClassesParser.RULE_fieldDeclaration:
                var field = new Field();
                Struct.Fields.Add(field);
                e.Listener.StateField.Field = field;
                e.Listener.PushState(e.Listener.StateField, CppClassesParser.RULE_fieldDeclaration);
                break;
            }
        }
示例#5
0
        public override void EnterRule(ParseArgs e)
        {
            switch (e.Context.RuleIndex)
            {
            case CppClassesParser.RULE_classDeclarationName:
                Class.Name = e.Context.GetText();
                break;

            case CppClassesParser.RULE_className:
                Class.Extends.Add(e.Context.GetText());
                break;

            case CppClassesParser.RULE_methodDeclaration:
                var method = new Method();
                Class.Methods.Add(method);
                e.Listener.StateMethod.Method = method;
                e.Listener.PushState(e.Listener.StateMethod, CppClassesParser.RULE_methodDeclaration);
                break;
            }
        }
示例#6
0
        public override void EnterRule(ParseArgs e)
        {
            switch (e.Context.RuleIndex)
            {
            case CppClassesParser.RULE_typeParameterConst:
                Parameter.IsConst = true;
                break;

            case CppClassesParser.RULE_typeParameterLink:
                Parameter.IsLink = true;
                break;

            case CppClassesParser.RULE_parameterType:
                Parameter.TypeName = e.Context.GetText();
                break;

            case CppClassesParser.RULE_parameterName:
                Parameter.Name = e.Context.GetText();
                break;
            }
        }
示例#7
0
        public override void EnterRule(ParseArgs e)
        {
            switch (e.Context.RuleIndex)
            {
            case CppClassesParser.RULE_namespaceName:
                Namespace.Name = e.Context.GetText();
                break;

            case CppClassesParser.RULE_methodDeclaration:
                var method = new Method();
                Namespace.RootMethods.Add(method);
                e.Listener.StateMethod.Method = method;
                e.Listener.PushState(e.Listener.StateMethod, CppClassesParser.RULE_methodDeclaration);
                break;

            case CppClassesParser.RULE_structDeclaration:
                var structItem = new Struct();
                Namespace.Structs.Add(structItem);
                e.Listener.StateStruct.Struct = structItem;
                e.Listener.PushState(e.Listener.StateStruct, CppClassesParser.RULE_structDeclaration);
                break;

            case CppClassesParser.RULE_classDeclaration:
                var classItem = new Class();
                Namespace.Classes.Add(classItem);
                e.Listener.StateClass.Class = classItem;
                e.Listener.PushState(e.Listener.StateClass, CppClassesParser.RULE_classDeclaration);
                break;

            case CppClassesParser.RULE_enumDeclaration:
                var enumItem = new Enum();
                Namespace.Enums.Add(enumItem);
                e.Listener.StateEnum.Enum = enumItem;
                e.Listener.PushState(e.Listener.StateEnum, CppClassesParser.RULE_enumDeclaration);
                break;
            }
        }
示例#8
0
        public override void EnterRule(ParseArgs e)
        {
            switch (e.Context.RuleIndex)
            {
            case CppClassesParser.RULE_enumDeclarationName:
                Enum.Name = e.Context.GetText();
                break;

            case CppClassesParser.RULE_enumItemDeclaration:
                Enum.Items.Add(new EnumItem
                {
                    Name = e.Context.GetText()
                });
                break;

            case CppClassesParser.RULE_enumItemName:
                Enum.Items.Last().Name = e.Context.GetText();
                break;

            case CppClassesParser.RULE_enumItemValue:
                Enum.Items.Last().Value = e.Context.GetText();
                break;
            }
        }
示例#9
0
 public abstract void EnterRule(ParseArgs e);