[ruby/date] Extracted common leading pattern

https://github.com/ruby/date/commit/ec86dbbdc1
This commit is contained in:
Nobuyoshi Nakada 2021-07-09 06:19:03 +09:00 коммит произвёл git
Родитель c19a631c99
Коммит 9f59a2bd87
1 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -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*"