@@ -3,36 +3,41 @@ class QRegex::P5Regex::Actions is HLL::Actions {
3
3
make qbuildsub($ < nibbler > . ast, : anon(1 ), : addself(1 ));
4
4
}
5
5
6
- method nibbler ($/ ) { make $ < termaltseq > . ast }
6
+ method nibbler ($/ ) { make $ < alternation > . ast }
7
7
8
- method termaltseq ($/ ) {
9
- my $ qast := $ < termish > [0 ]. ast;
10
- if + $ < termish > > 1 {
8
+ method alternation ($/ ) {
9
+ my $ qast := $ < sequence > [0 ]. ast;
10
+ if + $ < sequence > > 1 {
11
11
$ qast := QAST ::Regex. new ( : rxtype<altseq >, : node($/ ) );
12
- for $ < termish > { $ qast . push ($ _ . ast); }
12
+ for $ < sequence > { $ qast . push ($ _ . ast); }
13
13
}
14
14
make $ qast ;
15
15
}
16
16
17
- method termish ($/ ) {
18
- my $ qast := QAST ::Regex. new ( : rxtype<concat >, : node($/ ) );
19
- my $ lastlit := 0 ;
20
- for $ < noun > {
21
- my $ ast := $ _ . ast;
22
- if $ ast {
23
- if $ lastlit && $ ast . rxtype eq ' literal'
24
- && ! QAST ::Node. ACCEPTS ($ ast [0 ]) {
25
- $ lastlit [0 ] := $ lastlit [0 ] ~ $ ast [0 ];
26
- }
27
- else {
28
- $ qast . push ($ _ . ast);
29
- $ lastlit := $ ast . rxtype eq ' literal'
30
- && ! QAST ::Node. ACCEPTS ($ ast [0 ])
31
- ?? $ ast !! 0 ;
17
+ method sequence ($/ ) {
18
+ if $ < quantified_atom > {
19
+ my $ qast := QAST ::Regex. new ( : rxtype<concat >, : node($/ ) );
20
+ my $ lastlit := 0 ;
21
+ for $ < quantified_atom > {
22
+ my $ ast := $ _ . ast;
23
+ if $ ast {
24
+ if $ lastlit && $ ast . rxtype eq ' literal'
25
+ && ! QAST ::Node. ACCEPTS ($ ast [0 ]) {
26
+ $ lastlit [0 ] := $ lastlit [0 ] ~ $ ast [0 ];
27
+ }
28
+ else {
29
+ $ qast . push ($ _ . ast);
30
+ $ lastlit := $ ast . rxtype eq ' literal'
31
+ && ! QAST ::Node. ACCEPTS ($ ast [0 ])
32
+ ?? $ ast !! 0 ;
33
+ }
32
34
}
33
35
}
36
+ make $ qast ;
37
+ }
38
+ else {
39
+ make QAST ::Regex. new ( : rxtype<anchor >, : name<pass >, : node($/ ) );
34
40
}
35
- make $ qast ;
36
41
}
37
42
38
43
method quantified_atom ($/ ) {
@@ -86,9 +91,7 @@ class QRegex::P5Regex::Actions is HLL::Actions {
86
91
87
92
method p5metachar :sym < ( )> ($/ ) {
88
93
make QAST ::Regex. new ( : rxtype<subcapture >, : node($/ ),
89
- $ < nibbler >
90
- ?? $ < nibbler > [0 ]. ast
91
- !! QAST ::Regex. new ( : rxtype<anchor >, : subtype<pass > ) );
94
+ $ < nibbler > . ast );
92
95
}
93
96
94
97
method p5metachar :sym < [ ]> ($/ ) {
0 commit comments