Ruby: Fix regex parsing of /[|]/

This commit is contained in:
Tom Hvitved
2022-03-08 09:50:40 +01:00
parent a7442b7a2b
commit 6d4eecff14
2 changed files with 1 additions and 3 deletions

View File

@@ -861,6 +861,7 @@ abstract class RegExp extends AST::StringlikeLiteral {
* Whether the text in the range start,end is an alternation
*/
predicate alternation(int start, int end) {
not this.inCharSet(start) and
this.topLevel(start, end) and
exists(int less | this.subalternation(start, less, _) and less < end)
}

View File

@@ -181,11 +181,8 @@ regexp.rb:
# 26| [RegExpConstant, RegExpNormalChar] -
# 27| [RegExpCharacterClass] [|]
#-----| 0 -> [RegExpAlt] |
#-----| 0 -> [RegExpConstant, RegExpNormalChar] |
# 27| [RegExpAlt] |
# 27| [RegExpConstant, RegExpNormalChar] |
# 30| [RegExpCharacterClass] [[a-f]