Fix parsing of quantifiers with no upper bound
This commit is contained in:
parent
44ebabda0c
commit
d4264d6191
2 changed files with 5 additions and 2 deletions
|
|
@ -121,7 +121,7 @@ class PatternParser {
|
|||
vector<Rule> optional_entries(max_count - min_count, Rule::choice({result, Blank{}}));
|
||||
entries.insert(entries.end(), optional_entries.begin(), optional_entries.end());
|
||||
} else if (has_comma) {
|
||||
entries.push_back(Rule::repeat(result));
|
||||
entries.push_back(Rule::choice({Rule::repeat(result), Blank{} }));
|
||||
}
|
||||
result = Rule::seq(entries);
|
||||
} else if (max_repeat_string.size()) {
|
||||
|
|
|
|||
|
|
@ -305,7 +305,10 @@ describe("parse_regex", []() {
|
|||
CharacterSet{{' '}},
|
||||
Rule::seq({
|
||||
CharacterSet{{'b'}},
|
||||
Repeat{CharacterSet{{'b'}}},
|
||||
Rule::choice({
|
||||
Repeat{CharacterSet{{'b'}}},
|
||||
Blank{}
|
||||
}),
|
||||
}),
|
||||
CharacterSet{{' '}},
|
||||
Rule::seq({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue