Java Code Examples for com.intellij.psi.xml.XmlTokenType.XML_WHITE_SPACE

The following are Jave code examples for showing how to use XML_WHITE_SPACE of the com.intellij.psi.xml.XmlTokenType class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: intellij-ce-playground   File: XmlHighlightingLexer.java   Source Code and License Vote up 6 votes
static IElementType fixWrongTokenTypes(IElementType tokenType, final int state) {
  if (tokenType == XmlTokenType.XML_NAME) {
    if (state == __XmlLexer.TAG || state == __XmlLexer.END_TAG) {
      // translate XML names for tags into XmlTagName
      tokenType = XmlTokenType.XML_TAG_NAME;
    }
  } else if (tokenType == XmlTokenType.XML_WHITE_SPACE) {
    switch (state) {
      case __XmlLexer.ATTR_LIST:
      case __XmlLexer.ATTR:
        tokenType = XmlTokenType.TAG_WHITE_SPACE; break;
      default:
        tokenType = XmlTokenType.XML_REAL_WHITE_SPACE; break;
    }
  } else if (tokenType == XmlTokenType.XML_CHAR_ENTITY_REF ||
             tokenType == XmlTokenType.XML_ENTITY_REF_TOKEN
            ) {
    if (state == __XmlLexer.COMMENT) return XmlTokenType.XML_COMMENT_CHARACTERS;
  }
  return tokenType;
}