Skip to content

Commit e49a70e

Browse files
committed
Parse |, ||, &, && prefixes not in nibble
But in an appropriate regexes. It is needed for precedence like https://github.com/perl6/roast/blob/master/S05-mass/rx.t#L828 to work, which worked before due to a mis-parse. jnthn++ for the actual fix.
1 parent 446765f commit e49a70e

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/QRegex/P6Regex/Grammar.nqp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,6 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
132132
for $OLDRX { %*RX{$_.key} := $_.value; }
133133
}
134134
<.ws>
135-
[
136-
<!rxstopper>
137-
[
138-
| '||' { $*SEQ := 1; }
139-
| '|'
140-
| '&&'
141-
| '&'
142-
] <.ws>
143-
]?
144135
<termseq>
145136
[
146137
|| <?infixstopper>
@@ -168,21 +159,25 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
168159
}
169160

170161
token termaltseq {
162+
[ <!rxstopper> '||' { $*SEQ := 1; } <.ws> ]?
171163
<termconjseq>
172164
[ <!infixstopper> '||' <.ws> { $*SEQ := 1; } <termconjseq> ]*
173165
}
174166

175167
token termconjseq {
168+
[ <!rxstopper> '&&' { $*SEQ := 0; } <.ws> ]?
176169
<termalt>
177170
[ <!infixstopper> '&&' <.ws> { $*SEQ := 0; } <termalt> ]*
178171
}
179172

180173
token termalt {
174+
[ <!rxstopper> '|' <.ws> ]?
181175
<termconj>
182176
[ <!infixstopper> '|' <![|]> <.ws> { $*SEQ := 0; } <termconj> ]*
183177
}
184178

185179
token termconj {
180+
[ <!rxstopper> '&' <.ws> ]?
186181
<termish>
187182
[ <!infixstopper> '&' <![&]> <.ws> { $*SEQ := 0; } <termish> ]*
188183
}

0 commit comments

Comments
 (0)