當前位置: 首頁>>代碼示例>>Java>>正文


Java HtmlHighlightingLexer類代碼示例

本文整理匯總了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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:Html5CustomAttributesIndex.java

示例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();
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:29,代碼來源:Html5CustomAttributesIndex.java

示例3: getHighlightingLexer

import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
@Nullable
@Override
public Lexer getHighlightingLexer() {
  return new HtmlHighlightingLexer(HtmlFileType.INSTANCE);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:TemplateHtmlScriptContentProvider.java

示例4: getHighlightingLexer

import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
@Override
@NotNull
public Lexer getHighlightingLexer() {
  return new HtmlHighlightingLexer(FileTypeRegistry.getInstance().findFileTypeByName("CSS"));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:HtmlFileHighlighter.java

示例5: createIndexingLexer

import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
static XHtmlFilterLexer createIndexingLexer(OccurrenceConsumer consumer) {
  return new XHtmlFilterLexer(new HtmlHighlightingLexer(FileTypeManager.getInstance().getStdFileType("CSS")), consumer);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:HtmlIdIndexer.java

示例6: createIndexingLexer

import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
static XHtmlFilterLexer createIndexingLexer(OccurrenceConsumer consumer) {
  return new XHtmlFilterLexer(new HtmlHighlightingLexer(), consumer);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:4,代碼來源:HtmlIdIndexer.java

示例7: getHighlightingLexer

import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
@NotNull
public Lexer getHighlightingLexer() {
  return new HtmlHighlightingLexer();
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:5,代碼來源:HtmlFileHighlighter.java

示例8: getHighlightingLexer

import com.intellij.lexer.HtmlHighlightingLexer; //導入依賴的package包/類
@Override
@NotNull
public Lexer getHighlightingLexer()
{
	return new HtmlHighlightingLexer();
}
 
開發者ID:consulo,項目名稱:consulo-xml,代碼行數:7,代碼來源:HtmlFileHighlighter.java


注:本文中的com.intellij.lexer.HtmlHighlightingLexer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。