diff --git a/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java b/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java index b5b97f9a5031..c68c75ebdf54 100644 --- a/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java +++ b/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java @@ -33,14 +33,13 @@ class _RegExLexer implements FlexLexer { public static final int NEGATE_CLASS1 = 8; public static final int CLASS2 = 10; public static final int PROP = 12; - public static final int BRACED_PROP = 14; - public static final int OPTIONS = 16; - public static final int COMMENT = 18; - public static final int NAMED_GROUP = 20; - public static final int QUOTED_NAMED_GROUP = 22; - public static final int PY_NAMED_GROUP_REF = 24; - public static final int PY_COND_REF = 26; - public static final int BRACKET_EXPRESSION = 28; + public static final int OPTIONS = 14; + public static final int COMMENT = 16; + public static final int NAMED_GROUP = 18; + public static final int QUOTED_NAMED_GROUP = 20; + public static final int PY_NAMED_GROUP_REF = 22; + public static final int PY_COND_REF = 24; + public static final int BRACKET_EXPRESSION = 26; /** * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l @@ -50,7 +49,7 @@ class _RegExLexer implements FlexLexer { */ private static final int ZZ_LEXSTATE[] = { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, - 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14 + 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 }; /** @@ -203,11 +202,11 @@ class _RegExLexer implements FlexLexer { private static final int [] ZZ_ACTION = zzUnpackAction(); private static final String ZZ_ACTION_PACKED_0 = - "\11\0\1\1\5\0\1\2\1\3\1\4\1\5\1\6"+ + "\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\10\1\34"+ - "\1\2\1\35\1\36\1\35\1\37\1\40\1\41\1\42"+ + "\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\10"+ "\1\60\1\61\1\62\2\63\1\64\1\65\1\66\1\67"+ @@ -219,7 +218,7 @@ class _RegExLexer implements FlexLexer { "\1\66\1\67\1\66\1\124\4\66"; private static int [] zzUnpackAction() { - int [] result = new int[129]; + int [] result = new int[128]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -245,25 +244,24 @@ class _RegExLexer implements FlexLexer { private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\72\0\164\0\256\0\350\0\u0122\0\u015c\0\u0196"+ - "\0\u01d0\0\u020a\0\u0244\0\u027e\0\u02b8\0\u02f2\0\u032c\0\u0366"+ - "\0\u0366\0\u03a0\0\u0366\0\u0366\0\u03da\0\u0414\0\u0366\0\u0366"+ - "\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366"+ - "\0\u044e\0\u0366\0\u0488\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366"+ - "\0\u04c2\0\u0366\0\u04fc\0\u0366\0\u0536\0\u0366\0\u0366\0\u03da"+ - "\0\u0366\0\u0570\0\u0366\0\u0366\0\u0366\0\u05aa\0\u05e4\0\u0366"+ - "\0\u0366\0\u0366\0\u0366\0\u0366\0\u061e\0\u0658\0\u0366\0\u0692"+ - "\0\u0366\0\u06cc\0\u0706\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366"+ - "\0\u0740\0\u0366\0\u0366\0\u0366\0\u077a\0\u07b4\0\u07ee\0\u0366"+ - "\0\u0828\0\u0862\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366"+ - "\0\u0366\0\u0366\0\u089c\0\u08d6\0\u0366\0\u0366\0\u0366\0\u0366"+ - "\0\u0910\0\u0366\0\u094a\0\u0366\0\u0984\0\u09be\0\u09f8\0\u0a32"+ - "\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366\0\u0366"+ - "\0\u0a6c\0\u0aa6\0\u0366\0\u0ae0\0\u0366\0\u0b1a\0\u06cc\0\u0366"+ - "\0\u0366\0\u0b54\0\u0b8e\0\u0bc8\0\u0366\0\u0c02\0\u0c3c\0\u0c76"+ - "\0\u0cb0"; + "\0\u01d0\0\u020a\0\u0244\0\u027e\0\u02b8\0\u02f2\0\u032c\0\u032c"+ + "\0\u0366\0\u032c\0\u032c\0\u03a0\0\u03da\0\u032c\0\u032c\0\u032c"+ + "\0\u032c\0\u032c\0\u032c\0\u032c\0\u032c\0\u032c\0\u032c\0\u0414"+ + "\0\u032c\0\u044e\0\u032c\0\u0488\0\u032c\0\u032c\0\u032c\0\u032c"+ + "\0\u032c\0\u04c2\0\u032c\0\u04fc\0\u032c\0\u0536\0\u032c\0\u032c"+ + "\0\u03a0\0\u032c\0\u032c\0\u032c\0\u0570\0\u05aa\0\u032c\0\u032c"+ + "\0\u032c\0\u032c\0\u032c\0\u05e4\0\u061e\0\u032c\0\u0658\0\u032c"+ + "\0\u0692\0\u06cc\0\u032c\0\u032c\0\u032c\0\u032c\0\u032c\0\u0706"+ + "\0\u032c\0\u032c\0\u032c\0\u0740\0\u077a\0\u07b4\0\u032c\0\u07ee"+ + "\0\u0828\0\u032c\0\u032c\0\u032c\0\u032c\0\u032c\0\u032c\0\u032c"+ + "\0\u032c\0\u0862\0\u089c\0\u032c\0\u032c\0\u032c\0\u032c\0\u08d6"+ + "\0\u032c\0\u0910\0\u032c\0\u094a\0\u0984\0\u09be\0\u09f8\0\u032c"+ + "\0\u032c\0\u032c\0\u032c\0\u032c\0\u032c\0\u032c\0\u032c\0\u0a32"+ + "\0\u0a6c\0\u032c\0\u0aa6\0\u032c\0\u0ae0\0\u0692\0\u032c\0\u032c"+ + "\0\u0b1a\0\u0b54\0\u0b8e\0\u032c\0\u0bc8\0\u0c02\0\u0c3c\0\u0c76"; private static int [] zzUnpackRowMap() { - int [] result = new int[129]; + int [] result = new int[128]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -286,81 +284,80 @@ class _RegExLexer implements FlexLexer { private static final int [] ZZ_TRANS = zzUnpackTrans(); private static final String ZZ_TRANS_PACKED_0 = - "\3\20\1\21\1\22\1\23\1\24\1\20\1\25\1\20"+ - "\1\26\3\20\1\27\1\30\1\31\1\32\1\33\1\34"+ - "\23\20\1\35\5\20\1\36\2\20\1\37\1\20\1\37"+ - "\2\20\1\37\3\20\1\40\12\20\1\41\57\20\1\42"+ - "\2\43\4\42\1\44\5\42\1\43\30\42\1\43\10\42"+ - "\1\45\12\42\11\46\1\47\46\46\3\0\25\46\1\50"+ - "\41\46\3\0\7\46\6\20\1\24\1\20\1\51\1\52"+ - "\1\53\3\20\1\27\30\20\1\35\10\20\1\54\1\20"+ - "\1\54\1\20\1\55\1\54\4\20\6\56\1\57\1\56"+ - "\1\60\1\56\1\26\15\56\1\61\1\56\1\61\2\56"+ - "\1\61\2\56\1\61\15\56\1\61\13\56\7\42\1\44"+ - "\3\42\1\62\2\42\1\63\5\42\22\62\2\42\2\62"+ - "\2\42\1\62\1\42\1\62\13\42\5\64\1\65\5\64"+ - "\1\66\10\64\22\66\1\64\1\67\2\66\2\64\1\66"+ - "\1\64\1\66\4\64\1\70\6\64\60\12\1\71\11\12"+ - "\13\64\1\62\10\64\22\62\2\64\2\62\2\64\1\62"+ - "\1\64\1\62\7\64\1\72\16\64\1\62\10\64\22\62"+ - "\2\64\2\62\1\64\1\73\1\62\1\64\1\62\20\64"+ - "\1\65\5\64\1\62\10\64\22\62\2\64\2\62\2\64"+ - "\1\62\1\64\1\62\14\64\2\43\2\64\1\65\5\64"+ - "\1\62\1\64\1\43\6\64\22\62\1\43\1\64\2\62"+ - "\2\64\1\62\1\64\1\62\13\64\13\74\1\62\10\74"+ - "\22\62\2\74\2\62\2\74\1\62\1\74\1\62\4\74"+ - "\1\75\6\74\112\0\1\76\62\0\1\77\4\0\1\100"+ - "\53\0\1\101\1\102\1\103\4\104\1\101\1\104\1\101"+ - "\1\104\1\105\2\101\6\104\2\106\3\107\3\110\1\111"+ - "\2\112\2\113\1\105\1\114\1\105\1\115\1\116\1\117"+ - "\1\104\1\120\1\121\2\101\1\122\1\123\1\105\1\101"+ - "\1\123\1\101\1\123\2\101\1\123\4\101\43\0\1\124"+ - "\27\0\2\43\12\0\1\43\30\0\1\43\34\0\1\125"+ - "\4\0\1\100\44\0\1\126\6\0\1\101\1\102\1\103"+ - "\4\104\1\101\1\104\1\127\1\104\1\105\2\101\6\104"+ - "\2\106\3\107\3\110\1\111\2\112\2\113\1\105\1\114"+ - "\1\105\1\115\1\116\1\117\1\104\1\120\1\121\2\101"+ - "\1\122\1\123\1\105\1\101\1\123\1\101\1\123\2\101"+ - "\1\123\4\101\64\0\1\130\6\0\2\62\10\0\3\62"+ - "\6\0\23\62\1\0\2\62\2\0\1\62\1\0\1\62"+ - "\26\0\1\66\10\0\22\66\2\0\2\66\2\0\1\66"+ - "\1\0\1\66\26\0\1\67\10\0\22\67\2\0\2\67"+ - "\2\0\1\67\1\0\1\67\24\0\1\131\64\0\1\132"+ - "\33\0\1\133\11\0\1\134\1\135\7\0\1\136\2\0"+ - "\1\136\1\137\1\140\1\141\11\0\1\142\61\0\2\102"+ - "\43\0\1\102\25\0\1\143\43\0\1\143\23\0\72\144"+ - "\1\0\2\145\3\0\1\146\16\0\2\145\4\0\3\145"+ - "\3\0\1\145\1\0\1\145\2\0\1\145\24\0\2\147"+ - "\22\0\2\147\4\0\3\147\3\0\1\147\1\0\1\147"+ - "\2\0\1\147\24\0\1\102\1\150\43\0\1\150\75\0"+ - "\1\151\1\152\70\0\1\153\1\154\70\0\1\155\14\0"+ - "\1\156\71\0\1\157\1\160\1\0\5\161\1\0\64\161"+ - "\2\0\1\162\43\0\1\162\24\0\2\163\22\0\2\163"+ + "\3\17\1\20\1\21\1\22\1\23\1\17\1\24\1\17"+ + "\1\25\3\17\1\26\1\27\1\30\1\31\1\32\1\33"+ + "\23\17\1\34\5\17\1\35\2\17\1\36\1\17\1\36"+ + "\2\17\1\36\3\17\1\37\12\17\1\40\57\17\1\41"+ + "\2\42\4\41\1\43\3\41\1\44\1\41\1\42\1\45"+ + "\5\41\22\44\1\42\1\41\2\44\2\41\1\44\1\41"+ + "\1\44\1\46\12\41\11\47\1\50\46\47\3\0\25\47"+ + "\1\51\41\47\3\0\7\47\6\17\1\23\1\17\1\52"+ + "\1\53\1\54\3\17\1\26\30\17\1\34\10\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\15\57\1\62\1\57\1\62"+ + "\2\57\1\62\2\57\1\62\15\57\1\62\13\57\5\63"+ + "\1\64\5\63\1\65\10\63\22\65\1\63\1\66\2\65"+ + "\2\63\1\65\1\63\1\65\4\63\1\67\6\63\60\11"+ + "\1\70\11\11\13\63\1\44\10\63\22\44\2\63\2\44"+ + "\2\63\1\44\1\63\1\44\7\63\1\71\16\63\1\44"+ + "\10\63\22\44\2\63\2\44\1\63\1\72\1\44\1\63"+ + "\1\44\20\63\1\64\5\63\1\44\10\63\22\44\2\63"+ + "\2\44\2\63\1\44\1\63\1\44\14\63\2\42\2\63"+ + "\1\64\5\63\1\44\1\63\1\42\6\63\22\44\1\42"+ + "\1\63\2\44\2\63\1\44\1\63\1\44\13\63\13\73"+ + "\1\44\10\73\22\44\2\73\2\44\2\73\1\44\1\73"+ + "\1\44\4\73\1\74\6\73\112\0\1\75\62\0\1\76"+ + "\4\0\1\77\53\0\1\100\1\101\1\102\4\103\1\100"+ + "\1\103\1\100\1\103\1\104\2\100\6\103\2\105\3\106"+ + "\3\107\1\110\2\111\2\112\1\104\1\113\1\104\1\114"+ + "\1\115\1\116\1\103\1\117\1\120\2\100\1\121\1\122"+ + "\1\104\1\100\1\122\1\100\1\122\2\100\1\122\4\100"+ + "\43\0\1\123\27\0\2\42\12\0\1\42\30\0\1\42"+ + "\24\0\2\44\10\0\3\44\6\0\23\44\1\0\2\44"+ + "\2\0\1\44\1\0\1\44\24\0\1\124\4\0\1\77"+ + "\44\0\1\125\6\0\1\100\1\101\1\102\4\103\1\100"+ + "\1\103\1\126\1\103\1\104\2\100\6\103\2\105\3\106"+ + "\3\107\1\110\2\111\2\112\1\104\1\113\1\104\1\114"+ + "\1\115\1\116\1\103\1\117\1\120\2\100\1\121\1\122"+ + "\1\104\1\100\1\122\1\100\1\122\2\100\1\122\4\100"+ + "\64\0\1\127\20\0\1\65\10\0\22\65\2\0\2\65"+ + "\2\0\1\65\1\0\1\65\26\0\1\66\10\0\22\66"+ + "\2\0\2\66\2\0\1\66\1\0\1\66\24\0\1\130"+ + "\64\0\1\131\33\0\1\132\11\0\1\133\1\134\7\0"+ + "\1\135\2\0\1\135\1\136\1\137\1\140\11\0\1\141"+ + "\61\0\2\101\43\0\1\101\25\0\1\142\43\0\1\142"+ + "\23\0\72\143\1\0\2\144\3\0\1\145\16\0\2\144"+ + "\4\0\3\144\3\0\1\144\1\0\1\144\2\0\1\144"+ + "\24\0\2\146\22\0\2\146\4\0\3\146\3\0\1\146"+ + "\1\0\1\146\2\0\1\146\24\0\1\101\1\147\43\0"+ + "\1\147\75\0\1\150\1\151\70\0\1\152\1\153\70\0"+ + "\1\154\14\0\1\155\71\0\1\156\1\157\1\0\5\160"+ + "\1\0\64\160\2\0\1\161\43\0\1\161\24\0\2\162"+ + "\22\0\2\162\4\0\3\162\3\0\1\162\1\0\1\162"+ + "\2\0\1\162\24\0\2\163\4\0\1\164\15\0\2\163"+ "\4\0\3\163\3\0\1\163\1\0\1\163\2\0\1\163"+ - "\24\0\2\164\4\0\1\165\15\0\2\164\4\0\3\164"+ - "\3\0\1\164\1\0\1\164\2\0\1\164\24\0\2\166"+ - "\22\0\2\166\4\0\3\166\3\0\1\166\1\0\1\166"+ - "\2\0\1\166\24\0\1\102\1\167\43\0\1\167\23\0"+ - "\5\161\1\170\64\161\2\0\1\171\43\0\1\171\24\0"+ - "\2\172\4\0\1\163\15\0\2\172\4\0\3\172\3\0"+ - "\1\172\1\0\1\172\2\0\1\172\24\0\2\173\22\0"+ + "\24\0\2\165\22\0\2\165\4\0\3\165\3\0\1\165"+ + "\1\0\1\165\2\0\1\165\24\0\1\101\1\166\43\0"+ + "\1\166\23\0\5\160\1\167\64\160\2\0\1\170\43\0"+ + "\1\170\24\0\2\171\4\0\1\162\15\0\2\171\4\0"+ + "\3\171\3\0\1\171\1\0\1\171\2\0\1\171\24\0"+ + "\2\172\22\0\2\172\4\0\3\172\3\0\1\172\1\0"+ + "\1\172\2\0\1\172\24\0\2\173\4\0\1\162\15\0"+ "\2\173\4\0\3\173\3\0\1\173\1\0\1\173\2\0"+ - "\1\173\24\0\2\174\4\0\1\163\15\0\2\174\4\0"+ - "\3\174\3\0\1\174\1\0\1\174\2\0\1\174\24\0"+ - "\2\175\22\0\2\175\4\0\3\175\3\0\1\175\1\0"+ - "\1\175\2\0\1\175\24\0\2\176\4\0\1\163\15\0"+ + "\1\173\24\0\2\174\22\0\2\174\4\0\3\174\3\0"+ + "\1\174\1\0\1\174\2\0\1\174\24\0\2\175\4\0"+ + "\1\162\15\0\2\175\4\0\3\175\3\0\1\175\1\0"+ + "\1\175\2\0\1\175\24\0\2\176\4\0\1\162\15\0"+ "\2\176\4\0\3\176\3\0\1\176\1\0\1\176\2\0"+ - "\1\176\24\0\2\177\4\0\1\163\15\0\2\177\4\0"+ + "\1\176\24\0\2\177\4\0\1\162\15\0\2\177\4\0"+ "\3\177\3\0\1\177\1\0\1\177\2\0\1\177\24\0"+ - "\2\200\4\0\1\163\15\0\2\200\4\0\3\200\3\0"+ - "\1\200\1\0\1\200\2\0\1\200\24\0\2\201\4\0"+ - "\1\163\15\0\2\201\4\0\3\201\3\0\1\201\1\0"+ - "\1\201\2\0\1\201\24\0\2\201\4\0\1\165\15\0"+ - "\2\201\4\0\3\201\3\0\1\201\1\0\1\201\2\0"+ - "\1\201\23\0"; + "\2\200\4\0\1\162\15\0\2\200\4\0\3\200\3\0"+ + "\1\200\1\0\1\200\2\0\1\200\24\0\2\200\4\0"+ + "\1\164\15\0\2\200\4\0\3\200\3\0\1\200\1\0"+ + "\1\200\2\0\1\200\23\0"; private static int [] zzUnpackTrans() { - int [] result = new int[3306]; + int [] result = new int[3248]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -398,16 +395,16 @@ class _RegExLexer implements FlexLexer { private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); private static final String ZZ_ATTRIBUTE_PACKED_0 = - "\11\0\1\1\5\0\2\11\1\1\2\11\2\1\12\11"+ - "\1\1\1\11\1\1\5\11\1\1\1\11\1\1\1\11"+ - "\1\1\2\11\1\1\1\11\1\1\3\11\2\1\5\11"+ + "\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\5\11\1\1\3\11"+ "\3\1\1\11\2\1\10\11\1\0\1\1\4\11\1\0"+ "\1\11\1\1\1\11\4\1\10\11\1\0\1\1\1\11"+ "\1\1\1\11\2\1\2\11\3\1\1\11\4\1"; private static int [] zzUnpackAttribute() { - int [] result = new int[129]; + int [] result = new int[128]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -851,55 +848,62 @@ class _RegExLexer implements FlexLexer { } case 105: break; case 22: - { return RegExpTT.COMMA; + { return RegExpTT.NAME; } case 106: break; case 23: - { assert false : yytext(); + { if (allowCaretNegatedProperties) { + return RegExpTT.CARET; + } else if (allowDanglingMetacharacters) { + yypopstate(); + yypushback(1); + } else { + return RegExpTT.BAD_CHARACTER; + } } case 107: break; case 24: - { yybegin(CLASS2); return RegExpTT.CHARACTER; + { return RegExpTT.COMMA; } case 108: break; case 25: - { yybegin(CLASS1); return RegExpTT.CARET; + { assert false : yytext(); } case 109: break; case 26: + { yybegin(CLASS2); return RegExpTT.CHARACTER; + } + case 110: break; + case 27: + { yybegin(CLASS1); return RegExpTT.CARET; + } + case 111: break; + case 28: { if (allowNestedCharacterClasses) { yypushstate(CLASS2); return RegExpTT.CLASS_BEGIN; } return RegExpTT.CHARACTER; } - case 110: break; - case 27: - { yypopstate(); return RegExpTT.CLASS_END; - } - case 111: break; - case 28: - { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.ESC_CHARACTER; - } case 112: break; case 29: - { yypopstate(); yypushback(1); + { yypopstate(); return RegExpTT.CLASS_END; } case 113: break; case 30: - { yypopstate(); yypushstate(BRACED_PROP); return RegExpTT.LBRACE; + { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.ESC_CHARACTER; } case 114: break; case 31: - { yypopstate(); if (allowCategoryShorthand) return RegExpTT.CATEGORY_SHORT_HAND; else yypushback(1); + { yypopstate(); yypushback(1); } case 115: break; case 32: - { return RegExpTT.NAME; + { yypopstate(); yypushstate(EMBRACED); return RegExpTT.LBRACE; } case 116: break; case 33: - { if (allowCaretNegatedProperties) return RegExpTT.CARET; else return RegExpTT.BAD_CHARACTER; + { yypopstate(); if (allowCategoryShorthand) return RegExpTT.CATEGORY_SHORT_HAND; else yypushback(1); } case 117: break; case 34: diff --git a/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex b/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex index 3b518c4e4cd8..7b29dbaadc92 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex +++ b/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex @@ -80,7 +80,6 @@ import java.util.EnumSet; %xstate NEGATE_CLASS1 %state CLASS2 %state PROP -%xstate BRACED_PROP %xstate OPTIONS %xstate COMMENT %xstate NAMED_GROUP @@ -196,28 +195,27 @@ HEX_CHAR=[0-9a-fA-F] {ESCAPE} { return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; } { - {LBRACE} { yypopstate(); yypushstate(BRACED_PROP); return RegExpTT.LBRACE; } + {LBRACE} { yypopstate(); yypushstate(EMBRACED); return RegExpTT.LBRACE; } "L"|"M"|"Z"|"S"|"N"|"P"|"C" { yypopstate(); if (allowCategoryShorthand) return RegExpTT.CATEGORY_SHORT_HAND; else yypushback(1); } {ANY} { yypopstate(); yypushback(1); } } - { - "^" { if (allowCaretNegatedProperties) return RegExpTT.CARET; else return RegExpTT.BAD_CHARACTER; } - {NAME} { return RegExpTT.NAME; } - {RBRACE} { yypopstate(); return RegExpTT.RBRACE; } - {ANY} { if (allowDanglingMetacharacters) { - yypopstate(); yypushback(1); - } else { - return RegExpTT.BAD_CHARACTER; - } - } -} - /* "{" \d+(,\d*)? "}" */ /* "}" outside counted closure is treated as regular character */ {LBRACE} { if (yystate() != CLASS2) yypushstate(EMBRACED); return RegExpTT.LBRACE; } { + "^" { + if (allowCaretNegatedProperties) { + return RegExpTT.CARET; + } else if (allowDanglingMetacharacters) { + yypopstate(); + yypushback(1); + } else { + return RegExpTT.BAD_CHARACTER; + } + } + {NAME} { return RegExpTT.NAME; } [:digit:]+ { return RegExpTT.NUMBER; } "," { return RegExpTT.COMMA; }