Skip to content

Commit 52a81c0

Browse files
committed
Some <before...> simplification in P6Regex grammar
There's a few other places we could in theory do it, but they break tests, it seems. This one is the big win, anyway.
1 parent 7c9689a commit 52a81c0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/QRegex/P6Regex/Grammar.nqp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
5757

5858
token ws { [ \s+ | '#' \N* ]* }
5959

60-
token normspace { <?before \s | '#' > <.ws> }
60+
token normspace { <?[\s#]> <.ws> }
6161

6262
token identifier { <.ident> [ <[\-']> <.ident> ]* }
6363

@@ -107,7 +107,7 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
107107
[
108108
| <?before <[\) \} \]]> >
109109
| <?before '>' <-[>]> >
110-
| <?before <rxstopper> >
110+
| <?rxstopper>
111111
]
112112
}
113113

@@ -125,12 +125,12 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
125125

126126
token termalt {
127127
<termconj>
128-
[ <!before <rxstopper> > '|' <![|]> [ { $*SEQ := 0; } <termconj> || <.throw_null_pattern> ] ]*
128+
[ <!rxstopper> '|' <![|]> [ { $*SEQ := 0; } <termconj> || <.throw_null_pattern> ] ]*
129129
}
130130

131131
token termconj {
132132
<termish>
133-
[ <!before <rxstopper> > '&' <![&]> [ { $*SEQ := 0; } <termish> || <.throw_null_pattern> ] ]*
133+
[ <!rxstopper> '&' <![&]> [ { $*SEQ := 0; } <termish> || <.throw_null_pattern> ] ]*
134134
}
135135

136136
token termish {
@@ -143,7 +143,7 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
143143
<!rxstopper>
144144
<atom>
145145
[
146-
<.ws> [ <!before <rxstopper> > <quantifier> | <?before ':'> <backmod> <!alpha> ]
146+
<.ws> [ <!rxstopper> <quantifier> | <?before ':'> <backmod> <!alpha> ]
147147
[ <.ws> <separator> ]**0..1
148148
]**0..1
149149
}
@@ -208,7 +208,7 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
208208
token metachar:sym<bs> { \\ <backslash> }
209209
token metachar:sym<mod> { <mod_internal> }
210210
token metachar:sym<quantifier> {
211-
<!before <rxstopper> > <quantifier> <.panic: 'Quantifier quantifies nothing'>
211+
<!rxstopper> <quantifier> <.panic: 'Quantifier quantifies nothing'>
212212
}
213213

214214
## we cheat here, really should be regex_infix:sym<~>

0 commit comments

Comments
 (0)