diff --git a/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java b/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java index 8fd3e8418e2c..beacf34050aa 100644 --- a/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java +++ b/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java @@ -38,7 +38,7 @@ public class XmlHighlightingLexer extends DelegateLexer { } private IElementType fixWrongTokenTypes(IElementType tokenType) { - int state = getState(); + int state = getState() & 0x1f; // __XmlLexer.C_COMMENT_END is last state with value 30 if (tokenType == XmlTokenType.XML_NAME) { if (state == __XmlLexer.TAG || state == __XmlLexer.END_TAG) { // translate XML names for tags into XmlTagName diff --git a/xml/xml-psi-impl/src/com/intellij/lexer/_XmlLexer.flex b/xml/xml-psi-impl/src/com/intellij/lexer/_XmlLexer.flex index cd72a3a4423e..5c6c87f53723 100644 --- a/xml/xml-psi-impl/src/com/intellij/lexer/_XmlLexer.flex +++ b/xml/xml-psi-impl/src/com/intellij/lexer/_XmlLexer.flex @@ -64,6 +64,7 @@ import com.intellij.psi.xml.*; %state DOCTYPE %xstate CDATA %state C_COMMENT_START +/* this state should be last, number of states should be less than 16 */ %state C_COMMENT_END ALPHA=[:letter:]