diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-07-09 06:19:03 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-02-25 19:52:28 +0900 |
commit | 9f59a2bd877061594b4af624fe76cc32f9743438 (patch) | |
tree | 84f4db9c0d7f0090dacac4564d9f830d8645b3d4 /ext/date/date_parse.c | |
parent | c19a631c994e3745e821a87cc7eca3f02c33bda7 (diff) |
[ruby/date] Extracted common leading pattern
https://github.com/ruby/date/commit/ec86dbbdc1
Diffstat (limited to 'ext/date/date_parse.c')
-rw-r--r-- | ext/date/date_parse.c | 23 |
1 files 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) { 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*" |