From 0d2dfd8385071f3f5edf63fdfe7f7eac79362030 Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Wed, 3 Jun 2015 19:57:18 +0300 Subject: [PATCH] Revert "Revert "correct regexp for tag name"" --- .../intellij/codeInsight/XmlParsingTest.java | 4 + xml/tests/testData/psi/testColonName.txt | 8 + .../gen/com/intellij/lexer/__XmlLexer.java | 169 +++++++++--------- .../src/com/intellij/lexer/_XmlLexer.flex | 2 +- 4 files changed, 100 insertions(+), 83 deletions(-) create mode 100644 xml/tests/testData/psi/testColonName.txt diff --git a/xml/tests/src/com/intellij/codeInsight/XmlParsingTest.java b/xml/tests/src/com/intellij/codeInsight/XmlParsingTest.java index d4ef033193af..4a9297e84b3a 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlParsingTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlParsingTest.java @@ -621,6 +621,10 @@ public class XmlParsingTest extends ParsingTestCase { doTestXml(""); } + public void testColonName() throws Exception { + doTestXml("<:foo/>"); + } + public void testNotation1() throws Exception { doTestDtd(""); } diff --git a/xml/tests/testData/psi/testColonName.txt b/xml/tests/testData/psi/testColonName.txt new file mode 100644 index 000000000000..a1397ad46d4f --- /dev/null +++ b/xml/tests/testData/psi/testColonName.txt @@ -0,0 +1,8 @@ +XmlFile:test.xml + PsiElement(XML_DOCUMENT) + PsiElement(XML_PROLOG) + + XmlTag::foo + XmlToken:XML_START_TAG_START('<') + XmlToken:XML_NAME(':foo') + XmlToken:XML_EMPTY_ELEMENT_END('/>') \ No newline at end of file diff --git a/xml/xml-psi-impl/gen/com/intellij/lexer/__XmlLexer.java b/xml/xml-psi-impl/gen/com/intellij/lexer/__XmlLexer.java index cf1934b1b445..8429291ad86a 100644 --- a/xml/xml-psi-impl/gen/com/intellij/lexer/__XmlLexer.java +++ b/xml/xml-psi-impl/gen/com/intellij/lexer/__XmlLexer.java @@ -1,4 +1,4 @@ -/* The following code was generated by JFlex 1.4.3 on 6/3/15 7:45 PM */ +/* The following code was generated by JFlex 1.4.3 on 6/3/15 7:55 PM */ /* It's an automatically generated code. Do not modify it. */ package com.intellij.lexer; @@ -11,7 +11,7 @@ import com.intellij.psi.xml.XmlTokenType; /** * This class is a scanner generated by * JFlex 1.4.3 - * on 6/3/15 7:45 PM from the specification file + * on 6/3/15 7:55 PM from the specification file * /Users/denofevil/Code/IDEA/tools/lexer/../../community/xml/xml-psi-impl/src/com/intellij/lexer/_XmlLexer.flex */ public class __XmlLexer implements FlexLexer { @@ -52,8 +52,8 @@ public class __XmlLexer implements FlexLexer { */ private static final String ZZ_CMAP_PACKED = "\11\0\2\3\1\0\2\3\22\0\1\3\1\15\1\57\1\6\1\4"+ - "\1\65\1\16\1\60\1\14\1\14\3\0\1\11\1\10\1\63\12\2"+ - "\1\12\1\30\1\17\1\64\1\13\1\61\1\0\1\23\1\54\1\21"+ + "\1\65\1\16\1\60\1\14\1\14\3\0\1\12\1\11\1\63\12\2"+ + "\1\10\1\30\1\17\1\64\1\13\1\61\1\0\1\23\1\54\1\21"+ "\1\22\1\50\1\44\2\1\1\56\2\1\1\55\1\52\1\1\1\45"+ "\1\47\2\1\1\51\1\24\1\53\3\1\1\46\1\1\1\20\1\66"+ "\1\25\1\0\1\7\1\0\1\32\1\41\4\44\1\31\4\1\1\26"+ @@ -228,103 +228,108 @@ public class __XmlLexer implements FlexLexer { private static final String ZZ_TRANS_PACKED_0 = "\3\20\1\21\1\22\1\20\1\22\7\20\1\23\1\24"+ - "\46\20\1\25\1\26\1\27\1\26\1\30\3\26\1\27"+ - "\3\26\1\31\2\26\1\23\1\32\1\26\4\27\1\26"+ + "\46\20\1\25\1\26\1\27\1\26\1\30\3\26\2\27"+ + "\2\26\1\31\2\26\1\23\1\32\1\26\4\27\1\26"+ "\2\27\1\26\26\27\4\26\1\33\4\26\1\34\5\26"+ - "\1\34\6\26\1\23\1\32\1\26\4\34\1\26\2\34"+ + "\2\34\5\26\1\23\1\32\1\26\4\34\1\26\2\34"+ "\1\26\12\34\1\35\13\34\2\26\1\36\5\26\3\37"+ "\1\30\12\37\1\40\1\41\41\37\1\42\5\37\1\26"+ - "\1\43\1\26\1\30\3\26\1\43\3\26\1\31\2\26"+ + "\1\43\1\26\1\30\3\26\2\43\2\26\1\31\2\26"+ "\1\23\1\32\1\26\4\43\1\26\2\43\1\26\26\43"+ - "\10\26\11\44\1\45\5\44\1\46\1\47\46\44\1\26"+ - "\1\50\1\26\1\30\3\26\1\50\6\26\1\23\1\32"+ + "\10\26\12\44\1\45\4\44\1\46\1\47\46\44\1\26"+ + "\1\50\1\26\1\30\3\26\2\50\5\26\1\23\1\32"+ "\1\26\4\50\1\26\2\50\1\26\26\50\10\26\3\51"+ "\1\30\12\51\1\52\1\53\37\51\1\54\1\55\3\51"+ "\1\56\2\51\16\26\1\23\1\32\47\26\4\57\1\60"+ "\1\57\1\60\7\57\1\61\1\62\37\57\1\63\5\57"+ "\1\64\5\57\1\65\1\57\1\65\7\57\1\61\1\62"+ "\40\57\1\63\4\57\1\66\1\57\1\26\1\43\1\26"+ - "\1\30\3\26\1\43\3\26\1\67\2\26\1\23\1\32"+ + "\1\30\3\26\2\43\2\26\1\67\2\26\1\23\1\32"+ "\1\70\4\43\1\26\2\43\1\26\16\43\1\71\1\43"+ "\1\72\5\43\1\73\1\74\6\26\25\75\1\76\41\75"+ - "\1\77\1\100\7\77\1\101\4\77\1\102\1\103\1\77"+ - "\4\100\1\104\2\100\1\77\26\100\11\77\1\100\7\77"+ - "\1\101\4\77\1\102\1\103\1\77\4\100\1\105\2\100"+ + "\1\77\1\100\10\77\1\101\3\77\1\102\1\103\1\77"+ + "\4\100\1\104\2\100\1\77\26\100\11\77\1\100\10\77"+ + "\1\101\3\77\1\102\1\103\1\77\4\100\1\105\2\100"+ "\1\77\26\100\10\77\3\20\2\0\1\20\1\0\7\20"+ "\2\0\46\20\1\25\3\0\1\21\70\0\1\106\62\0"+ - "\1\107\4\0\1\110\1\107\11\0\4\107\1\0\1\111"+ + "\1\107\4\0\1\110\2\107\10\0\4\107\1\0\1\111"+ "\1\107\1\0\1\111\1\112\3\107\1\113\1\107\1\114"+ "\16\107\25\0\1\115\43\0\1\116\1\0\1\117\3\0"+ "\3\20\1\0\12\20\2\0\46\20\1\25\70\0\2\27"+ - "\4\0\3\27\1\120\6\0\4\27\1\0\2\27\1\0"+ - "\26\27\13\0\1\30\100\0\1\121\64\0\1\122\54\0"+ - "\2\34\4\0\3\34\1\123\6\0\4\34\1\0\2\34"+ - "\1\0\26\34\11\0\2\34\4\0\3\34\1\123\6\0"+ - "\4\34\1\0\2\34\1\0\11\34\1\124\14\34\23\0"+ - "\1\125\54\0\2\43\4\0\3\43\1\126\6\0\4\43"+ - "\1\0\2\43\1\0\26\43\10\0\11\44\1\127\55\44"+ - "\15\0\1\130\52\0\2\50\4\0\3\50\1\131\6\0"+ - "\4\50\1\0\2\50\1\0\26\50\15\0\1\132\145\0"+ - "\1\133\7\0\1\134\145\0\1\135\2\0\25\136\1\137"+ - "\31\136\1\140\7\136\1\0\2\43\4\0\3\43\1\126"+ - "\6\0\4\43\1\0\2\43\1\0\22\43\1\141\3\43"+ - "\11\0\2\43\4\0\3\43\1\126\6\0\4\43\1\0"+ - "\2\43\1\0\15\43\1\142\10\43\10\0\57\143\1\57"+ - "\7\143\60\144\1\57\6\144\25\0\1\145\42\0\3\100"+ - "\4\0\1\100\3\0\3\100\2\0\4\100\1\0\2\100"+ - "\1\0\26\100\21\0\1\127\70\0\1\146\53\0\17\106"+ - "\1\0\42\106\1\147\4\106\1\0\2\107\4\0\3\107"+ - "\1\150\6\0\4\107\1\0\2\107\1\151\26\107\12\0"+ - "\1\152\40\0\1\153\24\0\2\107\4\0\3\107\1\150"+ - "\6\0\4\107\1\0\1\107\1\154\1\151\26\107\11\0"+ - "\2\107\4\0\3\107\1\150\6\0\4\107\1\0\2\107"+ - "\1\151\2\107\1\155\6\107\1\156\14\107\11\0\2\107"+ - "\4\0\3\107\1\150\6\0\4\107\1\0\2\107\1\151"+ - "\6\107\1\157\17\107\11\0\2\107\4\0\3\107\1\150"+ - "\6\0\4\107\1\0\2\107\1\151\10\107\1\160\15\107"+ - "\21\0\1\161\6\0\1\162\1\0\1\163\45\0\2\120"+ - "\4\0\3\120\7\0\4\120\1\0\2\120\1\0\26\120"+ - "\21\0\1\161\6\0\1\162\47\0\2\123\4\0\3\123"+ - "\7\0\4\123\1\0\2\123\1\0\26\123\11\0\2\34"+ - "\4\0\3\34\1\123\6\0\4\34\1\0\1\164\1\34"+ - "\1\0\26\34\11\0\2\126\4\0\3\126\7\0\4\126"+ - "\1\0\2\126\1\0\26\126\23\0\1\165\73\0\1\166"+ - "\47\0\2\131\4\0\3\131\7\0\4\131\1\0\2\131"+ - "\1\0\26\131\10\0\57\132\1\0\2\132\1\167\4\132"+ - "\57\133\1\0\5\133\1\170\1\133\60\134\1\0\1\134"+ - "\1\167\4\134\60\135\1\0\4\135\1\170\1\135\57\140"+ - "\1\136\7\140\1\0\2\43\4\0\3\43\1\126\6\0"+ - "\4\43\1\0\2\43\1\0\23\43\1\171\2\43\11\0"+ - "\2\43\4\0\3\43\1\126\6\0\4\43\1\0\2\43"+ - "\1\0\20\43\1\172\5\43\23\0\1\173\54\0\2\150"+ - "\4\0\3\150\7\0\4\150\1\0\2\150\1\151\26\150"+ - "\12\0\1\152\25\0\1\174\40\0\1\175\16\0\3\175"+ - "\6\0\1\175\6\0\1\175\2\0\1\175\3\0\1\175"+ - "\3\0\1\175\13\0\2\107\4\0\3\107\1\150\6\0"+ - "\4\107\1\0\2\107\1\174\26\107\11\0\2\107\4\0"+ - "\3\107\1\150\6\0\4\107\1\0\2\107\1\151\3\107"+ - "\1\176\22\107\11\0\2\107\4\0\3\107\1\150\6\0"+ - "\4\107\1\0\2\107\1\151\2\107\1\154\23\107\11\0"+ - "\2\107\4\0\3\107\1\150\6\0\4\107\1\0\2\107"+ - "\1\151\3\107\1\111\22\107\11\0\2\107\4\0\3\107"+ - "\1\150\6\0\4\107\1\0\2\107\1\151\4\107\1\156"+ - "\21\107\21\0\1\177\76\0\1\200\112\0\1\201\22\0"+ - "\2\43\4\0\3\43\1\126\6\0\4\43\1\0\2\43"+ - "\1\0\24\43\1\202\1\43\11\0\2\43\4\0\3\43"+ - "\1\126\6\0\3\43\1\203\1\0\2\43\1\0\26\43"+ + "\4\0\1\27\1\120\2\27\6\0\4\27\1\0\2\27"+ + "\1\0\26\27\13\0\1\30\100\0\1\121\64\0\1\122"+ + "\54\0\2\34\4\0\1\34\1\123\2\34\6\0\4\34"+ + "\1\0\2\34\1\0\26\34\11\0\2\34\4\0\1\34"+ + "\1\123\2\34\6\0\4\34\1\0\2\34\1\0\11\34"+ + "\1\124\14\34\23\0\1\125\54\0\2\43\4\0\1\43"+ + "\1\126\2\43\6\0\4\43\1\0\2\43\1\0\26\43"+ + "\10\0\12\44\1\127\54\44\15\0\1\130\52\0\2\50"+ + "\4\0\1\50\1\131\2\50\6\0\4\50\1\0\2\50"+ + "\1\0\26\50\15\0\1\132\145\0\1\133\7\0\1\134"+ + "\145\0\1\135\2\0\25\136\1\137\31\136\1\140\7\136"+ + "\1\0\2\43\4\0\1\43\1\126\2\43\6\0\4\43"+ + "\1\0\2\43\1\0\22\43\1\141\3\43\11\0\2\43"+ + "\4\0\1\43\1\126\2\43\6\0\4\43\1\0\2\43"+ + "\1\0\15\43\1\142\10\43\10\0\57\143\1\57\7\143"+ + "\60\144\1\57\6\144\25\0\1\145\42\0\3\100\5\0"+ + "\1\100\2\0\3\100\2\0\4\100\1\0\2\100\1\0"+ + "\26\100\22\0\1\127\67\0\1\146\53\0\17\106\1\0"+ + "\42\106\1\147\4\106\1\0\2\107\4\0\1\107\1\150"+ + "\2\107\6\0\4\107\1\0\2\107\1\151\26\107\12\0"+ + "\1\152\40\0\1\153\24\0\2\107\4\0\1\107\1\150"+ + "\2\107\6\0\4\107\1\0\1\107\1\154\1\151\26\107"+ + "\11\0\2\107\4\0\1\107\1\150\2\107\6\0\4\107"+ + "\1\0\2\107\1\151\2\107\1\155\6\107\1\156\14\107"+ + "\11\0\2\107\4\0\1\107\1\150\2\107\6\0\4\107"+ + "\1\0\2\107\1\151\6\107\1\157\17\107\11\0\2\107"+ + "\4\0\1\107\1\150\2\107\6\0\4\107\1\0\2\107"+ + "\1\151\10\107\1\160\15\107\22\0\1\161\5\0\1\162"+ + "\1\0\1\163\45\0\2\120\4\0\1\120\1\0\2\120"+ + "\6\0\4\120\1\0\2\120\1\0\26\120\22\0\1\161"+ + "\5\0\1\162\47\0\2\123\4\0\1\123\1\0\2\123"+ + "\6\0\4\123\1\0\2\123\1\0\26\123\11\0\2\34"+ + "\4\0\1\34\1\123\2\34\6\0\4\34\1\0\1\164"+ + "\1\34\1\0\26\34\11\0\2\126\4\0\1\126\1\0"+ + "\2\126\6\0\4\126\1\0\2\126\1\0\26\126\23\0"+ + "\1\165\73\0\1\166\47\0\2\131\4\0\1\131\1\0"+ + "\2\131\6\0\4\131\1\0\2\131\1\0\26\131\10\0"+ + "\57\132\1\0\2\132\1\167\4\132\57\133\1\0\5\133"+ + "\1\170\1\133\60\134\1\0\1\134\1\167\4\134\60\135"+ + "\1\0\4\135\1\170\1\135\57\140\1\136\7\140\1\0"+ + "\2\43\4\0\1\43\1\126\2\43\6\0\4\43\1\0"+ + "\2\43\1\0\23\43\1\171\2\43\11\0\2\43\4\0"+ + "\1\43\1\126\2\43\6\0\4\43\1\0\2\43\1\0"+ + "\20\43\1\172\5\43\23\0\1\173\54\0\2\150\4\0"+ + "\1\150\1\0\2\150\6\0\4\150\1\0\2\150\1\151"+ + "\26\150\12\0\1\152\25\0\1\174\40\0\1\175\16\0"+ + "\3\175\6\0\1\175\6\0\1\175\2\0\1\175\3\0"+ + "\1\175\3\0\1\175\13\0\2\107\4\0\1\107\1\150"+ + "\2\107\6\0\4\107\1\0\2\107\1\174\26\107\11\0"+ + "\2\107\4\0\1\107\1\150\2\107\6\0\4\107\1\0"+ + "\2\107\1\151\3\107\1\176\22\107\11\0\2\107\4\0"+ + "\1\107\1\150\2\107\6\0\4\107\1\0\2\107\1\151"+ + "\2\107\1\154\23\107\11\0\2\107\4\0\1\107\1\150"+ + "\2\107\6\0\4\107\1\0\2\107\1\151\3\107\1\111"+ + "\22\107\11\0\2\107\4\0\1\107\1\150\2\107\6\0"+ + "\4\107\1\0\2\107\1\151\4\107\1\156\21\107\22\0"+ + "\1\177\75\0\1\200\112\0\1\201\22\0\2\43\4\0"+ + "\1\43\1\126\2\43\6\0\4\43\1\0\2\43\1\0"+ + "\24\43\1\202\1\43\11\0\2\43\4\0\1\43\1\126"+ + "\2\43\6\0\3\43\1\203\1\0\2\43\1\0\26\43"+ "\12\0\1\175\16\0\3\175\4\0\1\174\1\0\1\175"+ "\6\0\1\175\2\0\1\175\3\0\1\175\3\0\1\175"+ - "\13\0\2\107\4\0\3\107\1\150\6\0\4\107\1\0"+ - "\2\107\1\151\4\107\1\154\21\107\32\0\1\204\65\0"+ - "\1\205\46\0\2\43\4\0\3\43\1\126\6\0\4\43"+ - "\1\0\2\43\1\0\25\43\1\206\11\0\2\43\4\0"+ - "\3\43\1\126\6\0\4\43\1\0\2\43\1\0\17\43"+ - "\1\207\6\43\33\0\1\210\67\0\1\211\43\0\2\43"+ - "\4\0\3\43\1\126\6\0\1\212\3\43\1\0\2\43"+ - "\1\0\26\43\11\0\2\43\4\0\3\43\1\126\6\0"+ - "\4\43\1\0\2\43\1\0\21\43\1\213\4\43\34\0"+ - "\1\214\110\0\1\215\43\0\1\216\112\0\1\217\37\0"+ - "\1\220\116\0\1\221\16\0"; + "\13\0\2\107\4\0\1\107\1\150\2\107\6\0\4\107"+ + "\1\0\2\107\1\151\4\107\1\154\21\107\32\0\1\204"+ + "\65\0\1\205\46\0\2\43\4\0\1\43\1\126\2\43"+ + "\6\0\4\43\1\0\2\43\1\0\25\43\1\206\11\0"+ + "\2\43\4\0\1\43\1\126\2\43\6\0\4\43\1\0"+ + "\2\43\1\0\17\43\1\207\6\43\33\0\1\210\67\0"+ + "\1\211\43\0\2\43\4\0\1\43\1\126\2\43\6\0"+ + "\1\212\3\43\1\0\2\43\1\0\26\43\11\0\2\43"+ + "\4\0\1\43\1\126\2\43\6\0\4\43\1\0\2\43"+ + "\1\0\21\43\1\213\4\43\34\0\1\214\110\0\1\215"+ + "\43\0\1\216\112\0\1\217\37\0\1\220\116\0\1\221"+ + "\16\0"; private static int [] zzUnpackTrans() { int [] result = new int[5445]; 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 b0d3b81a073e..cd72a3a4423e 100644 --- a/xml/xml-psi-impl/src/com/intellij/lexer/_XmlLexer.flex +++ b/xml/xml-psi-impl/src/com/intellij/lexer/_XmlLexer.flex @@ -72,7 +72,7 @@ WS=[\ \n\r\t\f] S={WS}+ EL_EMBEDMENT_START="${" | "#{" -NAME=({ALPHA}|"_")({ALPHA}|{DIGIT}|"_"|"."|"-")*(":"({ALPHA}|"_")?({ALPHA}|{DIGIT}|"_"|"."|"-")*)? +NAME=({ALPHA}|"_"|":")({ALPHA}|{DIGIT}|"_"|"."|"-")*(":"({ALPHA}|"_")?({ALPHA}|{DIGIT}|"_"|"."|"-")*)? END_COMMENT="-->" CONDITIONAL_COMMENT_CONDITION=({ALPHA})({ALPHA}|{S}|{DIGIT}|"."|"("|")"|"|"|"!"|"&")*