ruby-changes:71275
From: Nobuyoshi <ko1@a...>
Date: Fri, 25 Feb 2022 19:52:46 +0900 (JST)
Subject: [ruby-changes:71275] 9f59a2bd87 (master): [ruby/date] Extracted common leading pattern
https://git.ruby-lang.org/ruby.git/commit/?id=9f59a2bd87 From 9f59a2bd877061594b4af624fe76cc32f9743438 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 9 Jul 2021 06:19:03 +0900 Subject: [ruby/date] Extracted common leading pattern https://github.com/ruby/date/commit/ec86dbbdc1 --- ext/date/date_parse.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c index 5fa036ed72..91e294e4aa 100644 --- a/ext/date/date_parse.c +++ b/ext/date/date_parse.c @@ -652,24 +652,27 @@ parse_time(VALUE str, VALUE hash) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L652 { static const char pat_source[] = "(" + "\\d+\\s*" "(?:" - "\\d+\\s*:\\s*\\d+" "(?:" + ":\\s*\\d+" + "(?:" #ifndef TIGHT_PARSER - "\\s*:\\s*\\d+(?:[,.]\\d*)?" + "\\s*:\\s*\\d+(?:[,.]\\d*)?" #else - "\\s*:\\s*\\d+(?:[,.]\\d+)?" + "\\s*:\\s*\\d+(?:[,.]\\d+)?" #endif + ")?" + "|" + "h(?:\\s*\\d+m?(?:\\s*\\d+s?)?)?" + ")" + "(?:" + "\\s*" + "[ap](?:m\\b|\\.m\\.)" ")?" "|" - "\\d+\\s*h(?:\\s*\\d+m?(?:\\s*\\d+s?)?)?" - ")" - "(?:" - "\\s*" "[ap](?:m\\b|\\.m\\.)" - ")?" - "|" - "\\d+\\s*[ap](?:m\\b|\\.m\\.)" + ")" ")" "(?:" "\\s*" -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/