File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,56 @@ describe('extended', () => {
101
101
} ,
102
102
flags : 'x'
103
103
} ) ;
104
+ } ) ;
105
+
106
+ it ( 'escaped space and # with x flag' , ( ) => {
107
+ const re = '/\\ \\#/x' ;
108
+
109
+ expect ( parser . parse ( re ) ) . toEqual ( {
110
+ type : 'RegExp' ,
111
+ body : {
112
+ type : 'Alternative' ,
113
+ expressions : [
114
+ {
115
+ type : 'Char' ,
116
+ value : ' ' ,
117
+ kind : 'simple' ,
118
+ escaped : true ,
119
+ } ,
120
+ {
121
+ type : 'Char' ,
122
+ value : '#' ,
123
+ kind : 'simple' ,
124
+ escaped : true ,
125
+ } ,
126
+ ] ,
127
+ } ,
128
+ flags : 'x'
129
+ } ) ;
130
+ } ) ;
131
+
132
+ it ( 'non-escaped space and # in class with x flag' , ( ) => {
133
+ const re = '/[ #]/x' ;
104
134
135
+ expect ( parser . parse ( re ) ) . toEqual ( {
136
+ type : 'RegExp' ,
137
+ body : {
138
+ type : 'CharacterClass' ,
139
+ expressions : [
140
+ {
141
+ type : 'Char' ,
142
+ value : ' ' ,
143
+ kind : 'simple' ,
144
+ } ,
145
+ {
146
+ type : 'Char' ,
147
+ value : '#' ,
148
+ kind : 'simple' ,
149
+ } ,
150
+ ] ,
151
+ } ,
152
+ flags : 'x'
153
+ } ) ;
105
154
} ) ;
106
155
107
156
} ) ;
You can’t perform that action at this time.
0 commit comments