Examples of GroovySourceAST


Examples of org.codehaus.groovy.antlr.GroovySourceAST

        currentClassDoc.setAsInterfaceDefinition();
    }

    public void visitImport(GroovySourceAST t, int visit) {
        if (visit == OPENING_VISIT) {
            GroovySourceAST child = t.childOfType(GroovyTokenTypes.DOT);
            if (child == null) {
                child = t.childOfType(GroovyTokenTypes.IDENT);
            }
            String importTextWithSlashesInsteadOfDots = recurseDownImportBranch(child);
            importedClassesAndPackages.add(importTextWithSlashesInsteadOfDots);
View Full Code Here

Examples of org.codehaus.groovy.antlr.GroovySourceAST

        }
    }
    public String recurseDownImportBranch(GroovySourceAST t) {
        if (t != null) {
            if (t.getType() == GroovyTokenTypes.DOT) {
                GroovySourceAST firstChild = (GroovySourceAST) t.getFirstChild();
                GroovySourceAST secondChild = (GroovySourceAST) firstChild.getNextSibling();
                return (recurseDownImportBranch(firstChild) + "/" + recurseDownImportBranch(secondChild));
            }
            if (t.getType() == GroovyTokenTypes.IDENT) {
                return t.getText();
            }
View Full Code Here

Examples of org.codehaus.groovy.antlr.GroovySourceAST

        }
        return "";
    }
    public void visitExtendsClause(GroovySourceAST t,int visit) {
        if (visit == OPENING_VISIT) {
          GroovySourceAST superClassNode = t.childOfType(GroovyTokenTypes.IDENT);
          if (superClassNode != null) {
            String superClassName = superClassNode.getText();
            currentClassDoc.setSuperClassName(superClassName); // un 'packaged' class name
          }
        }
    }
View Full Code Here

Examples of org.codehaus.groovy.antlr.GroovySourceAST

            }
        }
  }

    private boolean insideAnonymousInnerClass() {
        GroovySourceAST grandParentNode = getGrandParentNode();
        if (grandParentNode != null && grandParentNode.getType() == GroovyTokenTypes.LITERAL_new) {
            return true;
        }
        return false;
    }
View Full Code Here

Examples of org.codehaus.groovy.antlr.GroovySourceAST

            return true;
        }
        return false;
    }
    private void processModifiers(GroovySourceAST t,SimpleGroovyProgramElementDoc programElementDoc) {
        GroovySourceAST modifiers = t.childOfType(GroovyTokenTypes.MODIFIERS);
        if (modifiers != null) {
            AST currentModifier = modifiers.getFirstChild();
            boolean seenNonPublicVisibilityModifier = false;
            while (currentModifier != null) {
                int type = currentModifier.getType();
                switch (type) {
                    case GroovyTokenTypes.LITERAL_protected:
View Full Code Here

Examples of org.codehaus.groovy.antlr.GroovySourceAST

  private String getTypeNodeAsText(GroovySourceAST typeNode, String defaultText) {
    String returnValue = defaultText;
    if (typeNode != null &&
        typeNode.getType() == GroovyTokenTypes.TYPE &&
        typeNode.getNumberOfChildren() > 0) {
      GroovySourceAST child = (GroovySourceAST) typeNode.getFirstChild(); // assume type has only one child // todo type of "foo.bar.Wibble"
      switch (child.getType()) {
        // literals
        case GroovyTokenTypes.LITERAL_boolean: returnValue = "boolean"; break
        case GroovyTokenTypes.LITERAL_byte: returnValue = "byte"; break
        case GroovyTokenTypes.LITERAL_char: returnValue = "char"; break
        // note: LITERAL_def never created
        case GroovyTokenTypes.LITERAL_double: returnValue = "double"; break
        case GroovyTokenTypes.LITERAL_float: returnValue = "float"; break
        case GroovyTokenTypes.LITERAL_int: returnValue = "int"; break
        case GroovyTokenTypes.LITERAL_long: returnValue = "long"; break
        case GroovyTokenTypes.LITERAL_short: returnValue = "short"; break
        case GroovyTokenTypes.LITERAL_void: returnValue = "void"; break
       
        // identifiers
        case GroovyTokenTypes.IDENT: returnValue = child.getText(); break
      }
    }
    return returnValue;
  }
View Full Code Here

Examples of org.codehaus.groovy.antlr.GroovySourceAST

  }

 
  private void addParametersTo(SimpleGroovyExecutableMemberDoc executableMemberDoc, GroovySourceAST t,int visit) {
    // parameters
    GroovySourceAST parametersNode = t.childOfType(GroovyTokenTypes.PARAMETERS);
    if (parametersNode != null && parametersNode.getNumberOfChildren() > 0) {
      GroovySourceAST currentNode = (GroovySourceAST) parametersNode.getFirstChild();
        while (currentNode != null) {
          String parameterTypeName = getTypeNodeAsText(currentNode.childOfType(GroovyTokenTypes.TYPE),"def");
            String parameterName = getText(currentNode.childOfType(GroovyTokenTypes.IDENT));
            SimpleGroovyParameter parameter = new SimpleGroovyParameter(parameterName);
            parameter.setTypeName(parameterTypeName);
           
            executableMemberDoc.add(parameter);
           
            currentNode = (GroovySourceAST)currentNode.getNextSibling();
        }
    }
  }
View Full Code Here

Examples of org.codehaus.groovy.antlr.GroovySourceAST

            name = name + " : " + t.getText();
        }
        switch (t.getType()) {
            case GroovyTokenTypes.METHOD_DEF :
            case GroovyTokenTypes.VARIABLE_DEF :
                GroovySourceAST identNode = t.childOfType(GroovyTokenTypes.IDENT);
                if (identNode != null) {
                    name = name + " : " + identNode.getText() + "";
                }
        }
        name = escape(name);
        if (sourceBuffer != null) {
            name += "
";
View Full Code Here

Examples of org.codehaus.groovy.antlr.GroovySourceAST

    protected abstract void accept(GroovySourceAST currentNode);

    protected void accept_v_FirstChildsFirstChild_v_Child2_Child3_v_Child4_v___v_LastChild(GroovySourceAST t) {
        openingVisit(t);
        GroovySourceAST expr2 = t.childAt(0);
        skip(expr2);
        accept(expr2.childAt(0));
        closingVisit(t);

        GroovySourceAST sibling = (GroovySourceAST) expr2.getNextSibling();
        boolean firstSList = true;
        while (sibling != null) {
            if (!firstSList) {
                subsequentVisit(t);
            }
            firstSList = false;
            accept(sibling);
            sibling = (GroovySourceAST) sibling.getNextSibling();
        }
    }
View Full Code Here

Examples of org.codehaus.groovy.antlr.GroovySourceAST

        }
    }

    protected void accept_v_FirstChildsFirstChild_v_RestOfTheChildren(GroovySourceAST t) {
        openingVisit(t);
        GroovySourceAST expr = t.childAt(0);
        skip(expr);
        accept(expr.childAt(0));
        closingVisit(t);
        acceptSiblings(expr);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.