regex-syntax
Hir should merge alternation of Class & Literal into Class
#1001
Labels
regex-syntax
Hir should merge alternation of Class & Literal into Class
#1001
What version of regex are you using?
0.7.2
Describe the bug at a high level.
When you have a HirKind::Class and a HirKind::Literal and you join the two, I expect it to be a Class to reduce the syntax tree layers.
What are the steps to reproduce the behavior?
What is the actual behavior?
It's added into a whole new HirKind::Alternation.
What is the expected behavior?
We already have the optimization of simplifying
a|b|c
into[abc]
, but I would like to see(?:(?:a|b)|c)
to also be simplified to[abc]
.Context
I am writing a "composable regex" library to allow users to combine pieces of regexes with
|
,+
,*
,?
to make regexes more maintainable. When I write test cases I realized the output Hir's are not optimal.The text was updated successfully, but these errors were encountered: