diff --git a/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java b/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java index 802cc4efe2c7..05ef52be5ab5 100644 --- a/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java +++ b/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java @@ -187,21 +187,21 @@ class _RegExLexer implements FlexLexer { "\10\0\1\1\5\0\1\2\1\3\1\4\1\5\1\6"+ "\1\7\1\10\1\11\1\12\1\13\1\14\1\15\1\16"+ "\1\17\1\20\1\21\1\22\1\2\1\23\1\24\1\25"+ - "\1\26\1\27\1\30\1\31\1\32\1\33\1\34\1\35"+ - "\1\10\1\36\1\2\1\37\1\40\1\37\1\41\1\42"+ - "\1\43\1\44\1\45\1\46\1\1\1\47\1\50\2\51"+ - "\1\52\1\53\1\0\1\54\1\55\1\56\1\57\1\60"+ - "\1\10\1\61\1\62\1\10\1\62\1\63\2\64\1\65"+ - "\1\66\1\67\1\70\1\55\1\71\1\72\1\10\1\73"+ - "\1\74\1\75\1\76\1\77\1\100\1\101\1\102\1\0"+ - "\1\103\1\104\1\105\1\106\1\107\1\0\1\110\1\111"+ - "\1\0\1\112\1\113\1\114\2\67\1\70\1\55\1\115"+ - "\1\116\1\117\1\120\1\121\1\122\1\0\1\111\1\0"+ - "\1\123\2\67\1\70\1\124\1\125\1\111\1\67\1\70"+ - "\1\67\1\126\4\67"; + "\1\26\1\27\1\30\1\31\1\32\1\31\1\33\1\34"+ + "\1\35\1\10\1\36\1\2\1\37\1\40\1\37\1\41"+ + "\1\42\1\43\1\44\1\45\1\46\1\1\1\47\1\50"+ + "\2\51\1\52\1\53\2\0\1\54\1\55\1\56\1\57"+ + "\1\60\1\10\1\61\1\62\1\10\1\62\1\63\2\64"+ + "\1\65\1\66\1\67\1\70\1\55\1\71\1\72\1\10"+ + "\1\73\1\74\1\75\1\76\1\77\1\100\1\101\1\102"+ + "\1\0\1\103\1\104\1\105\1\106\1\107\1\0\1\110"+ + "\1\0\1\111\1\0\1\112\1\113\1\114\2\67\1\70"+ + "\1\55\1\115\1\116\1\117\1\120\1\121\1\122\1\0"+ + "\1\111\1\0\1\123\2\67\1\70\1\124\1\125\1\111"+ + "\1\67\1\70\1\67\1\126\4\67"; private static int [] zzUnpackAction() { - int [] result = new int[133]; + int [] result = new int[136]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -231,21 +231,21 @@ class _RegExLexer implements FlexLexer { "\0\u0375\0\u033a\0\u033a\0\u03b0\0\u03eb\0\u033a\0\u033a\0\u033a"+ "\0\u033a\0\u033a\0\u033a\0\u033a\0\u033a\0\u033a\0\u033a\0\u0426"+ "\0\u033a\0\u0461\0\u033a\0\u049c\0\u033a\0\u033a\0\u033a\0\u033a"+ - "\0\u033a\0\u04d7\0\u033a\0\u0512\0\u033a\0\u054d\0\u033a\0\u033a"+ - "\0\u03b0\0\u033a\0\u033a\0\u033a\0\u0588\0\u05c3\0\u033a\0\u033a"+ - "\0\u033a\0\u033a\0\u033a\0\u05fe\0\u0639\0\u033a\0\u0674\0\u033a"+ - "\0\u06af\0\u06ea\0\u033a\0\u033a\0\u033a\0\u033a\0\u0725\0\u0760"+ - "\0\u033a\0\u033a\0\u079b\0\u033a\0\u033a\0\u033a\0\u07d6\0\u0811"+ - "\0\u084c\0\u033a\0\u033a\0\u0887\0\u033a\0\u033a\0\u033a\0\u033a"+ - "\0\u033a\0\u033a\0\u033a\0\u033a\0\u08c2\0\u08fd\0\u033a\0\u033a"+ - "\0\u033a\0\u033a\0\u0938\0\u033a\0\u0973\0\u09ae\0\u033a\0\u033a"+ - "\0\u033a\0\u09e9\0\u0a24\0\u0a5f\0\u0a9a\0\u033a\0\u033a\0\u033a"+ - "\0\u033a\0\u033a\0\u033a\0\u0ad5\0\u0b10\0\u0b4b\0\u033a\0\u0b86"+ - "\0\u033a\0\u0bc1\0\u06af\0\u033a\0\u033a\0\u0bfc\0\u0c37\0\u0c72"+ - "\0\u033a\0\u0cad\0\u0ce8\0\u0d23\0\u0d5e"; + "\0\u04d7\0\u033a\0\u0512\0\u033a\0\u054d\0\u033a\0\u0588\0\u033a"+ + "\0\u033a\0\u03b0\0\u033a\0\u033a\0\u033a\0\u05c3\0\u05fe\0\u033a"+ + "\0\u033a\0\u033a\0\u033a\0\u033a\0\u0639\0\u0674\0\u033a\0\u06af"+ + "\0\u06ea\0\u033a\0\u0725\0\u0760\0\u033a\0\u033a\0\u033a\0\u033a"+ + "\0\u079b\0\u07d6\0\u033a\0\u033a\0\u0811\0\u033a\0\u033a\0\u033a"+ + "\0\u084c\0\u0887\0\u08c2\0\u033a\0\u033a\0\u08fd\0\u033a\0\u033a"+ + "\0\u033a\0\u033a\0\u033a\0\u033a\0\u033a\0\u033a\0\u0938\0\u0973"+ + "\0\u033a\0\u033a\0\u033a\0\u033a\0\u09ae\0\u033a\0\u09e9\0\u0a24"+ + "\0\u0a5f\0\u033a\0\u033a\0\u033a\0\u0a9a\0\u0ad5\0\u0b10\0\u0b4b"+ + "\0\u033a\0\u033a\0\u033a\0\u033a\0\u033a\0\u033a\0\u0b86\0\u0bc1"+ + "\0\u0bfc\0\u033a\0\u0c37\0\u033a\0\u0c72\0\u0725\0\u033a\0\u033a"+ + "\0\u0cad\0\u0ce8\0\u0d23\0\u033a\0\u0d5e\0\u0d99\0\u0dd4\0\u0e0f"; private static int [] zzUnpackRowMap() { - int [] result = new int[133]; + int [] result = new int[136]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -274,77 +274,78 @@ class _RegExLexer implements FlexLexer { "\2\17\1\36\3\17\1\37\12\17\1\40\60\17\1\41"+ "\2\42\4\41\1\43\3\41\1\44\1\41\1\42\1\45"+ "\5\41\24\44\1\42\1\41\2\44\3\41\1\44\1\46"+ - "\12\41\11\47\1\50\47\47\3\0\25\47\1\51\42\47"+ - "\3\0\7\47\6\17\1\23\1\17\1\52\1\53\1\54"+ - "\3\17\1\26\32\17\1\34\7\17\1\55\1\17\1\55"+ - "\1\17\1\56\1\55\4\17\6\57\1\60\1\57\1\61"+ - "\1\57\1\25\17\57\1\62\1\57\1\62\2\57\1\62"+ - "\2\57\1\62\14\57\1\62\13\57\5\63\1\64\5\63"+ - "\1\65\10\63\24\65\1\63\1\66\2\65\3\63\1\65"+ - "\4\63\1\67\6\63\61\11\1\70\11\11\13\63\1\44"+ - "\10\63\24\44\2\63\2\44\3\63\1\44\7\63\1\71"+ - "\16\63\1\44\10\63\24\44\2\63\2\44\1\63\1\72"+ - "\1\63\1\44\20\63\1\64\5\63\1\44\10\63\24\44"+ - "\2\63\2\44\3\63\1\44\14\63\2\42\2\63\1\64"+ - "\5\63\1\44\1\63\1\42\6\63\24\44\1\42\1\63"+ - "\2\44\3\63\1\44\13\63\13\73\1\44\2\73\1\26"+ - "\5\73\24\44\2\73\2\44\3\73\1\44\4\73\1\74"+ - "\6\73\113\0\1\75\63\0\1\76\4\0\1\77\54\0"+ - "\1\100\1\101\1\102\4\103\1\100\1\104\1\100\1\104"+ - "\1\105\2\100\1\104\5\103\2\106\1\107\1\110\3\111"+ - "\3\112\1\113\2\114\2\115\1\105\1\116\1\105\1\117"+ - "\1\120\1\121\1\122\1\123\1\124\2\100\1\125\1\105"+ - "\1\100\1\125\1\100\1\125\2\100\1\125\4\100\45\0"+ - "\1\126\26\0\2\42\12\0\1\42\32\0\1\42\23\0"+ - "\2\44\10\0\3\44\6\0\25\44\1\0\2\44\3\0"+ - "\1\44\24\0\1\127\4\0\1\77\45\0\1\130\6\0"+ - "\1\100\1\101\1\102\4\103\1\100\1\104\1\131\1\104"+ - "\1\105\2\100\1\104\5\103\2\106\1\107\1\110\3\111"+ - "\3\112\1\113\2\114\2\115\1\105\1\116\1\105\1\117"+ - "\1\120\1\121\1\122\1\123\1\124\2\100\1\125\1\105"+ - "\1\100\1\125\1\100\1\125\2\100\1\125\4\100\65\0"+ - "\1\132\20\0\1\65\10\0\24\65\2\0\2\65\3\0"+ - "\1\65\26\0\1\66\10\0\24\66\2\0\2\66\3\0"+ - "\1\66\24\0\1\133\65\0\1\134\35\0\1\135\11\0"+ - "\1\136\1\137\6\0\1\140\2\0\1\140\1\141\1\142"+ - "\1\143\11\0\1\144\62\0\2\101\45\0\1\101\24\0"+ - "\1\145\45\0\1\145\30\0\1\146\140\0\1\147\1\150"+ - "\15\0\73\151\1\0\2\152\3\0\1\153\16\0\2\152"+ - "\1\0\1\152\4\0\3\152\3\0\1\152\1\0\1\152"+ - "\2\0\1\152\23\0\2\154\22\0\2\154\1\0\1\154"+ - "\4\0\3\154\3\0\1\154\1\0\1\154\2\0\1\154"+ - "\23\0\1\101\1\155\45\0\1\155\76\0\1\156\1\157"+ - "\71\0\1\160\13\0\1\161\72\0\1\162\1\163\1\0"+ - "\5\164\1\0\65\164\2\0\1\165\45\0\1\165\51\0"+ - "\1\166\44\0\2\167\22\0\2\167\1\0\1\167\4\0"+ - "\3\167\3\0\1\167\1\0\1\167\2\0\1\167\23\0"+ - "\2\170\4\0\1\171\15\0\2\170\1\0\1\170\4\0"+ - "\3\170\3\0\1\170\1\0\1\170\2\0\1\170\23\0"+ - "\2\172\22\0\2\172\1\0\1\172\4\0\3\172\3\0"+ - "\1\172\1\0\1\172\2\0\1\172\23\0\1\101\1\173"+ - "\45\0\1\173\22\0\5\164\1\174\65\164\2\0\1\175"+ - "\45\0\1\175\31\0\1\111\64\0\2\176\4\0\1\167"+ - "\15\0\2\176\1\0\1\176\4\0\3\176\3\0\1\176"+ - "\1\0\1\176\2\0\1\176\23\0\2\177\22\0\2\177"+ - "\1\0\1\177\4\0\3\177\3\0\1\177\1\0\1\177"+ - "\2\0\1\177\23\0\2\200\4\0\1\167\15\0\2\200"+ - "\1\0\1\200\4\0\3\200\3\0\1\200\1\0\1\200"+ - "\2\0\1\200\23\0\2\201\22\0\2\201\1\0\1\201"+ - "\4\0\3\201\3\0\1\201\1\0\1\201\2\0\1\201"+ - "\23\0\2\202\4\0\1\167\15\0\2\202\1\0\1\202"+ - "\4\0\3\202\3\0\1\202\1\0\1\202\2\0\1\202"+ - "\23\0\2\203\4\0\1\167\15\0\2\203\1\0\1\203"+ - "\4\0\3\203\3\0\1\203\1\0\1\203\2\0\1\203"+ - "\23\0\2\204\4\0\1\167\15\0\2\204\1\0\1\204"+ + "\12\41\11\47\1\50\1\51\46\47\3\0\25\47\1\52"+ + "\42\47\3\0\7\47\6\17\1\23\1\17\1\53\1\54"+ + "\1\55\3\17\1\26\32\17\1\34\7\17\1\56\1\17"+ + "\1\56\1\17\1\57\1\56\4\17\6\60\1\61\1\60"+ + "\1\62\1\60\1\25\17\60\1\63\1\60\1\63\2\60"+ + "\1\63\2\60\1\63\14\60\1\63\13\60\5\64\1\65"+ + "\5\64\1\66\10\64\24\66\1\64\1\67\2\66\3\64"+ + "\1\66\4\64\1\70\6\64\61\11\1\71\11\11\13\64"+ + "\1\44\10\64\24\44\2\64\2\44\3\64\1\44\7\64"+ + "\1\72\16\64\1\44\10\64\24\44\2\64\2\44\1\64"+ + "\1\73\1\64\1\44\20\64\1\65\5\64\1\44\10\64"+ + "\24\44\2\64\2\44\3\64\1\44\14\64\2\42\2\64"+ + "\1\65\5\64\1\44\1\64\1\42\6\64\24\44\1\42"+ + "\1\64\2\44\3\64\1\44\13\64\13\74\1\44\2\74"+ + "\1\26\5\74\24\44\2\74\2\44\3\74\1\44\4\74"+ + "\1\75\6\74\113\0\1\76\63\0\1\77\1\100\3\0"+ + "\1\101\54\0\1\102\1\103\1\104\4\105\1\102\1\106"+ + "\1\102\1\106\1\107\2\102\1\106\5\105\2\110\1\111"+ + "\1\112\3\113\3\114\1\115\2\116\2\117\1\107\1\120"+ + "\1\107\1\121\1\122\1\123\1\124\1\125\1\126\2\102"+ + "\1\127\1\107\1\102\1\127\1\102\1\127\2\102\1\127"+ + "\4\102\45\0\1\130\26\0\2\42\12\0\1\42\32\0"+ + "\1\42\23\0\2\44\10\0\3\44\6\0\25\44\1\0"+ + "\2\44\3\0\1\44\24\0\1\131\72\0\1\132\1\100"+ + "\3\0\1\101\45\0\1\133\6\0\1\102\1\103\1\104"+ + "\4\105\1\102\3\106\1\107\2\102\1\106\5\105\2\110"+ + "\1\111\1\112\3\113\3\114\1\115\2\116\2\117\1\107"+ + "\1\120\1\107\1\121\1\122\1\123\1\124\1\125\1\126"+ + "\2\102\1\127\1\107\1\102\1\127\1\102\1\127\2\102"+ + "\1\127\4\102\65\0\1\134\20\0\1\66\10\0\24\66"+ + "\2\0\2\66\3\0\1\66\26\0\1\67\10\0\24\67"+ + "\2\0\2\67\3\0\1\67\24\0\1\135\65\0\1\136"+ + "\35\0\1\137\11\0\1\140\1\141\6\0\1\142\2\0"+ + "\1\142\1\143\1\144\1\145\11\0\1\77\72\0\1\146"+ + "\1\147\61\0\2\103\45\0\1\103\24\0\1\150\45\0"+ + "\1\150\30\0\1\151\140\0\1\152\1\153\15\0\73\154"+ + "\1\0\2\155\3\0\1\156\16\0\2\155\1\0\1\155"+ + "\4\0\3\155\3\0\1\155\1\0\1\155\2\0\1\155"+ + "\23\0\2\157\22\0\2\157\1\0\1\157\4\0\3\157"+ + "\3\0\1\157\1\0\1\157\2\0\1\157\23\0\1\103"+ + "\1\160\45\0\1\160\76\0\1\161\1\162\71\0\1\163"+ + "\13\0\1\164\72\0\1\165\1\166\1\0\5\167\1\0"+ + "\65\167\11\0\1\146\63\0\1\170\45\0\1\170\51\0"+ + "\1\171\44\0\2\172\22\0\2\172\1\0\1\172\4\0"+ + "\3\172\3\0\1\172\1\0\1\172\2\0\1\172\23\0"+ + "\2\173\4\0\1\174\15\0\2\173\1\0\1\173\4\0"+ + "\3\173\3\0\1\173\1\0\1\173\2\0\1\173\23\0"+ + "\2\175\22\0\2\175\1\0\1\175\4\0\3\175\3\0"+ + "\1\175\1\0\1\175\2\0\1\175\23\0\1\103\1\176"+ + "\45\0\1\176\22\0\5\167\1\177\65\167\2\0\1\200"+ + "\45\0\1\200\31\0\1\113\64\0\2\201\4\0\1\172"+ + "\15\0\2\201\1\0\1\201\4\0\3\201\3\0\1\201"+ + "\1\0\1\201\2\0\1\201\23\0\2\202\22\0\2\202"+ + "\1\0\1\202\4\0\3\202\3\0\1\202\1\0\1\202"+ + "\2\0\1\202\23\0\2\203\4\0\1\172\15\0\2\203"+ + "\1\0\1\203\4\0\3\203\3\0\1\203\1\0\1\203"+ + "\2\0\1\203\23\0\2\204\22\0\2\204\1\0\1\204"+ "\4\0\3\204\3\0\1\204\1\0\1\204\2\0\1\204"+ - "\23\0\2\205\4\0\1\167\15\0\2\205\1\0\1\205"+ - "\4\0\3\205\3\0\1\205\1\0\1\205\2\0\1\205"+ - "\23\0\2\205\4\0\1\171\15\0\2\205\1\0\1\205"+ + "\23\0\2\205\4\0\1\172\15\0\2\205\1\0\1\205"+ "\4\0\3\205\3\0\1\205\1\0\1\205\2\0\1\205"+ + "\23\0\2\206\4\0\1\172\15\0\2\206\1\0\1\206"+ + "\4\0\3\206\3\0\1\206\1\0\1\206\2\0\1\206"+ + "\23\0\2\207\4\0\1\172\15\0\2\207\1\0\1\207"+ + "\4\0\3\207\3\0\1\207\1\0\1\207\2\0\1\207"+ + "\23\0\2\210\4\0\1\172\15\0\2\210\1\0\1\210"+ + "\4\0\3\210\3\0\1\210\1\0\1\210\2\0\1\210"+ + "\23\0\2\210\4\0\1\174\15\0\2\210\1\0\1\210"+ + "\4\0\3\210\3\0\1\210\1\0\1\210\2\0\1\210"+ "\22\0"; private static int [] zzUnpackTrans() { - int [] result = new int[3481]; + int [] result = new int[3658]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -383,16 +384,16 @@ class _RegExLexer implements FlexLexer { private static final String ZZ_ATTRIBUTE_PACKED_0 = "\10\0\1\1\5\0\2\11\1\1\2\11\2\1\12\11"+ - "\1\1\1\11\1\1\1\11\1\1\5\11\1\1\1\11"+ - "\1\1\1\11\1\1\2\11\1\1\3\11\2\1\5\11"+ - "\2\1\1\11\1\0\1\11\2\1\4\11\2\1\2\11"+ - "\1\1\3\11\3\1\2\11\1\1\10\11\1\0\1\1"+ - "\4\11\1\0\1\11\1\1\1\0\3\11\4\1\6\11"+ - "\1\0\1\1\1\0\1\11\1\1\1\11\2\1\2\11"+ - "\3\1\1\11\4\1"; + "\1\1\1\11\1\1\1\11\1\1\4\11\1\1\1\11"+ + "\1\1\1\11\1\1\1\11\1\1\2\11\1\1\3\11"+ + "\2\1\5\11\2\1\1\11\2\0\1\11\2\1\4\11"+ + "\2\1\2\11\1\1\3\11\3\1\2\11\1\1\10\11"+ + "\1\0\1\1\4\11\1\0\1\11\1\0\1\1\1\0"+ + "\3\11\4\1\6\11\1\0\1\1\1\0\1\11\1\1"+ + "\1\11\2\1\2\11\3\1\1\11\4\1"; private static int [] zzUnpackAttribute() { - int [] result = new int[133]; + int [] result = new int[136]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -773,8 +774,7 @@ class _RegExLexer implements FlexLexer { } case 92: break; case 7: - { yypushstate(CLASS2); - return RegExpTT.CLASS_BEGIN; + { yypushstate(CLASS2); return RegExpTT.CLASS_BEGIN; } case 93: break; case 8: @@ -936,8 +936,7 @@ class _RegExLexer implements FlexLexer { // lookahead expression with fixed base length zzMarkedPos = Character.offsetByCodePoints (zzBufferL/*, zzStartRead, zzEndRead - zzStartRead*/, zzStartRead, 1); - { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(CLASS1); - return RegExpTT.CLASS_BEGIN; + { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(CLASS1); return RegExpTT.CLASS_BEGIN; } case 129: break; case 44: @@ -1013,6 +1012,10 @@ class _RegExLexer implements FlexLexer { } case 146: break; case 61: + { yybegin(CLASS2); return RegExpTT.REDUNDANT_ESCAPE; + } + case 147: break; + case 62: // lookahead expression with fixed base length zzMarkedPos = Character.offsetByCodePoints (zzBufferL/*, zzStartRead, zzEndRead - zzStartRead*/, zzStartRead, 1); @@ -1022,8 +1025,8 @@ class _RegExLexer implements FlexLexer { } return RegExpTT.CHARACTER; } - case 147: break; - case 62: + case 148: break; + case 63: { if (allowPosixBracketExpressions) { yybegin(BRACKET_EXPRESSION); return RegExpTT.BRACKET_EXPRESSION_BEGIN; @@ -1032,11 +1035,6 @@ class _RegExLexer implements FlexLexer { return RegExpTT.CHARACTER; } } - case 148: break; - case 63: - { if (!allowNestedCharacterClasses) return RegExpTT.CHARACTER; - return RegExpTT.REDUNDANT_ESCAPE; - } case 149: break; case 64: { if (allowNestedCharacterClasses) return RegExpTT.ANDAND; else yypushback(1); return RegExpTT.CHARACTER; @@ -1074,8 +1072,7 @@ class _RegExLexer implements FlexLexer { // lookahead expression with fixed base length zzMarkedPos = Character.offsetByCodePoints (zzBufferL/*, zzStartRead, zzEndRead - zzStartRead*/, zzStartRead, 1); - { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(NEGATE_CLASS1); - return RegExpTT.CLASS_BEGIN; + { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(NEGATE_CLASS1); return RegExpTT.CLASS_BEGIN; } case 158: break; case 73: diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java index eed7db6fa61f..b76bf14cf5bd 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java @@ -73,8 +73,7 @@ public final class RegExpLanguageHosts extends ClassExtension { - {ESCAPE} {RBRACKET} { if (!allowNestedCharacterClasses) return RegExpTT.CHARACTER; - return RegExpTT.REDUNDANT_ESCAPE; } + {ESCAPE} {RBRACKET} { return RegExpTT.ESC_CHARACTER; } } {ESCAPE} {ANY} { return RegExpTT.REDUNDANT_ESCAPE; } @@ -247,17 +246,17 @@ HEX_CHAR=[0-9a-fA-F] } } -{LBRACKET} / {RBRACKET} { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(CLASS1); - return RegExpTT.CLASS_BEGIN; } +{LBRACKET} / {RBRACKET} { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(CLASS1); return RegExpTT.CLASS_BEGIN; } +{LBRACKET} / {ESCAPE} {RBRACKET} { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(CLASS1); return RegExpTT.CLASS_BEGIN; } -{LBRACKET} / "^" {RBRACKET} { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(NEGATE_CLASS1); - return RegExpTT.CLASS_BEGIN; } +{LBRACKET} / "^" {RBRACKET} { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(NEGATE_CLASS1); return RegExpTT.CLASS_BEGIN; } +{LBRACKET} / "^" {ESCAPE} {RBRACKET} { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(NEGATE_CLASS1); return RegExpTT.CLASS_BEGIN; } -{LBRACKET} { yypushstate(CLASS2); - return RegExpTT.CLASS_BEGIN; } +{LBRACKET} { yypushstate(CLASS2); return RegExpTT.CLASS_BEGIN; } /* []abc] is legal. The first ] is treated as literal character */ { + {ESCAPE} {RBRACKET} { yybegin(CLASS2); return RegExpTT.REDUNDANT_ESCAPE; } {RBRACKET} { yybegin(CLASS2); return RegExpTT.CHARACTER; } . { assert false : yytext(); } } @@ -280,6 +279,7 @@ HEX_CHAR=[0-9a-fA-F] "&&" { if (allowNestedCharacterClasses) return RegExpTT.ANDAND; else yypushback(1); return RegExpTT.CHARACTER; } [\n\b\t\r\f] { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.ESC_CHARACTER; } + "^" { return RegExpTT.CARET; } {ANY} { return RegExpTT.CHARACTER; } } diff --git a/RegExpSupport/test/org/intellij/lang/regexp/RegExpHighlightingTest.java b/RegExpSupport/test/org/intellij/lang/regexp/RegExpHighlightingTest.java index f89ec613a991..93f121b14929 100644 --- a/RegExpSupport/test/org/intellij/lang/regexp/RegExpHighlightingTest.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/RegExpHighlightingTest.java @@ -42,7 +42,7 @@ public class RegExpHighlightingTest extends LightPlatformCodeInsightFixtureTestC final String pattern; final Result expectedResult; boolean showWarnings = true; - boolean showInfo = false; + boolean showInfo = true; String regExpHost = null; Test(String pattern, Result result, boolean warn, boolean info, String host) { diff --git a/RegExpSupport/test/org/intellij/lang/regexp/RegExpParsingTest.java b/RegExpSupport/test/org/intellij/lang/regexp/RegExpParsingTest.java index bb7e231ef762..4f126392aa08 100644 --- a/RegExpSupport/test/org/intellij/lang/regexp/RegExpParsingTest.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/RegExpParsingTest.java @@ -209,6 +209,10 @@ public class RegExpParsingTest extends ParsingTestCase { public void testEscapes23() throws IOException { doCodeTest("a\\Qabc?*+.))]][]\\E)"); } public void testEscapes24() throws IOException { doCodeTest("\\Q\\j\\E"); } public void testEscapes25() throws IOException { doCodeTest("\\c0"); } + public void testEscapes26() throws IOException { doCodeTest("[\\]]"); } + public void testEscapes27() throws IOException { doCodeTest("[^\\]]"); } + public void testEscapes28() throws IOException { doCodeTest("[a\\]]"); } + public void testEscapes29() throws IOException { doCodeTest("[^a\\]]"); } public void testAnchors1() throws IOException { doCodeTest("^*"); } public void testAnchors2() throws IOException { doCodeTest("$*"); } diff --git a/RegExpSupport/testData/RETest.xml b/RegExpSupport/testData/RETest.xml index d2c31f74fb94..a6c25a797450 100644 --- a/RegExpSupport/testData/RETest.xml +++ b/RegExpSupport/testData/RETest.xml @@ -1,10 +1,10 @@ - + {1}]]> OK - + \;]]> OK @@ -14,23 +14,23 @@ - + {0,1}]]> OK - + {1,}]]> OK - + {0,}]]> OK - + {1}]]> OK - + {3,3}]]> OK @@ -101,6 +101,14 @@ )]][]\E]]]> OK + + ]} + OK + + + \]\}]]> + OK + @@ -145,7 +153,7 @@ - + \ b]]> OK diff --git a/RegExpSupport/testData/psi/Charclasses67.txt b/RegExpSupport/testData/psi/Charclasses67.txt index 76cd8dad4c9e..2d58df0633c5 100644 --- a/RegExpSupport/testData/psi/Charclasses67.txt +++ b/RegExpSupport/testData/psi/Charclasses67.txt @@ -13,7 +13,7 @@ REGEXP_FILE RegExpCharImpl: <\[> PsiElement(ESC_CHARACTER)('\[') RegExpCharImpl: <\]> - PsiElement(REDUNDANT_ESCAPE)('\]') + PsiElement(ESC_CHARACTER)('\]') RegExpCharImpl: <\\> PsiElement(ESC_CHARACTER)('\\') RegExpCharImpl: <\+> diff --git a/RegExpSupport/testData/psi/Escapes26.txt b/RegExpSupport/testData/psi/Escapes26.txt new file mode 100644 index 000000000000..d37c28cb0873 --- /dev/null +++ b/RegExpSupport/testData/psi/Escapes26.txt @@ -0,0 +1,8 @@ +REGEXP_FILE + RegExpPatternImpl: <[\]]> + RegExpBranchImpl: <[\]]> + RegExpClassImpl: <[\]]> + PsiElement(CLASS_BEGIN)('[') + RegExpCharImpl: <\]> + PsiElement(REDUNDANT_ESCAPE)('\]') + PsiElement(CLASS_END)(']') \ No newline at end of file diff --git a/RegExpSupport/testData/psi/Escapes27.txt b/RegExpSupport/testData/psi/Escapes27.txt new file mode 100644 index 000000000000..92fe4d03cd99 --- /dev/null +++ b/RegExpSupport/testData/psi/Escapes27.txt @@ -0,0 +1,9 @@ +REGEXP_FILE + RegExpPatternImpl: <[^\]]> + RegExpBranchImpl: <[^\]]> + RegExpClassImpl: <[^\]]> + PsiElement(CLASS_BEGIN)('[') + PsiElement(CARET)('^') + RegExpCharImpl: <\]> + PsiElement(REDUNDANT_ESCAPE)('\]') + PsiElement(CLASS_END)(']') \ No newline at end of file diff --git a/RegExpSupport/testData/psi/Escapes28.txt b/RegExpSupport/testData/psi/Escapes28.txt new file mode 100644 index 000000000000..07e27e856812 --- /dev/null +++ b/RegExpSupport/testData/psi/Escapes28.txt @@ -0,0 +1,11 @@ +REGEXP_FILE + RegExpPatternImpl: <[a\]]> + RegExpBranchImpl: <[a\]]> + RegExpClassImpl: <[a\]]> + PsiElement(CLASS_BEGIN)('[') + RegExpUnionImpl: + RegExpCharImpl: + PsiElement(CHARACTER)('a') + RegExpCharImpl: <\]> + PsiElement(ESC_CHARACTER)('\]') + PsiElement(CLASS_END)(']') \ No newline at end of file diff --git a/RegExpSupport/testData/psi/Escapes29.txt b/RegExpSupport/testData/psi/Escapes29.txt new file mode 100644 index 000000000000..c0f0c53fa75a --- /dev/null +++ b/RegExpSupport/testData/psi/Escapes29.txt @@ -0,0 +1,12 @@ +REGEXP_FILE + RegExpPatternImpl: <[^a\]]> + RegExpBranchImpl: <[^a\]]> + RegExpClassImpl: <[^a\]]> + PsiElement(CLASS_BEGIN)('[') + PsiElement(CARET)('^') + RegExpUnionImpl: + RegExpCharImpl: + PsiElement(CHARACTER)('a') + RegExpCharImpl: <\]> + PsiElement(ESC_CHARACTER)('\]') + PsiElement(CLASS_END)(']') \ No newline at end of file diff --git a/java/java-impl/src/com/intellij/psi/impl/JavaRegExpHost.java b/java/java-impl/src/com/intellij/psi/impl/JavaRegExpHost.java index 8498422ec82f..db7b646a552c 100644 --- a/java/java-impl/src/com/intellij/psi/impl/JavaRegExpHost.java +++ b/java/java-impl/src/com/intellij/psi/impl/JavaRegExpHost.java @@ -135,7 +135,7 @@ public class JavaRegExpHost implements RegExpLanguageHost { @Override public boolean characterNeedsEscaping(char c) { - return c == ']' || c == '}'; + return false; } @Override