@@ -42,22 +42,51 @@ class QRegex::P5Regex::Actions is HLL::Actions {
42
42
$ ast . unshift ($ qast );
43
43
$ qast := $ ast ;
44
44
}
45
- $ qast . backtrack(' r' ) if $ qast && ! $ qast . backtrack &&
46
- (% * RX <r > || $ < backmod > && ~ $ < backmod > [0 ] eq ' :' );
45
+ $ qast . backtrack(' r' ) if $ qast && ! $ qast . backtrack && % * RX <r >;
47
46
make $ qast ;
48
47
}
49
48
50
49
method atom ($/ ) {
51
50
if $ < metachar > {
52
51
make $ < metachar > . ast;
53
52
}
53
+ elsif $ < esc > {
54
+ my $ qast := QAST ::Regex. new ( ~ $ < esc > , : rxtype<literal >, : node($/ ));
55
+ make $ qast ;
56
+ }
54
57
else {
55
58
my $ qast := QAST ::Regex. new ( ~ $/ , : rxtype<literal >, : node($/ ));
56
59
$ qast . subtype(' ignorecase' ) if % * RX <i >;
57
60
make $ qast ;
58
61
}
59
62
}
63
+
64
+ method p5metachar :sym <bs >($/ ) {
65
+ make $ < backslash > . ast;
66
+ }
67
+
68
+ method p5metachar :sym <. >($/ ) {
69
+ make QAST ::Regex. new ( : rxtype<cclass >, : subtype<. >, : node($/ ) );
70
+ }
71
+
72
+ method p5metachar :sym <^ >($/ ) {
73
+ make QAST ::Regex. new ( : rxtype<anchor >, : subtype<bos >, : node($/ ) );
74
+ }
75
+
76
+ method p5metachar :sym <$ >($/ ) {
77
+ make QAST ::Regex. new (
78
+ : rxtype(' concat' ),
79
+ QAST ::Regex. new (
80
+ : rxtype(' quant' ), : min (0 ), : max (1 ),
81
+ QAST ::Regex. new ( : rxtype(' literal' ), " \n " )
82
+ ),
83
+ QAST ::Regex. new ( : rxtype<anchor >, : subtype<eos >, : node($/ ) )
84
+ );
85
+ }
60
86
87
+
88
+ # XXX Below here copied from p6regex; needs review
89
+
61
90
method quantifier :sym <* >($/ ) {
62
91
my $ qast := QAST ::Regex. new ( : rxtype<quant >, : min (0 ), : max (-1 ), : node($/ ) );
63
92
make backmod($ qast , $ < backmod > );
@@ -117,26 +146,6 @@ class QRegex::P5Regex::Actions is HLL::Actions {
117
146
make $ qast ;
118
147
}
119
148
120
- method metachar :sym <. >($/ ) {
121
- make QAST ::Regex. new ( : rxtype<cclass >, : subtype<. >, : node($/ ) );
122
- }
123
-
124
- method metachar :sym <^ >($/ ) {
125
- make QAST ::Regex. new ( : rxtype<anchor >, : subtype<bos >, : node($/ ) );
126
- }
127
-
128
- method metachar :sym <^^ >($/ ) {
129
- make QAST ::Regex. new ( : rxtype<anchor >, : subtype<bol >, : node($/ ) );
130
- }
131
-
132
- method metachar :sym <$ >($/ ) {
133
- make QAST ::Regex. new ( : rxtype<anchor >, : subtype<eos >, : node($/ ) );
134
- }
135
-
136
- method metachar :sym <$$ >($/ ) {
137
- make QAST ::Regex. new ( : rxtype<anchor >, : subtype<eol >, : node($/ ) );
138
- }
139
-
140
149
method metachar :sym <lwb >($/ ) {
141
150
make QAST ::Regex. new ( : rxtype<anchor >, : subtype<lwb >, : node($/ ) );
142
151
}
@@ -157,10 +166,6 @@ class QRegex::P5Regex::Actions is HLL::Actions {
157
166
: name<$!to >, PAST::Node. new (' !LITERAL' , ' ' ), : node($/ ) );
158
167
}
159
168
160
- method metachar :sym <bs >($/ ) {
161
- make $ < backslash > . ast;
162
- }
163
-
164
169
method metachar :sym <assert >($/ ) {
165
170
make $ < assertion > . ast;
166
171
}
0 commit comments