1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/date] Use possessive match

Reduce backtracks at the same character classes arounding an
optional pattern.

https://github.com/ruby/date/commit/1fd15f7c49
This commit is contained in:
Nobuyoshi Nakada 2021-07-09 06:35:58 +09:00 committed by git
parent 9f59a2bd87
commit c8cddac45c

View file

@ -922,8 +922,8 @@ parse_us(VALUE str, VALUE hash)
COM_FPT
#endif
"(?:"
"\\s*,?"
"\\s*"
"\\s*+,?"
"\\s*+"
#ifndef TIGHT_PARSER
"(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|a(?:d|\\.d\\.)|b(?:c|\\.c\\.))?"
"\\s*"