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

Examples of com.dci.intellij.dbn.language.common.SharedTokenTypeBundle


public abstract class PSQLSyntaxHighlighter extends DBLanguageSyntaxHighlighter {
    public PSQLSyntaxHighlighter(PSQLLanguageDialect languageDialect, String tokenTypesFile) {
        super(languageDialect, tokenTypesFile);
        TokenTypeBundle tt = getTokenTypes();
        SharedTokenTypeBundle stt = tt.getSharedTokenTypes();
        colors.put(stt.getIdentifier(),                  PSQLTextAttributesKeys.IDENTIFIER);
        colors.put(stt.getQuotedIdentifier(),            PSQLTextAttributesKeys.QUOTED_IDENTIFIER);
        colors.put(tt.getTokenType("LINE_COMMENT"),      PSQLTextAttributesKeys.LINE_COMMENT);
        colors.put(tt.getTokenType("BLOCK_COMMENT"),     PSQLTextAttributesKeys.BLOCK_COMMENT);
        colors.put(tt.getTokenType("STRING"),            PSQLTextAttributesKeys.STRING);
        colors.put(tt.getTokenSet("NUMBERS"),            PSQLTextAttributesKeys.NUMBER);
        colors.put(tt.getTokenSet("KEYWORDS"),           PSQLTextAttributesKeys.KEYWORD);
View Full Code Here


public abstract class SQLSyntaxHighlighter extends DBLanguageSyntaxHighlighter {
    public SQLSyntaxHighlighter(SQLLanguageDialect languageDialect, String tokenTypesFile) {
        super(languageDialect, tokenTypesFile);
        TokenTypeBundle tt = getTokenTypes();
        SharedTokenTypeBundle stt = tt.getSharedTokenTypes();
        colors.put(stt.getIdentifier(),                  SQLTextAttributesKeys.IDENTIFIER);
        colors.put(stt.getQuotedIdentifier(),            SQLTextAttributesKeys.QUOTED_IDENTIFIER);
        colors.put(tt.getTokenType("LINE_COMMENT"),      SQLTextAttributesKeys.LINE_COMMENT);
        colors.put(tt.getTokenType("BLOCK_COMMENT"),     SQLTextAttributesKeys.BLOCK_COMMENT);
        colors.put(tt.getTokenType("STRING"),            SQLTextAttributesKeys.STRING);
        colors.put(tt.getTokenSet("NUMBERS"),            SQLTextAttributesKeys.NUMBER);
        colors.put(tt.getTokenSet("KEYWORDS"),           SQLTextAttributesKeys.KEYWORD);
View Full Code Here

            return SPACING_ONE_LINE;
        } else {
            PsiElement previousPsiElement = psiElement.getPrevSibling();
            if (previousPsiElement instanceof TokenPsiElement) {
                TokenPsiElement previousToken = (TokenPsiElement) previousPsiElement;
                SharedTokenTypeBundle sharedTokenTypes = psiElement.getLanguage().getSharedTokenTypes();
                TokenType tokenType = previousToken.getElementType().getTokenType();
                return tokenType ==  sharedTokenTypes.getLeftParenthesis() ?
                        SPACING_NO_SPACE :
                        SPACING_ONE_SPACE;

            }
            return SPACING_ONE_SPACE;
View Full Code Here

            if (psiElement instanceof BasePsiElement) {
                BasePsiElement basePsiElement = (BasePsiElement) psiElement;
                BasePsiElement parentPsiElement = getParentPsiElement(basePsiElement);
                if (parentPsiElement != null && parentPsiElement.getElementType() instanceof WrapperElementType) {
                    WrapperElementType wrapperElementType = (WrapperElementType) parentPsiElement.getElementType();
                    SharedTokenTypeBundle sharedTokenTypes = parentPsiElement.getLanguage().getSharedTokenTypes();
                    if (wrapperElementType.getBeginTokenElement().getTokenType() == sharedTokenTypes.getLeftParenthesis()) {
                        //FormattingBlock parentStatementBlock = getParentBlock(this, ElementTypeAttribute.STATEMENT);
                        //Indent parentStatementIndent = parentStatementBlock.getIndent();
                        //return Indent.getIndent(Indent.Type.SPACES, -1, false, false);
                        return Indent.getNoneIndent();
                    }
View Full Code Here

    public IdentifierElementTypeLookupCache(IdentifierElementType elementType) {
        super(elementType);
    }

    public void init() {
        SharedTokenTypeBundle sharedTokenTypes = getElementType().getLanguage().getSharedTokenTypes();
        TokenType identifier = sharedTokenTypes.getIdentifier();
        TokenType quotedIdentifier = sharedTokenTypes.getQuotedIdentifier();
        allPossibleTokens.add(identifier);
        allPossibleTokens.add(quotedIdentifier);
        firstPossibleTokens.add(identifier);
        firstPossibleTokens.add(quotedIdentifier);
        firstRequiredTokens.add(identifier);
View Full Code Here

        firstRequiredTokens.add(quotedIdentifier);
    }

    @Override
    public boolean containsToken(TokenType tokenType) {
        SharedTokenTypeBundle sharedTokenTypes = getElementType().getLanguage().getSharedTokenTypes();
        return sharedTokenTypes.getIdentifier() == tokenType || sharedTokenTypes.getQuotedIdentifier() == tokenType;
    }
View Full Code Here

            // register all possible leafs
            allPossibleLeafs.add(leaf);

            // register all possible tokens
            if (leaf instanceof IdentifierElementType) {
                SharedTokenTypeBundle sharedTokenTypes = getElementType().getLanguage().getSharedTokenTypes();
                allPossibleTokens.add(sharedTokenTypes.getIdentifier());
                allPossibleTokens.add(sharedTokenTypes.getQuotedIdentifier());
            } else {
                allPossibleTokens.add(leaf.getTokenType());
            }

            // register identifiers
View Full Code Here

    public Spacing getSpacing(BasePsiElement psiElement, CodeStyleSettings settings) {
        PsiElement previousPsiElement = psiElement.getPrevSibling();
        if (previousPsiElement instanceof TokenPsiElement) {
            TokenPsiElement previousToken = (TokenPsiElement) previousPsiElement;
            SharedTokenTypeBundle sharedTokenTypes = psiElement.getLanguage().getSharedTokenTypes();
            TokenType tokenType = previousToken.getElementType().getTokenType();
            return tokenType ==  sharedTokenTypes.getLeftParenthesis() ?
                    SPACING_NO_SPACE :
                    SPACING_ONE_SPACE;

        }
        return SPACING_ONE_SPACE;
View Full Code Here

            return SPACING_LINE_BREAK;
        } else {
            PsiElement previousPsiElement = psiElement.getPrevSibling();
            if (previousPsiElement instanceof TokenPsiElement) {
                TokenPsiElement previousToken = (TokenPsiElement) previousPsiElement;
                SharedTokenTypeBundle sharedTokenTypes = psiElement.getLanguage().getSharedTokenTypes();
                TokenType tokenType = previousToken.getElementType().getTokenType();
                return tokenType ==  sharedTokenTypes.getLeftParenthesis() ?
                        SPACING_NO_SPACE :
                        SPACING_ONE_SPACE;

            }
            return SPACING_ONE_SPACE;
View Full Code Here

    public ExecVariableElementTypeLookupCache(ExecVariableElementType elementType) {
        super(elementType);
    }

    public void init() {
        SharedTokenTypeBundle sharedTokenTypes = getElementType().getLanguage().getSharedTokenTypes();
        TokenType variable = sharedTokenTypes.getVariable();
        allPossibleTokens.add(variable);
        firstPossibleTokens.add(variable);
        firstRequiredTokens.add(variable);
    }
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.language.common.SharedTokenTypeBundle

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.