You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix: allow more than one regex in a query (#60)
A query may hold only one regex. Two are reported as ambiguous, and where only
one reading parses, a regex silently swallows the rest of the query instead:
parse('name:/foo/ name:/bar/') // LiqeError: Ambiguous results.
parse('name:/foo/ bar/') // one regex, body "foo/ bar"
`regex_body_char` accepts any character but a backslash, so a forward slash can
sit inside a body as well as close it. Both readings of a query holding two
slashes are valid, which the parser reports as ambiguous, or accepts as the
wrong one where the other does not parse.
A body now ends at the first unescaped slash, as in JavaScript, where a literal
slash is written `\\/`. A character class is read as a unit, so `/[/]/` keeps
working unescaped. Escapes are unaffected: `\\/` and `\\\\` are matched by the
rules added in #50.
The only form that changes meaning is an unescaped slash inside a body, as in
`/a/b/`. It is undocumented, untested, and invalid in JavaScript, where it reads
as the regex `/a/` followed by the flag `b`.