-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syntax: fix handling of (?flags) in parser
This commit fixes a bug with the handling of `(?flags)` sub-expressions in the parser. Previously, the parser read `(?flags)`, added it to the current concatenation, and then treat that as a valid sub-expression for repetition operators, as in `(?i)*`. This in turn caused the translator to panic on a failed assumption: that witnessing a repetition operator necessarily implies a preceding sub-expression. But `(?i)` has no explicit represents in the HIR, so there is no sub-expression. There are two legitimate ways to fix this: 1. Ban such constructions in the parser. 2. Remove the assumption in the translator, and/or always translate a `(?i)` into an empty sub-expression, which should generally be a no-op. This commit chooses (1) because it is more conservative. That is, it turns a panic into an error, which gives us flexibility in the future to choose (2) if necessary. Fixes #465
- Loading branch information
1 parent
d0ab70f
commit 17764ff
Showing
3 changed files
with
19 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters