Skip to content

Commit 25114a3

Browse files
authored
Merge pull request #540 from Altai-man/master
Parse |, ||, &, && prefixes not in nibble
2 parents 1b0f3bd + 5276e89 commit 25114a3

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
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
}

t/qregex/rx_metachars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ b& bcd [Null regex] conjunction (&) - null right arg illegal
102102
& & [Null regex] conjunction (&) - literal must be escaped
103103
a&|b a&|b [Null regex] alternation and conjunction (&|) - parse error
104104
& & [Null regex] conjunction (&) - literal must be escaped
105-
a|&b a|&b [Null regex] alternation and conjunction (|&) - parse error
105+
a|&b a|&b y alternation and conjunction (|&) - leading & inside | is okay
106106
|d|b abc y leading alternation ignored
107107
|d|b abc y leading alternation ignored
108108
|d |b abc y leading alternation ignored

0 commit comments

Comments
 (0)