ruby-changes:55190
From: nobu <ko1@a...>
Date: Mon, 1 Apr 2019 14:21:41 +0900 (JST)
Subject: [ruby-changes:55190] nobu:r67397 (trunk): date_parse.c: extract Japanese era initials
nobu 2019-04-01 14:21:36 +0900 (Mon, 01 Apr 2019) New Revision: 67397 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67397 Log: date_parse.c: extract Japanese era initials Modified files: trunk/ext/date/date_parse.c Index: ext/date/date_parse.c =================================================================== --- ext/date/date_parse.c (revision 67396) +++ ext/date/date_parse.c (revision 67397) @@ -1212,6 +1212,8 @@ parse_iso2(VALUE str, VALUE hash) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L1212 return 1; } +#define JAPANESE_ERA_INITIALS "mtshr" + static int gengo(int c) { @@ -1252,11 +1254,11 @@ parse_jis(VALUE str, VALUE hash) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L1254 { 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 https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L2981 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"; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/