Java 类com.intellij.psi.jsp.JspTokenType 实例源码

项目:intellij-ce-playground    文件:ShiftIndentInsideHelper.java   
public static boolean mayShiftIndentInside(final ASTNode leaf) {
  return (isComment(leaf) && !checkJspTexts(leaf))
         || leaf.getElementType() == TokenType.WHITE_SPACE
         || leaf.getElementType() == XmlTokenType.XML_DATA_CHARACTERS
         || leaf.getElementType() == JspTokenType.JAVA_CODE
         || leaf.getElementType() == JspElementType.JSP_SCRIPTLET
         || leaf.getElementType() == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN;
}
项目:IntelliJ_Jahia_plugin    文件:CndJspAnnotator.java   
@Override
    public void annotate(@NotNull final PsiElement element, @NotNull AnnotationHolder holder) {
        if (JspTokenType.XML_ATTRIBUTE_VALUE_TOKEN.equals(element.getNode().getElementType())) {
            String value = element.getText();

//            if (value != null && value.contains(":")) {
//                Matcher matcher = nodeTypeRegex.matcher(value);
//                if (matcher.matches()) {
//                    String[] splitValue = value.split(":");
//                    String namespace = splitValue[0];
//                    String nodeTypeName = splitValue[1];
//                    Project project = element.getProject();
//                    int offset = element.getTextRange().getStartOffset();
//                    TextRange namespaceRange = new TextRange(offset, offset + namespace.length());
//                    TextRange colonRange = new TextRange(offset + namespace.length(), offset + namespace.length() + 1);
//                    TextRange nodeTypeNameRange = new TextRange(offset + namespace.length() + 1, element.getTextRange().getEndOffset());
//
//                    //Color ":"
//                    Annotation colonAnnotation = holder.createInfoAnnotation(colonRange, null);
//                    colonAnnotation.setTextAttributes(DefaultLanguageHighlighterColors.LINE_COMMENT);
//
//                    if (CndUtil.findNamespace(project, namespace) != null) {
//                        Annotation namespaceAnnotation = holder.createInfoAnnotation(namespaceRange, null);
//                        namespaceAnnotation.setTextAttributes(CndSyntaxHighlighter.NAMESPACE);
//
//                        if (CndUtil.findNodeType(project, namespace, nodeTypeName) != null) {
//                            Annotation nodeTypeNameAnnotation = holder.createInfoAnnotation(nodeTypeNameRange, null);
//                            nodeTypeNameAnnotation.setTextAttributes(CndSyntaxHighlighter.NODE_TYPE);
//                        } else {
//                            holder.createErrorAnnotation(nodeTypeNameRange, "Unresolved CND node type").registerFix(new CreateNodeTypeQuickFix(namespace, nodeTypeName));
//                        }
//                    } else {
//                        holder.createErrorAnnotation(namespaceRange, "Unresolved CND namespace");
//                    }
//                }
//            }
        }
    }
