Esempio n. 1
0
        public override void EnterQualifiedNameList(JavaParser.QualifiedNameListContext context)
        {
            QualifiedNameListener qualifiedNameListener = new QualifiedNameListener();

            foreach (JavaParser.QualifiedNameContext qualifiedNameContext in context.qualifiedName())
            {
                qualifiedNameContext.EnterRule(qualifiedNameListener);
                QualifiedNames.Add(qualifiedNameListener.QualifiedName);
            }
        }
Esempio n. 2
0
        protected void ParseMethodFromContext(
            JavaParser.FormalParametersContext formalParametersContext,
            JavaParser.TypeTypeOrVoidContext typeTypeOrVoidContext,
            JavaParser.QualifiedNameListContext qualifiedNameListContext,
            string methodNameText,
            string methodBody)
        {
            FormalParametersListener formalParametersListener =
                new FormalParametersListener();

            formalParametersContext.EnterRule(formalParametersListener);

            TypeName returnType = TypeName.For("void");

            if (typeTypeOrVoidContext != null)
            {
                TypeTypeOrVoidListener typeOrVoidListener = new TypeTypeOrVoidListener();
                typeTypeOrVoidContext.EnterRule(typeOrVoidListener);
                returnType = typeOrVoidListener.TypeName;
            }

            QualifiedNameListListener qualifiedNameListListener = new QualifiedNameListListener();

            if (qualifiedNameListContext != null)
            {
                // Exceptions
                qualifiedNameListContext.EnterRule(qualifiedNameListListener);
                List <string> qualifiedNames = qualifiedNameListListener.QualifiedNames;
            }

            MethodName methodName = new MethodName(
                parentClass.className,
                methodNameText,
                returnType.Signature,
                formalParametersListener
                .Arguments
                .Select(arg => new Argument(
                            arg.Type.Signature,
                            TypeName.For(arg.Type.Signature))).ToList());
            MethodInfo newMethodInfo = new MethodInfo(
                methodName,
                AccessFlags.AccPublic, // TODO
                parentClass.className,
                formalParametersListener.Arguments,
                returnType,
                new SourceCodeSnippet(methodBody, SourceCodeLanguage.Java));

            parentClass.Children.Add(newMethodInfo);
        }
Esempio n. 3
0
 public Ust VisitQualifiedNameList(JavaParser.QualifiedNameListContext context)
 {
     return(VisitChildren(context));
 }