@@ -52,8 +52,11 @@ describe('parseRegExp', () => {
52
52
[ / [ a - ] / , AST . literal ( CharSet . fromArray ( [ 'a' , '-' ] ) ) ] ,
53
53
// negative char class:
54
54
[ / [ ^ a b c ] / , AST . literal ( CharSet . complement ( CharSet . fromArray ( [ 'a' , 'b' , 'c' ] ) ) ) ] ,
55
+ // regular capturing groups:
56
+ [ / ( ) / , group ( AST . epsilon ) ] ,
55
57
// non-capturing groups
56
58
[ / (?: a b ) / , str ( 'ab' ) ] ,
59
+ [ / (?: ) / , AST . epsilon ] ,
57
60
// named capturing groups
58
61
[ / (?< abc_012_ABC > a b c ) / , group ( str ( 'abc' ) , 'abc_012_ABC' ) ] ,
59
62
[ / (?< ABC > a b c ) / , group ( str ( 'abc' ) , 'ABC' ) ] ,
@@ -63,16 +66,19 @@ describe('parseRegExp', () => {
63
66
[ / a ^ b / , AST . startMarker ( char ( 'a' ) , str ( 'b' ) ) ] ,
64
67
[ / ^ a | ^ b / , AST . union ( AST . startMarker ( undefined , str ( 'a' ) ) , AST . startMarker ( undefined , char ( 'b' ) ) ) ] ,
65
68
[ / ^ a b c $ / , AST . startMarker ( undefined , AST . endMarker ( str ( 'abc' ) , undefined ) ) ] ,
69
+ [ / $ a ^ / , AST . startMarker ( AST . endMarker ( undefined , char ( 'a' ) ) , undefined ) ] ,
66
70
// positive lookahead - now parsed as lookahead AST nodes, not intersections
67
71
[ / (? = a ) b / , AST . positiveLookahead ( char ( 'a' ) , char ( 'b' ) ) ] ,
68
72
[ / (? = a ) (?: b ) / , AST . positiveLookahead ( char ( 'a' ) , char ( 'b' ) ) ] ,
69
73
[ / (? = a ) (? = b ) c / , AST . positiveLookahead ( char ( 'a' ) , AST . positiveLookahead ( char ( 'b' ) , char ( 'c' ) ) ) ] ,
70
74
[ / a (? = b ) c / , AST . concat ( char ( 'a' ) , AST . positiveLookahead ( char ( 'b' ) , char ( 'c' ) ) ) ] ,
71
75
[ / a (? = b ) / , AST . concat ( char ( 'a' ) , AST . positiveLookahead ( char ( 'b' ) , AST . epsilon ) ) ] ,
72
76
[ / a (? = b ) c (? = d ) e / , AST . concat ( char ( 'a' ) , AST . positiveLookahead ( char ( 'b' ) , AST . concat ( char ( 'c' ) , AST . positiveLookahead ( char ( 'd' ) , char ( 'e' ) ) ) ) ) ] ,
77
+ [ / (? = ) / , AST . positiveLookahead ( AST . epsilon , AST . epsilon ) ] ,
73
78
// negative lookahead
74
79
[ / (? ! a ) b / , AST . negativeLookahead ( char ( 'a' ) , char ( 'b' ) ) ] ,
75
80
[ / (? ! a ) b | c / , AST . union ( AST . negativeLookahead ( char ( 'a' ) , char ( 'b' ) ) , char ( 'c' ) ) ] ,
81
+ [ / (? ! ) / , AST . negativeLookahead ( AST . epsilon , AST . epsilon ) ] ,
76
82
// TODO: positive lookbehind
77
83
// [/(?<=a)/, AST.positiveLookbehind(char('a'))],
78
84
// TODO: negative lookbehind
0 commit comments