项目:tools-idea    文件:ShiftIndentInsideHelper.java   
public static boolean mayShiftIndentInside(final ASTNode leaf) {
  return (isComment(leaf) && !checkJspTexts(leaf))
         || leaf.getElementType() == TokenType.WHITE_SPACE
         || leaf.getElementType() == XmlTokenType.XML_DATA_CHARACTERS
         || leaf.getElementType() == JspTokenType.JAVA_CODE
         || leaf.getElementType() == JspElementType.JSP_SCRIPTLET
         || leaf.getElementType() == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN;
}
项目:consulo-javaee    文件:JspParser.java   
@NotNull
@Override
public ASTNode parse(@NotNull IElementType elementType, @NotNull PsiBuilder builder, @NotNull LanguageVersion languageVersion)
{
    PsiBuilder.Marker marker = builder.mark();
    PsiBuilder.Marker documentMarker = builder.mark();
    PsiBuilder.Marker rootMarker = builder.mark();
    while(!builder.eof())
    {
        if(builder.getTokenType() == XmlTokenType.XML_START_TAG_START)
        {
            parseDirective(builder);
        }
        else if(builder.getTokenType() == JspTokenType.JSP_DECLARATION_START)
        {
            parseSimpleTag(builder, JspTokenType.JSP_DECLARATION_END, JspElements.DECLARATION);
        }
        else if(builder.getTokenType() == JspTokenType.JSP_EXPRESSION_START)
        {
            parseSimpleTag(builder, JspTokenType.JSP_EXPRESSION_END, JspElements.EXPRESSION);
        }
        else if(builder.getTokenType() == JspTokenType.JSP_SCRIPTLET_START)
        {
            parseSimpleTag(builder, JspTokenType.JSP_SCRIPTLET_END, JspElements.SCRIPTLET);
        }
        else
        {
            builder.advanceLexer();
        }
    }
    rootMarker.done(JspElements.JSP_ROOT_TAG);
    documentMarker.done(JspElements.JSP_DOCUMENT);
    marker.done(elementType);
    return builder.getTreeBuilt();
}
项目:consulo-javaee    文件:JavaInJspParser.java   
private void parseStatements(final PsiBuilder builder, StatementParser parser)
{
    while(builder.getTokenType() != JspTokenType.JSP_SCRIPTLET_END && !builder.eof())
    {
        final PsiBuilder.Marker statement = parser.parseStatement(builder);
        if(statement != null)
        {
            continue;
        }

        final IElementType tokenType = builder.getTokenType();

        final PsiBuilder.Marker error = builder.mark();
        builder.advanceLexer();
        if(tokenType == JavaTokenType.ELSE_KEYWORD)
        {
            error.error(JavaErrorMessages.message("else.without.if"));
        }
        else if(tokenType == JavaTokenType.CATCH_KEYWORD)
        {
            error.error(JavaErrorMessages.message("catch.without.try"));
        }
        else if(tokenType == JavaTokenType.FINALLY_KEYWORD)
        {
            error.error(JavaErrorMessages.message("finally.without.try"));
        }
        else
        {
            error.error(JavaErrorMessages.message("unexpected.token"));
        }
    }
}
项目:consulo-javaee    文件:_JspJavaLexer.java   
@Override
protected void lookAhead(Lexer baseLexer)
{
    if(baseLexer.getTokenType() == null)
    {
        super.lookAhead(baseLexer);
        return;
    }

    if(baseLexer.getTokenType() == JspTokenType.JAVA_CODE)
    {
        int start = baseLexer.getTokenStart();

        CharSequence bufferSequence = getBufferSequence();
        myJavaLexer.start(bufferSequence, start, baseLexer.getTokenEnd());

        IElementType elementType;
        while((elementType = myJavaLexer.getTokenType()) != null)
        {
            addToken(myJavaLexer.getTokenEnd(), elementType);
            myJavaLexer.advance();
        }

        baseLexer.advance();
    }
    else
    {
        advanceAs(baseLexer, ourPassTokens.contains(baseLexer.getTokenType()) ? baseLexer.getTokenType() : JspTokenType.JSP_FRAGMENT);
    }
}
项目:intellij-ce-playground    文件:JspIndexPatternBuilder.java   
@Override
public int getCommentStartDelta(final IElementType tokenType) {
  return tokenType == JspTokenType.JSP_COMMENT ? "<%--".length() : 0;
}
项目:intellij-ce-playground    文件:JspIndexPatternBuilder.java   
@Override
public int getCommentEndDelta(final IElementType tokenType) {
  return tokenType == JspTokenType.JSP_COMMENT ? "--%>".length() : 0;
}
项目:tools-idea    文件:JspIndexPatternBuilder.java   
@Override
public int getCommentStartDelta(final IElementType tokenType) {
  return tokenType == JspTokenType.JSP_COMMENT ? "<%--".length() : 0;
}
项目:tools-idea    文件:JspIndexPatternBuilder.java   
@Override
public int getCommentEndDelta(final IElementType tokenType) {
  return tokenType == JspTokenType.JSP_COMMENT ? "--%>".length() : 0;
}