diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-01 05:21:36 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-01 05:21:36 +0000 |
commit | 744c3140595c34171553515e127d080634704db3 (patch) | |
tree | bf035961359af55737fe4e21375b6773b3b0a43d /ext | |
parent | 367362b9d56bc8d9e5cafaec5abe7c987c4a831c (diff) |
date_parse.c: extract Japanese era initials
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/date/date_parse.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c index 69ac37f0a3..c9f93074b9 100644 --- a/ext/date/date_parse.c +++ b/ext/date/date_parse.c @@ -1212,6 +1212,8 @@ parse_iso2(VALUE str, VALUE hash) return 1; } +#define JAPANESE_ERA_INITIALS "mtshr" + static int gengo(int c) { @@ -1252,11 +1254,11 @@ parse_jis(VALUE str, VALUE hash) { static const char pat_source[] = #ifndef TIGHT_PARSER - "\\b([mtsh])(\\d+)\\.(\\d+)\\.(\\d+)" + "\\b([" JAPANESE_ERA_INITIALS "])(\\d+)\\.(\\d+)\\.(\\d+)" #else BOS FPW_COM FPT_COM - "([mtsh])(\\d+)\\.(\\d+)\\.(\\d+)" + "([" JAPANESE_ERA_INITIALS "])(\\d+)\\.(\\d+)\\.(\\d+)" TEE_FPT COM_FPW EOS #endif @@ -2979,7 +2981,7 @@ static int jisx0301(VALUE str, VALUE hash) { static const char pat_source[] = - "\\A\\s*([mtsh])?(\\d{2})\\.(\\d{2})\\.(\\d{2})" + "\\A\\s*([" JAPANESE_ERA_INITIALS "])?(\\d{2})\\.(\\d{2})\\.(\\d{2})" "(?:t" "(?:(\\d{2}):(\\d{2})(?::(\\d{2})(?:[,.](\\d*))?)?" "(z|[-+]\\d{2}(?::?\\d{2})?)?)?)?\\s*\\z"; |