Package com.dci.intellij.dbn.language.common.element

Examples of com.dci.intellij.dbn.language.common.element.ElementType


     * (named elements do not have parents)
     */
    public Set<TokenType> getNextRequiredTokens() {
        if (nextRequiredTokens == null) {
            nextRequiredTokens = new THashSet<TokenType>();
            ElementType elementType = getElementType();
            ElementType parentElementType = elementType.getParent();
            while (parentElementType != null) {
                if (parentElementType instanceof SequenceElementType) {
                    SequenceElementType sequence = (SequenceElementType) parentElementType;
                    int elementsCount = sequence.getElementTypes().length;
                    int index = sequence.indexOf(elementType, 0);

                    for (int i = index + 1; i < elementsCount; i++) {
                        if (!sequence.isOptional(i)) {
                            ElementType next = sequence.getElementTypes()[i];
                            nextRequiredTokens.addAll(next.getLookupCache().getFirstPossibleTokens());
                            parentElementType = null;
                            break;
                        }
                    }
                } else if (parentElementType instanceof IterationElementType) {
View Full Code Here


    }

    public ElementType getPreviousElement(PathNode pathNode) {
        int position = 0;
        while (pathNode != null) {
            ElementType elementType = pathNode.getElementType();
            if (elementType instanceof SequenceElementType) {
                SequenceElementType sequenceElementType = (SequenceElementType) elementType;
                if (position > 0 ) {
                    return sequenceElementType.getElementTypes()[position-1];
                }
View Full Code Here

        }
        return null;
    }

    public Set<LeafElementType> getAlternativeLeafs(PathNode pathNode) {
        ElementType previousElementType = getPreviousElement(pathNode);
        // FIXME ----------- implement this
        return previousElementType.getLookupCache().getFirstPossibleLeafs();
    }
View Full Code Here

    public Set<LeafElementType> getNextPossibleLeafs(PathNode pathNode, CodeCompletionFilterSettings filterSettings) {
        Set<LeafElementType> possibleLeafs = new THashSet<LeafElementType>();
        int position = 0;
        while (pathNode != null) {
            ElementType elementType = pathNode.getElementType();

            if (elementType instanceof SequenceElementType) {
                SequenceElementType sequenceElementType = (SequenceElementType) elementType;

                int elementsCount = sequenceElementType.getElementTypes().length;

                for (int i=position+1; i<elementsCount; i++) {
                    ElementType next = sequenceElementType.getElementTypes()[i];
                    possibleLeafs.addAll(next.getLookupCache().getFirstPossibleLeafs());
                    if (!sequenceElementType.isOptional(i)) {
                        pathNode = null;
                        break;
                    }
                }
View Full Code Here

    public Set<LeafElementType> getNextRequiredLeafs(PathNode pathNode) {
        Set<LeafElementType> requiredLeafs = new THashSet<LeafElementType>();
        int index = 0;
        while (pathNode != null) {
            ElementType elementType = pathNode.getElementType();

            if (elementType instanceof SequenceElementType) {
                SequenceElementType sequenceElementType = (SequenceElementType) elementType;
                int elementsCount = sequenceElementType.getElementTypes().length;

                for (int i=index+1; i<elementsCount; i++) {
                    if (!sequenceElementType.isOptional(i)) {
                        ElementType next = sequenceElementType.getElementTypes()[i];
                        requiredLeafs.addAll(next.getLookupCache().getFirstRequiredLeafs());
                        pathNode = null;
                        break;
                    }
                }
            } else if (elementType instanceof IterationElementType) {
View Full Code Here

    public String getDebugName() {
        return "token (" + getId() + " - " + getTokenType().getId() + ")";
    }

    public Set<LeafElementType> getNextPossibleLeafs(PathNode pathNode, CodeCompletionFilterSettings filterSettings) {
        ElementType parent = getParent();
        if (isIterationSeparator()) {
            if (parent instanceof IterationElementType) {
                IterationElementType iterationElementType = (IterationElementType) parent;
                /*return codeCompletionSettings.isSmart() ?
                        iterationElementType.getIteratedElementType().getFirstPossibleLeafs() :
View Full Code Here

public class ElementTypeUtil {
    public static ElementType getEnclosingElementType(PathNode pathNode, ElementTypeAttribute elementTypeAttribute) {
        PathNode parentNode = pathNode.getParent();
        while (parentNode != null) {
            ElementType elementType = parentNode.getElementType();
            if (elementType.is(elementTypeAttribute)) return elementType;
            parentNode = parentNode.getParent();
        }
        return null;
    }
View Full Code Here

    }

    public static NamedElementType getEnclosingNamedElementType(PathNode pathNode) {
        PathNode parentNode = pathNode.getParent();
        while (parentNode != null) {
            ElementType elementType = parentNode.getElementType();
            if (elementType instanceof NamedElementType) return (NamedElementType) elementType;
            parentNode = parentNode.getParent();
        }
        return null;
    }
View Full Code Here

     * Returns true if the token is a reserved word, but can act as an identifier in this context.
     */
    protected boolean isSuppressibleReservedWord(TokenType tokenType, PathNode node) {
        if (tokenType != null) {
            if (tokenType.isSuppressibleReservedWord()) {
                ElementType elementType = node.getElementType();
                if (elementType instanceof QualifiedIdentifierElementType) {
                    if (node.getCurrentSiblingIndex() > 0) return true;
                }

                ElementType namedElementType = ElementTypeUtil.getEnclosingNamedElementType(node);
                if (namedElementType != null && namedElementType.getLookupCache().containsToken(tokenType)) {
                    return false;
                }


                return true;//!isFollowedByToken(tokenType, node);
View Full Code Here

        return stepOut(marker, depth, ParseResultType.NO_MATCH, matchedTokens, node, context);
    }

    private boolean ignoreFirstMatch() {
        ElementType firstElementType = getElementType().getElementTypes()[0];
        if (firstElementType instanceof IdentifierElementType) {
            IdentifierElementType identifierElementType = (IdentifierElementType) firstElementType;
            return !identifierElementType.isDefinition();
        }
        return false;
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.language.common.element.ElementType

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.