예제 #1
0
        private Interface NextInterface(List <Annotation> annotations, List <Qualifier> qualifiers)
        {
            currentIndex++;
            TypeReference name         = NextTypeReference();
            Interface     interfaceObj = new Interface(annotations, qualifiers)
            {
                Name = name
            };

            // Extends
            if (tokens[currentIndex].Value == "extends")
            {
                currentIndex++;
                interfaceObj.Extends = NextTypeReference();
            }

            currentIndex++; // Skipping {

            Qualified member = null;

            while ((member = NextMember()) != null)
            {
                if (member is Method method)
                {
                    interfaceObj.Methods.Add(method);
                }
            }

            currentIndex++; // Skipping }

            return(interfaceObj);
        }
예제 #2
0
        private Class NextClass(List <Annotation> annotations, List <Qualifier> qualifiers)
        {
            currentIndex++;
            TypeReference className = NextTypeReference();
            Class         classObj  = new Class(annotations, qualifiers)
            {
                Name = className
            };

            // Extends
            if (tokens[currentIndex].Value == "extends")
            {
                currentIndex++;
                classObj.Extends = NextTypeReference();
            }

            // Implements
            if (tokens[currentIndex].Value == "implements")
            {
                currentIndex++;
                classObj.Implements.Add(NextTypeReference());
                while (tokens[currentIndex].Value == ",")
                {
                    currentIndex++;
                    classObj.Implements.Add(NextTypeReference());
                }
            }

            currentIndex++; // Skipping {

            Qualified member = null;

            while ((member = NextMember()) != null)
            {
                if (member is Method method)
                {
                    classObj.Methods.Add(method);
                }
                else if (member is Field field)
                {
                    classObj.Fields.Add(field);
                }
                else if (member is Classifier classifier)
                {
                    classObj.InternalClassifiers.Add(classifier);
                }
            }

            currentIndex++; // Skipping }

            return(classObj);
        }