diff --git a/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java b/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java index 392cc60cb96b..72796ffe3c30 100644 --- a/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java +++ b/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java @@ -1,4 +1,4 @@ -/* The following code was generated by JFlex 1.4.3 on 10/30/14 5:39 PM */ +/* The following code was generated by JFlex 1.4.3 on 11/1/14 12:37 PM */ /* It's an automatically generated code. Do not modify it. */ package org.intellij.lang.regexp; @@ -15,7 +15,7 @@ import java.util.EnumSet; /** * This class is a scanner generated by * JFlex 1.4.3 - * on 10/30/14 5:39 PM from the specification file + * on 11/1/14 12:37 PM from the specification file * /Users/bas/Projects/IntelliJ IDEA Ultimate/tools/lexer/../../community/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex */ class _RegExLexer implements FlexLexer { @@ -28,6 +28,7 @@ class _RegExLexer implements FlexLexer { public static final int PY_NAMED_GROUP_REF = 22; public static final int QUOTED = 2; public static final int OPTIONS = 14; + public static final int BRACKET_EXPRESSION = 26; public static final int PY_COND_REF = 24; public static final int YYINITIAL = 0; public static final int NAMED_GROUP = 18; @@ -45,81 +46,81 @@ 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 + 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 }; /** * Translates characters to character classes */ private static final String ZZ_CMAP_PACKED = - "\10\0\2\61\1\13\1\0\1\61\1\67\22\0\1\53\1\65\1\0"+ - "\1\66\1\15\1\0\1\60\1\51\1\4\1\5\1\17\1\20\1\57"+ - "\1\45\1\3\1\0\1\2\7\44\2\1\1\62\1\0\1\50\1\64"+ - "\1\63\1\16\1\0\1\24\1\24\1\32\1\31\1\41\1\37\1\25"+ - "\1\46\1\34\2\52\1\54\1\54\1\54\1\52\1\36\1\40\1\52"+ - "\1\30\2\52\1\27\1\27\1\27\1\52\1\26\1\10\1\12\1\11"+ - "\1\14\1\55\1\0\1\23\1\24\1\33\1\31\1\23\1\23\1\52"+ - "\1\46\1\34\1\52\1\47\2\52\1\22\1\52\1\35\1\52\1\22"+ - "\1\27\1\22\1\43\1\27\1\27\1\42\1\52\1\25\1\6\1\21"+ - "\1\7\54\0\1\52\12\0\1\52\4\0\1\52\5\0\27\52\1\0"+ - "\37\52\1\0\u013f\52\31\0\162\52\4\0\14\52\16\0\5\52\11\0"+ - "\1\52\213\0\1\52\13\0\1\52\1\0\3\52\1\0\1\52\1\0"+ - "\24\52\1\0\54\52\1\0\46\52\1\0\5\52\4\0\202\52\10\0"+ - "\105\52\1\0\46\52\2\0\2\52\6\0\20\52\41\0\46\52\2\0"+ - "\1\52\7\0\47\52\110\0\33\52\5\0\3\52\56\0\32\52\5\0"+ - "\13\52\25\0\12\56\4\0\2\52\1\0\143\52\1\0\1\52\17\0"+ - "\2\52\7\0\2\52\12\56\3\52\2\0\1\52\20\0\1\52\1\0"+ - "\36\52\35\0\3\52\60\0\46\52\13\0\1\52\u0152\0\66\52\3\0"+ - "\1\52\22\0\1\52\7\0\12\52\4\0\12\56\25\0\10\52\2\0"+ - "\2\52\2\0\26\52\1\0\7\52\1\0\1\52\3\0\4\52\3\0"+ - "\1\52\36\0\2\52\1\0\3\52\4\0\12\56\2\52\23\0\6\52"+ - "\4\0\2\52\2\0\26\52\1\0\7\52\1\0\2\52\1\0\2\52"+ - "\1\0\2\52\37\0\4\52\1\0\1\52\7\0\12\56\2\0\3\52"+ - "\20\0\11\52\1\0\3\52\1\0\26\52\1\0\7\52\1\0\2\52"+ - "\1\0\5\52\3\0\1\52\22\0\1\52\17\0\2\52\4\0\12\56"+ - "\25\0\10\52\2\0\2\52\2\0\26\52\1\0\7\52\1\0\2\52"+ - "\1\0\5\52\3\0\1\52\36\0\2\52\1\0\3\52\4\0\12\56"+ - "\1\0\1\52\21\0\1\52\1\0\6\52\3\0\3\52\1\0\4\52"+ - "\3\0\2\52\1\0\1\52\1\0\2\52\3\0\2\52\3\0\3\52"+ - "\3\0\10\52\1\0\3\52\55\0\11\56\25\0\10\52\1\0\3\52"+ - "\1\0\27\52\1\0\12\52\1\0\5\52\46\0\2\52\4\0\12\56"+ - "\25\0\10\52\1\0\3\52\1\0\27\52\1\0\12\52\1\0\5\52"+ - "\3\0\1\52\40\0\1\52\1\0\2\52\4\0\12\56\25\0\10\52"+ - "\1\0\3\52\1\0\27\52\1\0\20\52\46\0\2\52\4\0\12\56"+ - "\25\0\22\52\3\0\30\52\1\0\11\52\1\0\1\52\2\0\7\52"+ - "\72\0\60\52\1\0\2\52\14\0\7\52\11\0\12\56\47\0\2\52"+ - "\1\0\1\52\2\0\2\52\1\0\1\52\2\0\1\52\6\0\4\52"+ - "\1\0\7\52\1\0\3\52\1\0\1\52\1\0\1\52\2\0\2\52"+ - "\1\0\4\52\1\0\2\52\11\0\1\52\2\0\5\52\1\0\1\52"+ - "\11\0\12\56\2\0\2\52\42\0\1\52\37\0\12\56\26\0\10\52"+ - "\1\0\42\52\35\0\4\52\164\0\42\52\1\0\5\52\1\0\2\52"+ - "\25\0\12\56\6\0\6\52\112\0\46\52\12\0\51\52\7\0\132\52"+ - "\5\0\104\52\5\0\122\52\6\0\7\52\1\0\77\52\1\0\1\52"+ - "\1\0\4\52\2\0\7\52\1\0\1\52\1\0\4\52\2\0\47\52"+ - "\1\0\1\52\1\0\4\52\2\0\37\52\1\0\1\52\1\0\4\52"+ - "\2\0\7\52\1\0\1\52\1\0\4\52\2\0\7\52\1\0\7\52"+ - "\1\0\27\52\1\0\37\52\1\0\1\52\1\0\4\52\2\0\7\52"+ - "\1\0\47\52\1\0\23\52\16\0\11\56\56\0\125\52\14\0\u026c\52"+ - "\2\0\10\52\12\0\32\52\5\0\113\52\25\0\15\52\1\0\4\52"+ - "\16\0\22\52\16\0\22\52\16\0\15\52\1\0\3\52\17\0\64\52"+ - "\43\0\1\52\4\0\1\52\3\0\12\56\46\0\12\56\6\0\130\52"+ - "\10\0\51\52\127\0\35\52\51\0\12\56\36\52\2\0\5\52\u038b\0"+ - "\154\52\224\0\234\52\4\0\132\52\6\0\26\52\2\0\6\52\2\0"+ - "\46\52\2\0\6\52\2\0\10\52\1\0\1\52\1\0\1\52\1\0"+ - "\1\52\1\0\37\52\2\0\65\52\1\0\7\52\1\0\1\52\3\0"+ - "\3\52\1\0\7\52\3\0\4\52\2\0\6\52\4\0\15\52\5\0"+ - "\3\52\1\0\7\52\164\0\1\52\15\0\1\52\202\0\1\52\4\0"+ - "\1\52\2\0\12\52\1\0\1\52\3\0\5\52\6\0\1\52\1\0"+ - "\1\52\1\0\1\52\1\0\4\52\1\0\3\52\1\0\7\52\3\0"+ - "\3\52\5\0\5\52\u0ebb\0\2\52\52\0\5\52\5\0\2\52\4\0"+ - "\126\52\6\0\3\52\1\0\132\52\1\0\4\52\5\0\50\52\4\0"+ - "\136\52\21\0\30\52\70\0\20\52\u0200\0\u19b6\52\112\0\u51a6\52\132\0"+ - "\u048d\52\u0773\0\u2ba4\52\u215c\0\u012e\52\2\0\73\52\225\0\7\52\14\0"+ - "\5\52\5\0\1\52\1\0\12\52\1\0\15\52\1\0\5\52\1\0"+ - "\1\52\1\0\2\52\1\0\2\52\1\0\154\52\41\0\u016b\52\22\0"+ - "\100\52\2\0\66\52\50\0\14\52\164\0\5\52\1\0\207\52\23\0"+ - "\12\56\7\0\32\52\6\0\32\52\13\0\131\52\3\0\6\52\2\0"+ - "\6\52\2\0\6\52\2\0\3\52\43\0"; + "\10\0\2\62\1\16\1\0\1\62\1\67\22\0\1\55\1\65\1\0"+ + "\1\66\1\20\1\0\1\61\1\54\1\4\1\5\1\22\1\23\1\57"+ + "\1\50\1\3\1\0\1\2\7\47\2\1\1\60\1\0\1\53\1\64"+ + "\1\63\1\21\1\0\1\27\1\27\1\35\1\34\1\44\1\42\1\30"+ + "\1\51\1\37\2\13\1\56\1\56\1\56\1\13\1\41\1\43\1\13"+ + "\1\33\2\13\1\32\1\32\1\32\1\13\1\31\1\10\1\12\1\11"+ + "\1\17\1\14\1\0\1\26\1\27\1\36\1\34\1\26\1\26\1\13"+ + "\1\51\1\37\1\13\1\52\2\13\1\25\1\13\1\40\1\13\1\25"+ + "\1\32\1\25\1\46\1\32\1\32\1\45\1\13\1\30\1\6\1\24"+ + "\1\7\54\0\1\13\12\0\1\13\4\0\1\13\5\0\27\13\1\0"+ + "\37\13\1\0\u013f\13\31\0\162\13\4\0\14\13\16\0\5\13\11\0"+ + "\1\13\213\0\1\13\13\0\1\13\1\0\3\13\1\0\1\13\1\0"+ + "\24\13\1\0\54\13\1\0\46\13\1\0\5\13\4\0\202\13\10\0"+ + "\105\13\1\0\46\13\2\0\2\13\6\0\20\13\41\0\46\13\2\0"+ + "\1\13\7\0\47\13\110\0\33\13\5\0\3\13\56\0\32\13\5\0"+ + "\13\13\25\0\12\15\4\0\2\13\1\0\143\13\1\0\1\13\17\0"+ + "\2\13\7\0\2\13\12\15\3\13\2\0\1\13\20\0\1\13\1\0"+ + "\36\13\35\0\3\13\60\0\46\13\13\0\1\13\u0152\0\66\13\3\0"+ + "\1\13\22\0\1\13\7\0\12\13\4\0\12\15\25\0\10\13\2\0"+ + "\2\13\2\0\26\13\1\0\7\13\1\0\1\13\3\0\4\13\3\0"+ + "\1\13\36\0\2\13\1\0\3\13\4\0\12\15\2\13\23\0\6\13"+ + "\4\0\2\13\2\0\26\13\1\0\7\13\1\0\2\13\1\0\2\13"+ + "\1\0\2\13\37\0\4\13\1\0\1\13\7\0\12\15\2\0\3\13"+ + "\20\0\11\13\1\0\3\13\1\0\26\13\1\0\7\13\1\0\2\13"+ + "\1\0\5\13\3\0\1\13\22\0\1\13\17\0\2\13\4\0\12\15"+ + "\25\0\10\13\2\0\2\13\2\0\26\13\1\0\7\13\1\0\2\13"+ + "\1\0\5\13\3\0\1\13\36\0\2\13\1\0\3\13\4\0\12\15"+ + "\1\0\1\13\21\0\1\13\1\0\6\13\3\0\3\13\1\0\4\13"+ + "\3\0\2\13\1\0\1\13\1\0\2\13\3\0\2\13\3\0\3\13"+ + "\3\0\10\13\1\0\3\13\55\0\11\15\25\0\10\13\1\0\3\13"+ + "\1\0\27\13\1\0\12\13\1\0\5\13\46\0\2\13\4\0\12\15"+ + "\25\0\10\13\1\0\3\13\1\0\27\13\1\0\12\13\1\0\5\13"+ + "\3\0\1\13\40\0\1\13\1\0\2\13\4\0\12\15\25\0\10\13"+ + "\1\0\3\13\1\0\27\13\1\0\20\13\46\0\2\13\4\0\12\15"+ + "\25\0\22\13\3\0\30\13\1\0\11\13\1\0\1\13\2\0\7\13"+ + "\72\0\60\13\1\0\2\13\14\0\7\13\11\0\12\15\47\0\2\13"+ + "\1\0\1\13\2\0\2\13\1\0\1\13\2\0\1\13\6\0\4\13"+ + "\1\0\7\13\1\0\3\13\1\0\1\13\1\0\1\13\2\0\2\13"+ + "\1\0\4\13\1\0\2\13\11\0\1\13\2\0\5\13\1\0\1\13"+ + "\11\0\12\15\2\0\2\13\42\0\1\13\37\0\12\15\26\0\10\13"+ + "\1\0\42\13\35\0\4\13\164\0\42\13\1\0\5\13\1\0\2\13"+ + "\25\0\12\15\6\0\6\13\112\0\46\13\12\0\51\13\7\0\132\13"+ + "\5\0\104\13\5\0\122\13\6\0\7\13\1\0\77\13\1\0\1\13"+ + "\1\0\4\13\2\0\7\13\1\0\1\13\1\0\4\13\2\0\47\13"+ + "\1\0\1\13\1\0\4\13\2\0\37\13\1\0\1\13\1\0\4\13"+ + "\2\0\7\13\1\0\1\13\1\0\4\13\2\0\7\13\1\0\7\13"+ + "\1\0\27\13\1\0\37\13\1\0\1\13\1\0\4\13\2\0\7\13"+ + "\1\0\47\13\1\0\23\13\16\0\11\15\56\0\125\13\14\0\u026c\13"+ + "\2\0\10\13\12\0\32\13\5\0\113\13\25\0\15\13\1\0\4\13"+ + "\16\0\22\13\16\0\22\13\16\0\15\13\1\0\3\13\17\0\64\13"+ + "\43\0\1\13\4\0\1\13\3\0\12\15\46\0\12\15\6\0\130\13"+ + "\10\0\51\13\127\0\35\13\51\0\12\15\36\13\2\0\5\13\u038b\0"+ + "\154\13\224\0\234\13\4\0\132\13\6\0\26\13\2\0\6\13\2\0"+ + "\46\13\2\0\6\13\2\0\10\13\1\0\1\13\1\0\1\13\1\0"+ + "\1\13\1\0\37\13\2\0\65\13\1\0\7\13\1\0\1\13\3\0"+ + "\3\13\1\0\7\13\3\0\4\13\2\0\6\13\4\0\15\13\5\0"+ + "\3\13\1\0\7\13\164\0\1\13\15\0\1\13\202\0\1\13\4\0"+ + "\1\13\2\0\12\13\1\0\1\13\3\0\5\13\6\0\1\13\1\0"+ + "\1\13\1\0\1\13\1\0\4\13\1\0\3\13\1\0\7\13\3\0"+ + "\3\13\5\0\5\13\u0ebb\0\2\13\52\0\5\13\5\0\2\13\4\0"+ + "\126\13\6\0\3\13\1\0\132\13\1\0\4\13\5\0\50\13\4\0"+ + "\136\13\21\0\30\13\70\0\20\13\u0200\0\u19b6\13\112\0\u51a6\13\132\0"+ + "\u048d\13\u0773\0\u2ba4\13\u215c\0\u012e\13\2\0\73\13\225\0\7\13\14\0"+ + "\5\13\5\0\1\13\1\0\12\13\1\0\15\13\1\0\5\13\1\0"+ + "\1\13\1\0\2\13\1\0\2\13\1\0\154\13\41\0\u016b\13\22\0"+ + "\100\13\2\0\66\13\50\0\14\13\164\0\5\13\1\0\207\13\23\0"+ + "\12\15\7\0\32\13\6\0\32\13\13\0\131\13\3\0\6\13\2\0"+ + "\6\13\2\0\6\13\2\0\3\13\43\0"; /** * Translates characters to character classes @@ -132,22 +133,23 @@ class _RegExLexer implements FlexLexer { private static final int [] ZZ_ACTION = zzUnpackAction(); private static final String ZZ_ACTION_PACKED_0 = - "\7\0\1\1\1\2\4\0\1\3\1\4\1\5\1\6"+ + "\7\0\1\1\1\2\5\0\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\23\1\3\1\24\1\25"+ "\1\26\1\27\1\30\1\31\1\32\1\33\1\34\1\35"+ "\1\11\1\36\1\3\1\37\1\40\1\37\1\41\1\42"+ - "\1\43\1\1\1\44\1\45\1\2\1\46\1\47\1\50"+ - "\1\51\1\0\1\52\1\53\1\54\1\55\1\56\1\57"+ - "\1\60\1\61\2\62\1\63\1\11\1\64\1\65\1\66"+ - "\1\53\1\67\1\11\1\70\1\71\1\72\1\73\1\74"+ - "\1\0\1\75\1\76\1\77\1\100\1\101\1\0\1\102"+ - "\1\103\1\104\2\65\1\66\1\53\1\105\1\106\1\107"+ - "\1\110\1\111\1\112\1\0\1\103\1\113\2\65\1\66"+ - "\1\114\1\115\1\103\1\65\1\66\1\65\1\116\4\65"; + "\1\43\1\1\1\44\1\45\1\2\1\46\1\47\2\50"+ + "\1\51\1\52\1\0\1\53\1\54\1\55\1\56\1\11"+ + "\1\57\1\60\1\61\1\62\2\63\1\64\1\65\1\66"+ + "\1\67\1\54\1\70\1\11\1\71\1\72\1\73\1\74"+ + "\1\75\1\76\1\77\1\0\1\100\1\101\1\102\1\103"+ + "\1\104\1\0\1\105\1\106\1\107\2\66\1\67\1\54"+ + "\1\110\1\111\1\112\1\113\1\114\1\115\1\0\1\106"+ + "\1\116\2\66\1\67\1\117\1\120\1\106\1\66\1\67"+ + "\1\66\1\121\4\66"; private static int [] zzUnpackAction() { - int [] result = new int[119]; + int [] result = new int[124]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -173,23 +175,24 @@ class _RegExLexer implements FlexLexer { private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\70\0\160\0\250\0\340\0\u0118\0\u0150\0\u0188"+ - "\0\u01c0\0\u01f8\0\u0230\0\u0268\0\u02a0\0\u02d8\0\u02d8\0\u0310"+ - "\0\u02d8\0\u02d8\0\u0348\0\u0380\0\u02d8\0\u02d8\0\u02d8\0\u02d8"+ - "\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u03b8\0\u02d8"+ - "\0\u03f0\0\u02d8\0\u0428\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u0460"+ - "\0\u02d8\0\u0498\0\u02d8\0\u04d0\0\u02d8\0\u02d8\0\u0348\0\u02d8"+ - "\0\u02d8\0\u02d8\0\u0508\0\u0540\0\u02d8\0\u02d8\0\u02d8\0\u02d8"+ - "\0\u0578\0\u02d8\0\u05b0\0\u02d8\0\u05e8\0\u0620\0\u02d8\0\u02d8"+ - "\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u0658\0\u02d8\0\u02d8\0\u02d8"+ - "\0\u0690\0\u06c8\0\u0700\0\u02d8\0\u0738\0\u02d8\0\u02d8\0\u02d8"+ - "\0\u02d8\0\u02d8\0\u0770\0\u07a8\0\u02d8\0\u02d8\0\u02d8\0\u02d8"+ - "\0\u07e0\0\u02d8\0\u0818\0\u02d8\0\u0850\0\u0888\0\u08c0\0\u08f8"+ - "\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u0930\0\u0968"+ - "\0\u02d8\0\u09a0\0\u02d8\0\u09d8\0\u05e8\0\u02d8\0\u02d8\0\u0a10"+ - "\0\u0a48\0\u0a80\0\u02d8\0\u0ab8\0\u0af0\0\u0b28\0\u0b60"; + "\0\u01c0\0\u01f8\0\u0230\0\u0268\0\u02a0\0\u02d8\0\u0310\0\u0310"+ + "\0\u0348\0\u0310\0\u0310\0\u0380\0\u03b8\0\u0310\0\u0310\0\u0310"+ + "\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u03f0"+ + "\0\u0310\0\u0428\0\u0310\0\u0460\0\u0310\0\u0310\0\u0310\0\u0310"+ + "\0\u0498\0\u0310\0\u04d0\0\u0310\0\u0508\0\u0310\0\u0310\0\u0380"+ + "\0\u0310\0\u0310\0\u0310\0\u0540\0\u0578\0\u0310\0\u0310\0\u0310"+ + "\0\u0310\0\u0310\0\u05b0\0\u05e8\0\u0310\0\u0620\0\u0310\0\u0658"+ + "\0\u0690\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310"+ + "\0\u06c8\0\u0310\0\u0310\0\u0700\0\u0738\0\u0770\0\u0310\0\u07a8"+ + "\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u07e0"+ + "\0\u0818\0\u0310\0\u0310\0\u0310\0\u0310\0\u0850\0\u0310\0\u0888"+ + "\0\u0310\0\u08c0\0\u08f8\0\u0930\0\u0968\0\u0310\0\u0310\0\u0310"+ + "\0\u0310\0\u0310\0\u0310\0\u09a0\0\u09d8\0\u0310\0\u0a10\0\u0310"+ + "\0\u0a48\0\u0658\0\u0310\0\u0310\0\u0a80\0\u0ab8\0\u0af0\0\u0310"+ + "\0\u0b28\0\u0b60\0\u0b98\0\u0bd0"; private static int [] zzUnpackRowMap() { - int [] result = new int[119]; + int [] result = new int[124]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -212,73 +215,76 @@ class _RegExLexer implements FlexLexer { private static final int [] ZZ_TRANS = zzUnpackTrans(); private static final String ZZ_TRANS_PACKED_0 = - "\3\16\1\17\1\20\1\21\1\22\1\16\1\23\1\16"+ - "\1\24\1\25\1\26\1\27\1\30\1\31\1\32\1\33"+ - "\23\16\1\34\5\16\1\35\5\16\1\25\4\16\1\36"+ - "\1\25\12\16\1\37\55\16\1\40\2\41\4\40\1\42"+ - "\12\40\22\43\1\41\1\40\2\43\2\40\1\43\1\40"+ - "\1\43\1\40\1\41\1\44\10\40\11\45\1\46\1\45"+ - "\1\0\67\45\1\0\1\47\53\45\6\16\1\22\1\16"+ - "\1\50\1\51\1\52\1\53\1\26\30\16\1\34\12\16"+ - "\1\54\1\53\5\16\1\53\6\55\1\56\1\55\1\57"+ - "\1\55\1\24\13\55\1\60\1\55\1\60\1\55\1\60"+ - "\3\55\1\60\15\55\1\60\13\55\5\61\1\62\14\61"+ - "\22\63\1\61\1\64\2\63\2\61\1\63\1\61\1\63"+ - "\5\61\1\65\5\61\13\11\1\66\53\11\1\66\22\61"+ - "\22\43\2\61\2\43\2\61\1\43\1\61\1\43\6\61"+ - "\1\67\26\61\22\43\2\61\2\43\1\61\1\70\1\43"+ - "\1\61\1\43\20\61\1\62\14\61\22\43\2\61\2\43"+ - "\2\61\1\43\1\61\1\43\14\61\2\41\2\61\1\62"+ - "\14\61\22\43\1\41\1\61\2\43\2\61\1\43\1\61"+ - "\1\43\1\61\1\41\11\61\106\0\1\71\62\0\1\72"+ - "\2\0\1\73\53\0\1\74\1\75\1\76\4\77\1\74"+ - "\1\77\1\74\1\77\1\100\6\77\2\101\3\102\3\103"+ - "\1\104\1\105\1\104\2\106\1\107\1\110\1\107\1\111"+ - "\1\112\1\113\1\77\1\114\1\115\2\74\1\107\1\100"+ - "\1\107\4\74\1\100\5\74\1\100\41\0\1\116\27\0"+ - "\2\41\41\0\1\41\11\0\1\41\12\0\2\43\17\0"+ - "\23\43\1\0\2\43\2\0\1\43\1\0\3\43\22\0"+ - "\1\117\2\0\1\73\53\0\1\74\1\75\1\76\4\77"+ - "\1\74\1\77\1\120\1\77\1\100\6\77\2\101\3\102"+ - "\3\103\1\104\1\105\1\104\2\106\1\107\1\110\1\107"+ - "\1\111\1\112\1\113\1\77\1\114\1\115\2\74\1\107"+ - "\1\100\1\107\4\74\1\100\5\74\1\100\60\0\1\121"+ - "\31\0\22\63\2\0\2\63\2\0\1\63\1\0\1\63"+ - "\35\0\22\64\2\0\2\64\2\0\1\64\1\0\1\64"+ - "\17\0\1\122\31\0\1\123\11\0\1\124\1\125\10\0"+ - "\2\126\1\127\1\130\1\131\12\0\1\132\57\0\2\75"+ - "\41\0\1\75\25\0\1\133\41\0\1\133\23\0\70\134"+ - "\1\0\2\135\3\0\1\136\14\0\2\135\4\0\3\135"+ - "\3\0\1\135\1\0\1\135\2\0\1\135\24\0\2\137"+ - "\20\0\2\137\4\0\3\137\3\0\1\137\1\0\1\137"+ - "\2\0\1\137\24\0\1\75\1\140\41\0\1\140\73\0"+ - "\1\141\1\142\66\0\1\143\13\0\1\144\67\0\1\145"+ - "\1\146\2\0\5\147\1\0\62\147\2\0\1\150\41\0"+ - "\1\150\24\0\2\151\20\0\2\151\4\0\3\151\3\0"+ - "\1\151\1\0\1\151\2\0\1\151\24\0\2\152\4\0"+ - "\1\153\13\0\2\152\4\0\3\152\3\0\1\152\1\0"+ - "\1\152\2\0\1\152\24\0\2\154\20\0\2\154\4\0"+ - "\3\154\3\0\1\154\1\0\1\154\2\0\1\154\24\0"+ - "\1\75\1\155\41\0\1\155\23\0\5\147\1\156\62\147"+ - "\2\0\1\157\41\0\1\157\24\0\2\160\4\0\1\151"+ - "\13\0\2\160\4\0\3\160\3\0\1\160\1\0\1\160"+ - "\2\0\1\160\24\0\2\161\20\0\2\161\4\0\3\161"+ - "\3\0\1\161\1\0\1\161\2\0\1\161\24\0\2\162"+ - "\4\0\1\151\13\0\2\162\4\0\3\162\3\0\1\162"+ - "\1\0\1\162\2\0\1\162\24\0\2\163\20\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\151\13\0\2\164\4\0\3\164"+ - "\3\0\1\164\1\0\1\164\2\0\1\164\24\0\2\165"+ - "\4\0\1\151\13\0\2\165\4\0\3\165\3\0\1\165"+ - "\1\0\1\165\2\0\1\165\24\0\2\166\4\0\1\151"+ - "\13\0\2\166\4\0\3\166\3\0\1\166\1\0\1\166"+ - "\2\0\1\166\24\0\2\167\4\0\1\151\13\0\2\167"+ - "\4\0\3\167\3\0\1\167\1\0\1\167\2\0\1\167"+ - "\24\0\2\167\4\0\1\153\13\0\2\167\4\0\3\167"+ - "\3\0\1\167\1\0\1\167\2\0\1\167\23\0"; + "\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"+ + "\1\34\23\17\1\35\4\17\1\36\4\17\1\26\3\17"+ + "\1\37\1\26\12\17\1\40\55\17\1\41\2\42\4\41"+ + "\1\43\3\41\1\44\1\41\1\42\7\41\22\44\1\42"+ + "\1\41\2\44\3\41\1\44\1\45\10\41\11\46\1\47"+ + "\4\46\1\0\67\46\1\0\1\50\50\46\6\17\1\23"+ + "\1\17\1\51\1\52\1\53\3\17\1\54\1\27\30\17"+ + "\1\35\10\17\1\55\1\54\4\17\1\54\6\56\1\57"+ + "\1\56\1\60\1\56\1\25\16\56\1\61\1\56\1\61"+ + "\1\56\1\61\3\56\1\61\14\56\1\61\11\56\5\62"+ + "\1\63\5\62\1\64\11\62\22\64\1\62\1\65\2\64"+ + "\3\62\1\64\1\62\1\66\7\62\16\11\1\67\50\11"+ + "\1\67\13\62\1\44\11\62\22\44\2\62\2\44\3\62"+ + "\1\44\4\62\1\70\17\62\1\44\11\62\22\44\2\62"+ + "\2\44\1\62\1\71\1\62\1\44\16\62\1\63\5\62"+ + "\1\44\11\62\22\44\2\62\2\44\3\62\1\44\12\62"+ + "\2\42\2\62\1\63\5\62\1\44\1\62\1\42\7\62"+ + "\22\44\1\42\1\62\2\44\3\62\1\44\11\62\13\72"+ + "\1\44\11\72\22\44\2\72\2\44\3\72\1\44\1\72"+ + "\1\73\7\72\111\0\1\74\57\0\1\75\5\0\1\76"+ + "\50\0\1\77\1\100\1\101\4\102\1\77\1\102\1\77"+ + "\1\102\1\103\2\77\1\104\6\102\2\105\3\106\3\107"+ + "\1\110\1\111\1\110\2\112\1\103\1\113\1\103\1\114"+ + "\1\115\1\116\1\102\1\117\1\120\2\77\1\104\1\103"+ + "\3\77\1\104\4\77\1\104\44\0\1\121\24\0\2\42"+ + "\12\0\1\42\31\0\1\42\21\0\2\44\10\0\3\44"+ + "\7\0\23\44\1\0\2\44\3\0\1\44\22\0\1\122"+ + "\5\0\1\76\40\0\1\123\7\0\1\77\1\100\1\101"+ + "\4\102\1\77\1\102\1\124\1\102\1\103\2\77\1\104"+ + "\6\102\2\105\3\106\3\107\1\110\1\111\1\110\2\112"+ + "\1\103\1\113\1\103\1\114\1\115\1\116\1\102\1\117"+ + "\1\120\2\77\1\104\1\103\3\77\1\104\4\77\1\104"+ + "\61\0\1\125\21\0\1\64\11\0\22\64\2\0\2\64"+ + "\3\0\1\64\24\0\1\65\11\0\22\65\2\0\2\65"+ + "\3\0\1\65\22\0\1\126\62\0\1\127\34\0\1\130"+ + "\11\0\1\131\1\132\3\0\1\133\2\0\1\133\1\134"+ + "\1\135\1\136\12\0\1\137\57\0\2\100\44\0\1\100"+ + "\22\0\1\140\44\0\1\140\20\0\70\141\1\0\2\142"+ + "\3\0\1\143\17\0\2\142\4\0\3\142\3\0\1\142"+ + "\1\0\1\142\2\0\1\142\21\0\2\144\23\0\2\144"+ + "\4\0\3\144\3\0\1\144\1\0\1\144\2\0\1\144"+ + "\21\0\1\100\1\145\44\0\1\145\73\0\1\146\1\147"+ + "\66\0\1\150\10\0\1\151\67\0\1\152\1\153\2\0"+ + "\5\154\1\0\62\154\2\0\1\155\44\0\1\155\21\0"+ + "\2\156\23\0\2\156\4\0\3\156\3\0\1\156\1\0"+ + "\1\156\2\0\1\156\21\0\2\157\4\0\1\160\16\0"+ + "\2\157\4\0\3\157\3\0\1\157\1\0\1\157\2\0"+ + "\1\157\21\0\2\161\23\0\2\161\4\0\3\161\3\0"+ + "\1\161\1\0\1\161\2\0\1\161\21\0\1\100\1\162"+ + "\44\0\1\162\20\0\5\154\1\163\62\154\2\0\1\164"+ + "\44\0\1\164\21\0\2\165\4\0\1\156\16\0\2\165"+ + "\4\0\3\165\3\0\1\165\1\0\1\165\2\0\1\165"+ + "\21\0\2\166\23\0\2\166\4\0\3\166\3\0\1\166"+ + "\1\0\1\166\2\0\1\166\21\0\2\167\4\0\1\156"+ + "\16\0\2\167\4\0\3\167\3\0\1\167\1\0\1\167"+ + "\2\0\1\167\21\0\2\170\23\0\2\170\4\0\3\170"+ + "\3\0\1\170\1\0\1\170\2\0\1\170\21\0\2\171"+ + "\4\0\1\156\16\0\2\171\4\0\3\171\3\0\1\171"+ + "\1\0\1\171\2\0\1\171\21\0\2\172\4\0\1\156"+ + "\16\0\2\172\4\0\3\172\3\0\1\172\1\0\1\172"+ + "\2\0\1\172\21\0\2\173\4\0\1\156\16\0\2\173"+ + "\4\0\3\173\3\0\1\173\1\0\1\173\2\0\1\173"+ + "\21\0\2\174\4\0\1\156\16\0\2\174\4\0\3\174"+ + "\3\0\1\174\1\0\1\174\2\0\1\174\21\0\2\174"+ + "\4\0\1\160\16\0\2\174\4\0\3\174\3\0\1\174"+ + "\1\0\1\174\2\0\1\174\20\0"; private static int [] zzUnpackTrans() { - int [] result = new int[2968]; + int [] result = new int[3080]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -319,16 +325,16 @@ class _RegExLexer implements FlexLexer { private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); private static final String ZZ_ATTRIBUTE_PACKED_0 = - "\7\0\2\1\4\0\2\11\1\1\2\11\2\1\12\11"+ + "\7\0\2\1\5\0\2\11\1\1\2\11\2\1\12\11"+ "\1\1\1\11\1\1\1\11\1\1\4\11\1\1\1\11"+ - "\1\1\1\11\1\1\2\11\1\1\3\11\2\1\4\11"+ - "\1\1\1\11\1\0\1\11\2\1\6\11\1\1\3\11"+ - "\3\1\1\11\1\1\5\11\1\0\1\1\4\11\1\0"+ + "\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\7\11\1\1\2\11"+ + "\3\1\1\11\1\1\7\11\1\0\1\1\4\11\1\0"+ "\1\11\1\1\1\11\4\1\6\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[119]; + int [] result = new int[124]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -403,6 +409,7 @@ class _RegExLexer implements FlexLexer { private boolean allowEmptyCharacterClass; private boolean allowHorizontalWhitespaceClass; private boolean allowCategoryShorthand; + private boolean allowPosixBracketExpressions; _RegExLexer(EnumSet capabilities) { this((java.io.Reader)null); @@ -415,6 +422,7 @@ class _RegExLexer implements FlexLexer { this.allowHorizontalWhitespaceClass = capabilities.contains(RegExpCapability.ALLOW_HORIZONTAL_WHITESPACE_CLASS); this.allowEmptyCharacterClass = capabilities.contains(RegExpCapability.ALLOW_EMPTY_CHARACTER_CLASS); this.allowCategoryShorthand = capabilities.contains(RegExpCapability.UNICODE_CATEGORY_SHORTHAND); + this.allowPosixBracketExpressions = capabilities.contains(RegExpCapability.POSIX_BRACKET_EXPRESSIONS); } private void yypushstate(int state) { @@ -685,137 +693,141 @@ class _RegExLexer implements FlexLexer { zzMarkedPos = zzMarkedPosL; switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { - case 78: + case 81: { return RegExpTT.UNICODE_CHAR; } - case 79: break; + case 82: break; case 7: { if (yystate() != CLASS2) yypushstate(EMBRACED); return RegExpTT.LBRACE; } - case 80: break; + case 83: break; case 24: { return RegExpTT.COMMA; } - case 81: break; - case 64: + case 84: break; + case 67: { return RegExpTT.POS_LOOKAHEAD; } - case 82: break; - case 62: + case 85: break; + case 65: { yybegin(QUOTED_NAMED_GROUP); capturingGroupCount++; return RegExpTT.RUBY_QUOTED_NAMED_GROUP; } - case 83: break; - case 77: + case 86: break; + case 80: { return RegExpTT.COMMENT; } - case 84: break; + case 87: break; case 14: { return RegExpTT.STAR; } - case 85: break; - case 60: + case 88: break; + case 63: { yybegin(PY_COND_REF); return RegExpTT.PYTHON_COND_REF; } - case 86: break; - case 49: + case 89: break; + case 50: { return RegExpTT.CHAR_CLASS; } - case 87: break; + case 90: break; case 36: { handleOptions(); return RegExpTT.OPTIONS_OFF; } - case 88: break; - case 56: + case 91: break; + case 57: { yypopstate(); return RegExpTT.QUOTE_END; } - case 89: break; + case 92: break; case 35: { yybegin(YYINITIAL); return RegExpTT.GROUP_END; } - case 90: break; - case 41: + case 93: break; + case 42: // lookahead expression with fixed base length zzMarkedPos = zzStartRead + 1; { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(CLASS1); return RegExpTT.CLASS_BEGIN; } - case 91: break; + case 94: break; case 37: { yybegin(YYINITIAL); return RegExpTT.COLON; } - case 92: break; + case 95: break; case 6: { return RegExpTT.GROUP_END; } - case 93: break; + case 96: break; case 25: { assert false : yytext(); } - case 94: break; + case 97: break; case 18: { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CHARACTER; } - case 95: break; - case 46: + case 98: break; + case 47: { return commentMode ? RegExpTT.CHARACTER : RegExpTT.REDUNDANT_ESCAPE; } - case 96: break; + case 99: break; case 23: { return RegExpTT.NAME; } - case 97: break; + case 100: break; case 29: { yypopstate(); return RegExpTT.CLASS_END; } - case 98: break; + case 101: break; + case 72: + { yybegin(NAMED_GROUP); return RegExpTT.RUBY_NAMED_GROUP_REF; + } + case 102: break; case 34: { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER; } - case 99: break; - case 52: + case 103: break; + case 53: { yypushstate(QUOTED); return RegExpTT.QUOTE_BEGIN; } - case 100: break; - case 69: - { yybegin(NAMED_GROUP); return RegExpTT.RUBY_NAMED_GROUP_REF; + case 104: break; + case 40: + { return RegExpTT.BAD_CHARACTER; } - case 101: break; + case 105: break; case 21: { return RegExpTT.NUMBER; } - case 102: break; + case 106: break; case 4: { return RegExpTT.DOT; } - case 103: break; - case 74: + case 107: break; + case 77: { return RegExpTT.NEG_LOOKBEHIND; } - case 104: break; + case 108: break; case 33: { yypopstate(); if (allowCategoryShorthand) return RegExpTT.CATEGORY_SHORT_HAND; else yypushback(1); } - case 105: break; - case 44: + case 109: break; + case 45: { return (allowOctalNoLeadingZero ? RegExpTT.OCT_CHAR : RegExpTT.BAD_OCT_VALUE); } - case 106: break; - case 65: + case 110: break; + case 68: { return RegExpTT.NEG_LOOKAHEAD; } - case 107: break; + case 111: break; case 10: { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CTRL_CHARACTER; } - case 108: break; - case 63: + case 112: break; + case 66: { return RegExpTT.NON_CAPT_GROUP; } - case 109: break; - case 70: + case 113: break; + case 73: { yybegin(QUOTED_NAMED_GROUP); return RegExpTT.RUBY_QUOTED_NAMED_GROUP_REF; } - case 110: break; + case 114: break; case 28: { if (allowNestedCharacterClasses) { yypushstate(CLASS2); @@ -823,24 +835,24 @@ class _RegExLexer implements FlexLexer { } return RegExpTT.CHARACTER; } - case 111: break; + case 115: break; case 19: { if (commentMode) { yypushstate(COMMENT); return RegExpTT.COMMENT; } else return RegExpTT.CHARACTER; } - case 112: break; - case 51: + case 116: break; + case 52: { yypushstate(PROP); return RegExpTT.PROPERTY; } - case 113: break; + case 117: break; case 8: { yypushstate(CLASS2); return RegExpTT.CLASS_BEGIN; } - case 114: break; - case 73: + case 118: break; + case 76: { return RegExpTT.POS_LOOKBEHIND; } - case 115: break; + case 119: break; case 20: { if (allowDanglingMetacharacters) { yypopstate(); yypushback(1); @@ -848,72 +860,76 @@ class _RegExLexer implements FlexLexer { return RegExpTT.BAD_CHARACTER; } } - case 116: break; - case 75: + case 120: break; + case 78: { return RegExpTT.HEX_CHAR; } - case 117: break; + case 121: break; case 1: { handleOptions(); return RegExpTT.OPTIONS_ON; } - case 118: break; - case 43: + case 122: break; + case 44: { if (yystate() == CLASS2) return RegExpTT.ESC_CHARACTER; while (yylength() > 2 && Integer.parseInt(yytext().toString().substring(1)) > capturingGroupCount) { yypushback(1); } return RegExpTT.BACKREF; } - case 119: break; + case 123: break; + case 62: + { yybegin(CLASS2); return RegExpTT.BRACKET_EXPRESSION_END; + } + case 124: break; case 2: { yypopstate(); return RegExpTT.COMMENT; } - case 120: break; + case 125: break; case 17: { return RegExpTT.MINUS; } - case 121: break; - case 47: + case 126: break; + case 48: { return RegExpTT.ESC_CTRL_CHARACTER; } - case 122: break; + case 127: break; case 32: { yypopstate(); yypushstate(EMBRACED); return RegExpTT.LBRACE; } - case 123: break; + case 128: break; case 13: { return RegExpTT.QUEST; } - case 124: break; - case 71: + case 129: break; + case 74: { yybegin(NAMED_GROUP); capturingGroupCount++; return RegExpTT.PYTHON_NAMED_GROUP; } - case 125: break; + case 130: break; case 5: { capturingGroupCount++; return RegExpTT.GROUP_BEGIN; } - case 126: break; + case 131: break; case 15: { return RegExpTT.PLUS; } - case 127: break; - case 67: + case 132: break; + case 70: { return RegExpTT.OCT_CHAR; } - case 128: break; + case 133: break; case 39: { yybegin(YYINITIAL); return RegExpTT.QUOTE; } - case 129: break; + case 134: break; case 31: { yypopstate(); yypushback(1); } - case 130: break; + case 135: break; case 27: { yybegin(CLASS1); return RegExpTT.CARET; } - case 131: break; - case 57: + case 136: break; + case 58: // lookahead expression with fixed base length zzMarkedPos = zzStartRead + 1; { if (allowNestedCharacterClasses) { @@ -922,104 +938,114 @@ class _RegExLexer implements FlexLexer { } return RegExpTT.CHARACTER; } - case 132: break; - case 58: + case 137: break; + case 59: + { if (allowPosixBracketExpressions) { + yybegin(BRACKET_EXPRESSION); + return RegExpTT.BRACKET_EXPRESSION_BEGIN; + } else { + yypushback(1); + return RegExpTT.CHARACTER; + } + } + case 138: break; + case 60: { if (!allowNestedCharacterClasses) return RegExpTT.CHARACTER; return RegExpTT.REDUNDANT_ESCAPE; } - case 133: break; + case 139: break; case 38: { yybegin(YYINITIAL); return RegExpTT.GT; } - case 134: break; - case 72: + case 140: break; + case 75: { yybegin(PY_NAMED_GROUP_REF); return RegExpTT.PYTHON_NAMED_GROUP_REF; } - case 135: break; + case 141: break; case 16: { return RegExpTT.UNION; } - case 136: break; + case 142: break; case 3: { return RegExpTT.CHARACTER; } - case 137: break; - case 40: + case 143: break; + case 41: { yybegin(OPTIONS); return RegExpTT.SET_OPTIONS; } - case 138: break; + case 144: break; case 26: { yybegin(CLASS2); return RegExpTT.CHARACTER; } - case 139: break; - case 68: + case 145: break; + case 71: { if (xmlSchemaMode) { yypushback(1); return RegExpTT.CHAR_CLASS; } else return RegExpTT.CTRL; } - case 140: break; + case 146: break; case 30: { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.ESC_CHARACTER; } - case 141: break; + case 147: break; case 12: { return RegExpTT.DOLLAR; } - case 142: break; - case 59: + case 148: break; + case 61: { if (allowNestedCharacterClasses) return RegExpTT.ANDAND; else yypushback(1); return RegExpTT.CHARACTER; } - case 143: break; - case 50: + case 149: break; + case 51: { if (xmlSchemaMode) return RegExpTT.CHAR_CLASS; else return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; } - case 144: break; - case 42: + case 150: break; + case 43: { return RegExpTT.REDUNDANT_ESCAPE; } - case 145: break; - case 55: + case 151: break; + case 56: { return (allowHexDigitClass || allowHorizontalWhitespaceClass ? RegExpTT.CHAR_CLASS : StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN); } - case 146: break; - case 48: + case 152: break; + case 49: { return yystate() != CLASS2 ? RegExpTT.BOUNDARY : RegExpTT.ESC_CHARACTER; } - case 147: break; + case 153: break; case 22: { yypopstate(); return RegExpTT.RBRACE; } - case 148: break; - case 66: + case 154: break; + case 69: // lookahead expression with fixed base length zzMarkedPos = zzStartRead + 1; { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(NEGATE_CLASS1); return RegExpTT.CLASS_BEGIN; } - case 149: break; - case 61: + case 155: break; + case 64: { yybegin(NAMED_GROUP); capturingGroupCount++; return RegExpTT.RUBY_NAMED_GROUP; } - case 150: break; - case 54: + case 156: break; + case 55: { return StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN; } - case 151: break; - case 53: + case 157: break; + case 54: { return RegExpTT.BAD_HEX_VALUE; } - case 152: break; + case 158: break; case 9: { return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; } - case 153: break; + case 159: break; case 11: { return RegExpTT.CARET; } - case 154: break; - case 45: + case 160: break; + case 46: { return RegExpTT.ESC_CHARACTER; } - case 155: break; - case 76: + case 161: break; + case 79: { if (allowOctalNoLeadingZero) return RegExpTT.OCT_CHAR; if (yystate() == CLASS2) return RegExpTT.ESC_CHARACTER; while (yylength() > 2 && Integer.parseInt(yytext().toString().substring(1)) > capturingGroupCount) { @@ -1027,7 +1053,7 @@ class _RegExLexer implements FlexLexer { } return RegExpTT.BACKREF; } - case 156: break; + case 162: break; default: if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { zzAtEOF = true; diff --git a/RegExpSupport/src/org/intellij/lang/regexp/DefaultRegExpPropertiesProvider.java b/RegExpSupport/src/org/intellij/lang/regexp/DefaultRegExpPropertiesProvider.java index 844a42edb7a0..520d9542668e 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/DefaultRegExpPropertiesProvider.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/DefaultRegExpPropertiesProvider.java @@ -113,6 +113,23 @@ public final class DefaultRegExpPropertiesProvider { {"e", "escape character ('\\u001B')"} }; + private final String[][] myPosixCharacterClasses = { + {"alnum", "Alphanumeric characters"}, + {"alpha", "Alphabetic characters"}, + {"ascii", "ASCII characters"}, + {"blank", "Space and tab"}, + {"cntrl", "Control characters"}, + {"digit", "Digits"}, + {"graph", "Visible characters"}, + {"lower", "Lowercase letters"}, + {"print", "Visible characters and spaces"}, + {"punct", "Punctuation and symbols"}, + {"space", "All whitespace characters, including line breaks"}, + {"upper", "Uppercase letters"}, + {"word", "Word characters (letters, numbers and underscores)"}, + {"xdigit","Hexadecimal digits"}, + }; + private DefaultRegExpPropertiesProvider() { } @@ -157,4 +174,9 @@ public final class DefaultRegExpPropertiesProvider { public String[][] getKnownCharacterClasses() { return myCharacterClasses; } + + @NotNull + public String[][] getPosixCharacterClasses() { + return myPosixCharacterClasses; + } } diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpCapability.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpCapability.java index 51b4dbf53576..906b540e4724 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpCapability.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpCapability.java @@ -28,5 +28,6 @@ public enum RegExpCapability { ALLOW_HEX_DIGIT_CLASS, ALLOW_EMPTY_CHARACTER_CLASS, ALLOW_HORIZONTAL_WHITESPACE_CLASS, - UNICODE_CATEGORY_SHORTHAND + UNICODE_CATEGORY_SHORTHAND, + POSIX_BRACKET_EXPRESSIONS } diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpCompletionContributor.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpCompletionContributor.java index 51f1bd83ba04..6883923b57fb 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpCompletionContributor.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpCompletionContributor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,15 @@ import com.intellij.codeInsight.completion.*; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementBuilder; import com.intellij.codeInsight.lookup.TailTypeDecorator; +import com.intellij.openapi.editor.Document; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.util.TextRange; import com.intellij.patterns.ElementPattern; import com.intellij.psi.PsiElement; import com.intellij.util.PlatformIcons; import com.intellij.util.ProcessingContext; import com.intellij.util.ui.EmptyIcon; +import org.intellij.lang.regexp.psi.RegExpClass; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -47,6 +51,9 @@ public final class RegExpCompletionContributor extends CompletionContributor { final ElementPattern propertyNamePattern = psiElement().afterLeaf(psiElement().withText("{").afterLeaf(propertyPattern)); extend(CompletionType.BASIC, propertyNamePattern, new PropertyNameCompletionProvider()); + + final ElementPattern bracketExpressionPattern = psiElement().afterLeaf(psiElement(RegExpTT.BRACKET_EXPRESSION_BEGIN)); + extend(CompletionType.BASIC, bracketExpressionPattern, new BracketExpressionCompletionProvider()); } { @@ -85,6 +92,34 @@ public final class RegExpCompletionContributor extends CompletionContributor { return LookupElementBuilder.create(name).withTypeText(type).withIcon(icon); } + private static class BracketExpressionCompletionProvider extends CompletionProvider { + + @Override + protected void addCompletions(@NotNull CompletionParameters parameters, + ProcessingContext context, + @NotNull CompletionResultSet result) { + + for (String[] completion : RegExpLanguageHosts.getInstance().getPosixCharacterClasses(parameters.getPosition())) { + result.addElement( + LookupElementBuilder.create(completion[0]).withTypeText((completion.length > 1) ? completion[1] : null).withIcon(emptyIcon) + .withInsertHandler(new InsertHandler() { + @Override + public void handleInsert(InsertionContext context, LookupElement item) { + context.setAddCompletionChar(false); + final Editor editor = context.getEditor(); + final Document document = editor.getDocument(); + final int tailOffset = context.getTailOffset(); + if (document.getTextLength() < tailOffset + 2 || + !document.getText(new TextRange(tailOffset, tailOffset + 2)).equals(":]")) { + document.insertString(tailOffset, ":]"); + } + editor.getCaretModel().moveCaretRelatively(2, 0, false, false, true); + } + })); + } + } + } + private static class PropertyNameCompletionProvider extends CompletionProvider { public void addCompletions(@NotNull final CompletionParameters parameters, diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpElementTypes.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpElementTypes.java index f04b11415bc9..6c3d3c4afcce 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpElementTypes.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpElementTypes.java @@ -38,6 +38,7 @@ public interface RegExpElementTypes { IElementType BOUNDARY = new RegExpElementType("BOUNDARY"); IElementType NAMED_GROUP_REF = new RegExpElementType("NAMED_GROUP_REF"); IElementType PY_COND_REF = new RegExpElementType("PY_COND_REF"); + IElementType POSIX_BRACKET_EXPRESSION = new RegExpElementType("POSIX_BRACKET_EXPRESSION"); TokenSet ATOMS = TokenSet.create(CLOSURE, BOUNDARY, SIMPLE_CLASS, CLASS, CHAR, GROUP, PROPERTY, SET_OPTIONS, BACKREF, NAMED_GROUP_REF); diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java index c4003af8e1ba..5b6351cfb7c9 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java @@ -143,4 +143,8 @@ public final class RegExpLanguageHosts extends ClassExtension capabilities) { this((java.io.Reader)null); @@ -48,6 +49,7 @@ import java.util.EnumSet; this.allowHorizontalWhitespaceClass = capabilities.contains(RegExpCapability.ALLOW_HORIZONTAL_WHITESPACE_CLASS); this.allowEmptyCharacterClass = capabilities.contains(RegExpCapability.ALLOW_EMPTY_CHARACTER_CLASS); this.allowCategoryShorthand = capabilities.contains(RegExpCapability.UNICODE_CATEGORY_SHORTHAND); + this.allowPosixBracketExpressions = capabilities.contains(RegExpCapability.POSIX_BRACKET_EXPRESSIONS); } private void yypushstate(int state) { @@ -84,6 +86,7 @@ import java.util.EnumSet; %xstate QUOTED_NAMED_GROUP %xstate PY_NAMED_GROUP_REF %xstate PY_COND_REF +%xstate BRACKET_EXPRESSION DIGITS=[1-9][0-9]* @@ -96,6 +99,7 @@ LBRACKET="[" RBRACKET="]" ESCAPE="\\" +NAME=[:letter:]([:letter:]|_|[:digit:])* ANY=.|\n META={ESCAPE} | {DOT} | @@ -198,7 +202,7 @@ HEX_CHAR=[0-9a-fA-F] {LBRACE} { if (yystate() != CLASS2) yypushstate(EMBRACED); return RegExpTT.LBRACE; } { - [:letter:]([:letter:]|_|[:digit:])* { return RegExpTT.NAME; } + {NAME} { return RegExpTT.NAME; } [:digit:]+ { return RegExpTT.NUMBER; } "," { return RegExpTT.COMMA; } @@ -251,6 +255,14 @@ HEX_CHAR=[0-9a-fA-F] } { + {LBRACKET} ":" { if (allowPosixBracketExpressions) { + yybegin(BRACKET_EXPRESSION); + return RegExpTT.BRACKET_EXPRESSION_BEGIN; + } else { + yypushback(1); + return RegExpTT.CHARACTER; + } + } {RBRACKET} { yypopstate(); return RegExpTT.CLASS_END; } "&&" { if (allowNestedCharacterClasses) return RegExpTT.ANDAND; else yypushback(1); return RegExpTT.CHARACTER; } @@ -258,6 +270,11 @@ HEX_CHAR=[0-9a-fA-F] {ANY} { return RegExpTT.CHARACTER; } } + { + {NAME} { return RegExpTT.NAME; } + ":" {RBRACKET} { yybegin(CLASS2); return RegExpTT.BRACKET_EXPRESSION_END; } + {ANY} { return RegExpTT.BAD_CHARACTER; } +} { {LPAREN} { capturingGroupCount++; return RegExpTT.GROUP_BEGIN; } @@ -297,26 +314,26 @@ HEX_CHAR=[0-9a-fA-F] } { - [:letter:]([:letter:]|_|[:digit:])* { return RegExpTT.NAME; } + {NAME} { return RegExpTT.NAME; } ">" { yybegin(YYINITIAL); return RegExpTT.GT; } {ANY} { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER; } } { - [:letter:]([:letter:]|_|[:digit:])* { return RegExpTT.NAME; } + {NAME} { return RegExpTT.NAME; } "'" { yybegin(YYINITIAL); return RegExpTT.QUOTE; } {ANY} { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER; } } { - [:letter:]([:letter:]|_|[:digit:])* { return RegExpTT.NAME; } + {NAME} { return RegExpTT.NAME; } ")" { yybegin(YYINITIAL); return RegExpTT.GROUP_END; } {ANY} { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER; } } { - [:letter:]([:letter:]|_|[:digit:])* { return RegExpTT.NAME; } - [:digit:]+ { return RegExpTT.NUMBER; } + {NAME} { return RegExpTT.NAME; } + [:digit:]+ { return RegExpTT.NUMBER; } ")" { yybegin(YYINITIAL); return RegExpTT.GROUP_END; } {ANY} { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER; } } diff --git a/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java b/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java index 06f7614e8d31..dc5f528442d9 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java @@ -24,6 +24,7 @@ import com.intellij.lang.annotation.Annotator; import com.intellij.psi.PsiComment; import com.intellij.psi.PsiElement; import com.intellij.psi.util.PsiTreeUtil; +import com.intellij.util.containers.ContainerUtil; import org.intellij.lang.regexp.RegExpLanguageHosts; import org.intellij.lang.regexp.RegExpTT; import org.intellij.lang.regexp.psi.*; @@ -31,8 +32,11 @@ import org.jetbrains.annotations.NotNull; import java.math.BigInteger; import java.util.HashSet; +import java.util.Set; public final class RegExpAnnotator extends RegExpElementVisitor implements Annotator { + private static final Set POSIX_CHARACTER_CLASSES = ContainerUtil.newHashSet( + "alnum", "alpha", "ascii", "blank", "cntrl", "digit", "graph", "lower", "print", "punct", "space", "upper", "word", "xdigit"); private AnnotationHolder myHolder; private final RegExpLanguageHosts myLanguageHosts; @@ -283,6 +287,17 @@ public final class RegExpAnnotator extends RegExpElementVisitor implements Annot } } + @Override + public void visitPosixBracketExpression(RegExpPosixBracketExpression posixBracketExpression) { + final String className = posixBracketExpression.getClassName(); + if (!POSIX_CHARACTER_CLASSES.contains(className)) { + final Annotation annotation = myHolder.createErrorAnnotation(posixBracketExpression, "Unknown POSIX character class"); + if (annotation != null) { + annotation.setHighlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); + } + } + } + private static void registerFix(Annotation a, IntentionAction action) { if (a != null) { // IDEA-9381 diff --git a/RegExpSupport/test/test/BaseParseTestcase.java b/RegExpSupport/test/org/intellij/lang/regexp/BaseParseTestCase.java similarity index 94% rename from RegExpSupport/test/test/BaseParseTestcase.java rename to RegExpSupport/test/org/intellij/lang/regexp/BaseParseTestCase.java index efb7b4188d6a..4aa9edbf9d4d 100644 --- a/RegExpSupport/test/test/BaseParseTestcase.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/BaseParseTestCase.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package test; +package org.intellij.lang.regexp; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.application.Result; @@ -26,15 +26,14 @@ import com.intellij.testFramework.fixtures.CodeInsightTestFixture; import com.intellij.testFramework.fixtures.IdeaProjectTestFixture; import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory; import com.intellij.testFramework.fixtures.TestFixtureBuilder; -import org.intellij.lang.regexp.RegExpFileType; import java.io.File; -public abstract class BaseParseTestcase extends UsefulTestCase{ +public abstract class BaseParseTestCase extends UsefulTestCase{ protected CodeInsightTestFixture myFixture; @SuppressWarnings({"JUnitTestCaseWithNonTrivialConstructors"}) - public BaseParseTestcase() { + public BaseParseTestCase() { PlatformTestCase.initPlatformLangPrefix(); } diff --git a/RegExpSupport/test/test/ParseTest.java b/RegExpSupport/test/org/intellij/lang/regexp/ParseTest.java similarity index 92% rename from RegExpSupport/test/test/ParseTest.java rename to RegExpSupport/test/org/intellij/lang/regexp/ParseTest.java index 4ab429ad2d38..4ceccc03f2cc 100644 --- a/RegExpSupport/test/test/ParseTest.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/ParseTest.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package test; +package org.intellij.lang.regexp; -public class ParseTest extends BaseParseTestcase { +public class ParseTest extends BaseParseTestCase { //public void test0() throws Throwable { // myFixture.testHighlighting("test0.regexp"); diff --git a/RegExpSupport/test/test/RegExpCompletionTest.java b/RegExpSupport/test/org/intellij/lang/regexp/RegExpCompletionTest.java similarity index 96% rename from RegExpSupport/test/test/RegExpCompletionTest.java rename to RegExpSupport/test/org/intellij/lang/regexp/RegExpCompletionTest.java index 5e90be4a485a..5b128b32699c 100644 --- a/RegExpSupport/test/test/RegExpCompletionTest.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/RegExpCompletionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package test; +package org.intellij.lang.regexp; import com.intellij.openapi.application.PathManager; import com.intellij.testFramework.PlatformTestCase; import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase; import com.intellij.util.ArrayUtil; -import org.intellij.lang.regexp.DefaultRegExpPropertiesProvider; import java.io.File; import java.util.ArrayList; diff --git a/RegExpSupport/test/org/intellij/lang/regexp/RegExpLexerTest.java b/RegExpSupport/test/org/intellij/lang/regexp/RegExpLexerTest.java new file mode 100644 index 000000000000..8650991bd669 --- /dev/null +++ b/RegExpSupport/test/org/intellij/lang/regexp/RegExpLexerTest.java @@ -0,0 +1,63 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.intellij.lang.regexp; + +import com.intellij.lexer.Lexer; +import com.intellij.testFramework.LexerTestCase; + +import java.util.EnumSet; + +/** + * @author Bas Leijdekkers + */ +public class RegExpLexerTest extends LexerTestCase { + + public void testAmpersand() { + final RegExpLexer lexer = new RegExpLexer(EnumSet.noneOf(RegExpCapability.class)); + doTest("[a&&]", "CLASS_BEGIN ('[')\n" + + "CHARACTER ('a')\n" + + "CHARACTER ('&')\n" + + "CHARACTER ('&')\n" + + "CLASS_END (']')", lexer); + } + + public void testIntersection() { + final RegExpLexer lexer = new RegExpLexer(EnumSet.of(RegExpCapability.NESTED_CHARACTER_CLASSES)); + doTest("[a&&]", "CLASS_BEGIN ('[')\n" + + "CHARACTER ('a')\n" + + "ANDAND ('&&')\n" + + "CLASS_END (']')", lexer); + } + + public void testPosixBracketExpression() { + final RegExpLexer lexer = new RegExpLexer(EnumSet.of(RegExpCapability.POSIX_BRACKET_EXPRESSIONS)); + doTest("[[:xdigit:]]", "CLASS_BEGIN ('[')\n" + + "BRACKET_EXPRESSION_BEGIN ('[:')\n" + + "NAME ('xdigit')\n" + + "BRACKET_EXPRESSION_END (':]')\n" + + "CLASS_END (']')", lexer); + } + + @Override + protected Lexer createLexer() { + return null; + } + + @Override + protected String getDirPath() { + return ""; + } +} diff --git a/RegExpSupport/test/test/MainParseTest.java b/RegExpSupport/test/org/intellij/lang/regexp/RegExpParseTest.java similarity index 93% rename from RegExpSupport/test/test/MainParseTest.java rename to RegExpSupport/test/org/intellij/lang/regexp/RegExpParseTest.java index 7b6914ba2b2a..7aa073894522 100644 --- a/RegExpSupport/test/test/MainParseTest.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/RegExpParseTest.java @@ -13,11 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package test; +package org.intellij.lang.regexp; -import org.intellij.lang.regexp.RegExpFileType; -import org.intellij.lang.regexp.RegExpLanguageHost; -import org.intellij.lang.regexp.RegExpLanguageHosts; import org.jdom.Document; import org.jdom.Element; import org.jdom.input.SAXBuilder; @@ -30,7 +27,7 @@ import java.util.Map; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -public class MainParseTest extends BaseParseTestcase { +public class RegExpParseTest extends BaseParseTestCase { private ByteArrayOutputStream myOut; @@ -175,16 +172,19 @@ public class MainParseTest extends BaseParseTestcase { System.out.print("filename = " + name); n++; - final MainParseTest.Test test = myMap.get(name); + final RegExpParseTest.Test test = myMap.get(name); try { if (test.regExpHost != null) { final Class aClass = (Class)Class.forName(test.regExpHost); final RegExpLanguageHost host = aClass.newInstance(); RegExpLanguageHosts.setRegExpHost(host); } - myFixture.configureByText(RegExpFileType.INSTANCE, test.pattern); - myFixture.testHighlighting(test.showWarnings, true, test.showInfo); - RegExpLanguageHosts.setRegExpHost(null); + try { + myFixture.configureByText(RegExpFileType.INSTANCE, test.pattern); + myFixture.testHighlighting(test.showWarnings, true, test.showInfo); + } finally { + RegExpLanguageHosts.setRegExpHost(null); + } if (test.expectedResult == Result.ERR) { System.out.println(" FAILED. Expression incorrectly parsed OK: " + test.pattern); diff --git a/colorSchemes/src/colorSchemes/Darcula.xml b/colorSchemes/src/colorSchemes/Darcula.xml index bf0d584c0771..de43ae57788f 100644 --- a/colorSchemes/src/colorSchemes/Darcula.xml +++ b/colorSchemes/src/colorSchemes/Darcula.xml @@ -126,7 +126,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -