summaryrefslogtreecommitdiff
path: root/version.h
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2023-01-31 15:28:01 +0900
committerNARUSE, Yui <naruse@airemix.jp>2023-01-31 15:28:01 +0900
commitca75332f46c39804e06cd37c2608cbdef0aebf05 (patch)
tree1f185f23ff0e2349a56b2ac4ea109635df71ea85 /version.h
parent5a2b28909ece2e1310250180f097bfcb7b0203dc (diff)
merge revision(s) eccfc978fd6f65332eb70c9a46fbb4d5110bbe0a: [Backport #19379]
Fix parsing of regexps that toggle extended mode on/off inside regexp This was broken in ec3542229b29ec93062e9d90e877ea29d3c19472. That commit didn't handle cases where extended mode was turned on/off inside the regexp. There are two ways to turn extended mode on/off: ``` /(?-x:#y)#z /x =~ '#y' /(?-x)#y(?x)#z /x =~ '#y' ``` These can be nested inside the same regexp: ``` /(?-x:(?x)#x (?-x)#y)#z /x =~ '#y' ``` As you can probably imagine, this makes handling these regexps somewhat complex. Due to the nesting inside portions of regexps, the unassign_nonascii function needs to be recursive. In recursive mode, it needs to track both opening and closing parentheses, similar to how it already tracked opening and closing brackets for character classes. When scanning the regexp and coming to `(?` not followed by `#`, scan for options, and use `x` and `i` to determine whether to turn on or off extended mode. For `:`, indicting only the current regexp section should have the extended mode switched, recurse with the extended mode set or unset. For `)`, indicating the remainder of the regexp (or current regexp portion if already recursing) should turn extended mode on or off, just change the extended mode flag and keep scanning. While testing this, I noticed that `a`, `d`, and `u` are accepted as options, in addition to `i`, `m`, and `x`, but I can't see where those options are documented. I'm not sure whether or not handling `a`, `d`, and `u` as options is a bug. Fixes [Bug #19379] --- re.c | 153 +++++++++++++++++++++++++++++++++++++---------- test/ruby/test_regexp.rb | 56 +++++++++++++++++ 2 files changed, 176 insertions(+), 33 deletions(-)
Diffstat (limited to 'version.h')
-rw-r--r--version.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/version.h b/version.h
index a26c469164..2dc130ab2b 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 23
+#define RUBY_PATCHLEVEL 24
#include "ruby/version.h"
#include "ruby/internal/abi.h"