Package com.intellij.lang

Examples of com.intellij.lang.ASTNode


    public ASTNode findNameElement() {
        return getNode().findChildByType(JFlexElementTypes.MACROS);
    }

    public PsiElement getNameElement() {
        ASTNode node = findNameElement();
        return node != null ? node.getPsi() : null;
    }
View Full Code Here


        ASTNode node = findNameElement();
        return node != null ? node.getPsi() : null;
    }

    public String getName() {
        ASTNode node = findNameElement();
        return node != null ? node.getText() : null;
    }
View Full Code Here

    }

    @Nullable
    public String generateDoc(PsiElement element, PsiElement originalElement) {
        if (element instanceof JFlexMacroDefinition) {
            ASTNode astNode = element.getNode();
            ASTNode regexp = astNode != null ? astNode.findChildByType(JFlexElementTypes.REGEXP) : null;
            return regexp != null ? regexp.getText() : "No regexp found.";
        }
        return null;
    }
View Full Code Here

            this.testSource = testSource;
            String generationName = null;
            PsiFile psiFile = PsiManager.getInstance(module.getProject()).findFile(file);
            if (psiFile instanceof JFlexPsiFile) {
                JFlexPsiFile flexPsiFile = (JFlexPsiFile) psiFile;
                ASTNode node = flexPsiFile.getNode();
                if (node != null) {
                    /* lazy-lazy parser won't actually parse a file it has not been opened in editor before.
                     * let's persuade it pretending that we really need all the stuff in a file.*/
                    node.getPsi().getChildren();
                    JFlexElement generateName = flexPsiFile.getClassname();
                    if (generateName != null) {
                        generationName = generateName.getText();
                    }
                }
View Full Code Here

    }

    @Nullable
    public JFlexElement getClassname() {
        JFlexExpression classexp = null;
        ASTNode classnode = getNode().findChildByType(JFlexElementTypes.CLASS_STATEMENT);
        if (classnode != null) {
            classexp = ((JFlexClassStatement) classnode.getPsi()).getValue();
        }
        return classexp;
    }
View Full Code Here

    }

    @Nullable
    public JFlexElement getReturnType() {
        JFlexExpression classexp = null;
        ASTNode returnnode = getNode().findChildByType(JFlexElementTypes.TYPE_STATEMENT);
        if (returnnode != null) {
            classexp = ((JFlexTypeStatement) returnnode.getPsi()).getValue();
        }
        return classexp;
    }
View Full Code Here

        return classexp;
    }

    public JFlexExpression[] getImplementedInterfaces() {
        JFlexExpression[] result = new JFlexExpression[0];
        ASTNode implmentsnode = getNode().findChildByType(JFlexElementTypes.IMPLEMENTS_STATEMENT);
        if (implmentsnode != null) {
            result = ((JFlexImplementsStatement) implmentsnode.getPsi()).getInterfaces();
        }
        return result;
    }
View Full Code Here

    public boolean isValidHost() {
        return true;
    }

    public boolean isMatchAction() {
        ASTNode prev = getNode().getTreePrev();
        return prev != null && prev.getElementType() == JFlexElementTypes.LEFT_BRACE;
    }
View Full Code Here

    this.settings = settings;
  }

  public Indent getChildIndent(ASTNode node) {
    final IElementType elementType = node.getElementType();
    final ASTNode prevSibling = UsefulPsiTreeUtil.getPrevSiblingSkipWhiteSpacesAndComments(node);
    final IElementType prevSiblingType = prevSibling == null ? null : prevSibling.getElementType();
    final ASTNode parent = node.getTreeParent();
    final IElementType parentType = parent != null ? parent.getElementType() : null;
    final ASTNode superParent = parent == null ? null : parent.getTreeParent();
    final IElementType superParentType = superParent == null ? null : superParent.getElementType();

    final int braceStyle = FUNCTION_DEFINITION.contains(superParentType) ? settings.METHOD_BRACE_STYLE : settings.BRACE_STYLE;

    if (parent == null || parent.getTreeParent() == null) {
      return Indent.getNoneIndent();
View Full Code Here

  }

  @Nullable
  public Alignment createChildAlignment() {
    IElementType elementType = myNode.getElementType();
    ASTNode parent = myNode.getTreeParent();
    IElementType parentType = parent == null ? null : parent.getElementType();

    if (BINARY_EXPRESSIONS.contains(elementType) && mySettings.ALIGN_MULTILINE_BINARY_OPERATION) {
      return myBaseAlignment;
    }
View Full Code Here

TOP

Related Classes of com.intellij.lang.ASTNode

Copyright © 2018 www.massapicom. 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.