本文整理匯總了Java中com.intellij.lexer.HtmlHighlightingLexer類的典型用法代碼示例。如果您正苦於以下問題:Java HtmlHighlightingLexer類的具體用法?Java HtmlHighlightingLexer怎麽用?Java HtmlHighlightingLexer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
HtmlHighlightingLexer類屬於com.intellij.lexer包,在下文中一共展示了HtmlHighlightingLexer類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: map
import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
@Override
@NotNull
public Map<String, Void> map(@NotNull FileContent inputData) {
CharSequence input = inputData.getContentAsText();
Language language = ((LanguageFileType)inputData.getFileType()).getLanguage();
if (language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE) {
final Lexer lexer = (language == HTMLLanguage.INSTANCE ? new HtmlHighlightingLexer(FileTypeManager.getInstance().getStdFileType("CSS")) : new XHtmlHighlightingLexer());
lexer.start(input);
Map<String, Void> result = new HashMap<String, Void>();
IElementType tokenType = lexer.getTokenType();
while (tokenType != null) {
if (tokenType == XmlTokenType.XML_NAME) {
String xmlName = input.subSequence(lexer.getTokenStart(), lexer.getTokenEnd()).toString();
if (HtmlUtil.isCustomHtml5Attribute(xmlName)) {
result.put(xmlName, null);
}
}
else if (tokenType == XmlTokenType.XML_DOCTYPE_PUBLIC || tokenType == XmlTokenType.XML_DOCTYPE_SYSTEM) {
// this is not an HTML5 context
break;
}
lexer.advance();
tokenType = lexer.getTokenType();
}
return result;
}
return Collections.emptyMap();
}
示例2: map
import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
@Override
@NotNull
public Map<String, Void> map(FileContent inputData) {
CharSequence input = inputData.getContentAsText();
Language language = ((LanguageFileType)inputData.getFileType()).getLanguage();
if (language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE) {
final Lexer lexer = (language == HTMLLanguage.INSTANCE ? new HtmlHighlightingLexer() : new XHtmlHighlightingLexer());
lexer.start(input);
Map<String, Void> result = new HashMap<String, Void>();
IElementType tokenType = lexer.getTokenType();
while (tokenType != null) {
if (tokenType == XmlTokenType.XML_NAME) {
String xmlName = input.subSequence(lexer.getTokenStart(), lexer.getTokenEnd()).toString();
if (HtmlUtil.isCustomHtml5Attribute(xmlName)) {
result.put(xmlName, null);
}
}
else if (tokenType == XmlTokenType.XML_DOCTYPE_PUBLIC || tokenType == XmlTokenType.XML_DOCTYPE_SYSTEM) {
// this is not an HTML5 context
break;
}
lexer.advance();
tokenType = lexer.getTokenType();
}
return result;
}
return Collections.emptyMap();
}
示例3: getHighlightingLexer
import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
@Nullable
@Override
public Lexer getHighlightingLexer() {
return new HtmlHighlightingLexer(HtmlFileType.INSTANCE);
}
示例4: getHighlightingLexer
import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
@Override
@NotNull
public Lexer getHighlightingLexer() {
return new HtmlHighlightingLexer(FileTypeRegistry.getInstance().findFileTypeByName("CSS"));
}
示例5: createIndexingLexer
import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
static XHtmlFilterLexer createIndexingLexer(OccurrenceConsumer consumer) {
return new XHtmlFilterLexer(new HtmlHighlightingLexer(FileTypeManager.getInstance().getStdFileType("CSS")), consumer);
}
示例6: createIndexingLexer
import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
static XHtmlFilterLexer createIndexingLexer(OccurrenceConsumer consumer) {
return new XHtmlFilterLexer(new HtmlHighlightingLexer(), consumer);
}
示例7: getHighlightingLexer
import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
@NotNull
public Lexer getHighlightingLexer() {
return new HtmlHighlightingLexer();
}
示例8: getHighlightingLexer
import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
@Override
@NotNull
public Lexer getHighlightingLexer()
{
return new HtmlHighlightingLexer();
}