Ruby: Fix off-by-one error in getGroupName

This commit is contained in:
Tom Hvitved
2022-03-08 13:45:40 +01:00
parent 6dd126b6e3
commit 5f48cc06bb
2 changed files with 4 additions and 4 deletions

View File

@@ -488,7 +488,7 @@ abstract class RegExp extends AST::StringlikeLiteral {
this.group(start, end) and
exists(int nameEnd |
this.namedGroupStart(start, nameEnd) and
result = this.getText().substring(start + 4, nameEnd - 1)
result = this.getText().substring(start + 3, nameEnd - 1)
)
}

View File

@@ -1,7 +1,7 @@
groupName
| regexp.rb:52:2:52:11 | (?<id>\\w+) | d |
| regexp.rb:53:2:53:12 | (?'foo'fo+) | oo |
| regexp.rb:57:2:57:11 | (?<qux>q+) | ux |
| regexp.rb:52:2:52:11 | (?<id>\\w+) | id |
| regexp.rb:53:2:53:12 | (?'foo'fo+) | foo |
| regexp.rb:57:2:57:11 | (?<qux>q+) | qux |
groupNumber
| regexp.rb:46:2:46:6 | (foo) | 1 |
| regexp.rb:47:4:47:8 | (o\|b) | 1 |