use of com.intellij.lang.HtmlScriptContentProvider in project intellij-community by JetBrains.
the class HtmlHighlightingLexer method setEmbeddedLexer.
private void setEmbeddedLexer() {
Lexer newLexer = null;
if (hasSeenStyle()) {
Lexer styleLexer = styleLexers.get(styleType);
if (styleLexer == null) {
if (hasSeenTag()) {
IElementType currentStylesheetElementType = getCurrentStylesheetElementType();
if (currentStylesheetElementType != null) {
Language language = currentStylesheetElementType.getLanguage();
styleLexer = SyntaxHighlighterFactory.getSyntaxHighlighter(language, null, null).getHighlightingLexer();
} else if (ourStyleFileType != null) {
SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(ourStyleFileType, null, null);
LOG.assertTrue(highlighter != null, ourStyleFileType);
styleLexer = highlighter.getHighlightingLexer();
} else {
styleLexer = null;
}
styleLexers.put(styleType, styleLexer);
} else if (hasSeenAttribute()) {
if (ourStyleFileType == null) {
styleLexer = null;
} else {
SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(ourStyleFileType, null, null);
LOG.assertTrue(highlighter != null, ourStyleFileType);
styleLexer = highlighter.getHighlightingLexer();
}
}
}
newLexer = styleLexer;
} else if (hasSeenScript()) {
Lexer scriptLexer = scriptLexers.get(scriptType);
if (scriptLexer == null) {
if (hasSeenTag()) {
HtmlScriptContentProvider provider = findScriptContentProvider(scriptType);
if (provider != null) {
scriptLexer = provider.getHighlightingLexer();
} else {
scriptLexer = SyntaxHighlighterFactory.getSyntaxHighlighter(PlainTextLanguage.INSTANCE, null, null).getHighlightingLexer();
}
} else if (hasSeenAttribute()) {
SyntaxHighlighter syntaxHighlighter = ourInlineScriptFileType != null ? SyntaxHighlighterFactory.getSyntaxHighlighter(ourInlineScriptFileType, null, null) : null;
scriptLexer = syntaxHighlighter != null ? syntaxHighlighter.getHighlightingLexer() : null;
}
scriptLexers.put(scriptType, scriptLexer);
}
newLexer = scriptLexer;
} else {
newLexer = createELLexer(newLexer);
}
if (newLexer != null) {
embeddedLexer = newLexer;
}
}
Aggregations