File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -694,6 +694,9 @@ parse_time(VALUE str, VALUE hash)
694
694
#endif
695
695
}
696
696
697
+ #define BEGIN_ERA "\\b"
698
+ #define END_ERA "(?!(?<!\\.)[a-z])"
699
+
697
700
#ifdef TIGHT_PARSER
698
701
static int
699
702
parse_era1_cb (VALUE m , VALUE hash )
@@ -705,7 +708,7 @@ static int
705
708
parse_era1 (VALUE str , VALUE hash )
706
709
{
707
710
static const char pat_source [] =
708
- "(a(?:d|\\.d\\.))" ;
711
+ BEGIN_ERA "(a(?:d\\b |\\.d\\.))" END_ERA ;
709
712
static VALUE pat = Qnil ;
710
713
711
714
REGCOMP_I (pat );
@@ -727,8 +730,9 @@ parse_era2_cb(VALUE m, VALUE hash)
727
730
static int
728
731
parse_era2 (VALUE str , VALUE hash )
729
732
{
730
- static const char pat_source [] =
731
- "(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|b(?:c|\\.c\\.))" ;
733
+ static const char pat_source [] = BEGIN_ERA
734
+ "(c(?:e\\b|\\.e\\.)|b(?:ce\\b|\\.c\\.e\\.)|b(?:c\\b|\\.c\\.))"
735
+ END_ERA ;
732
736
static VALUE pat = Qnil ;
733
737
734
738
REGCOMP_I (pat );
@@ -845,7 +849,11 @@ parse_eu(VALUE str, VALUE hash)
845
849
"(?:"
846
850
"\\s*"
847
851
#ifndef TIGHT_PARSER
848
- "(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|a(?:d|\\.d\\.)|b(?:c|\\.c\\.))?"
852
+ "(?:"
853
+ BEGIN_ERA
854
+ "(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|a(?:d|\\.d\\.)|b(?:c|\\.c\\.))"
855
+ END_ERA
856
+ ")?"
849
857
"\\s*"
850
858
"('?-?\\d+(?:(?:st|nd|rd|th)\\b)?)"
851
859
#else
You can’t perform that action at this time.
0 commit comments