diff options
author | Karl Berry <karl@freefriends.org> | 2019-03-07 22:34:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-03-07 22:34:01 +0000 |
commit | b682c8d31249edfc99eb683210c3b0cfeae5c9f9 (patch) | |
tree | c978cf24a57c170e2413d548af06d7bd518259e6 /Master/texmf-dist/tex/context/base/mkiv/util-prs.lua | |
parent | 2915b13b4b4cd9a3c35eae7122d2b8604cd8b494 (diff) |
context (7mar19)
git-svn-id: svn://tug.org/texlive/trunk@50280 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/util-prs.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/util-prs.lua | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua b/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua index ba73a94813d..3154bf6c28d 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua @@ -774,13 +774,22 @@ end -- print(parsers.splitmethod("{foo}")) -- print(parsers.splitmethod()) +local p_year = lpegpatterns.digit^4 / tonumber + local pattern = Cf( Ct("") * - Cg(Cc("year") * cardinal) - * P("-") * Cg(Cc("month") * cardinal) - * P("-") * Cg(Cc("day") * cardinal) - * P(" ") * Cg(Cc("hour") * cardinal) - * P(":") * Cg(Cc("minute") * cardinal) - * (P(":") * Cg(Cc("sec") * cardinal))^-1 + ( + ( Cg(Cc("year") * p_year) + * S("-/") * Cg(Cc("month") * cardinal) + * S("-/") * Cg(Cc("day") * cardinal) + ) + + ( Cg(Cc("day") * cardinal) + * S("-/") * Cg(Cc("month") * cardinal) + * S("-/") * Cg(Cc("year") * p_year) + ) + ) + * P(" ") * Cg(Cc("hour") * cardinal) + * P(":") * Cg(Cc("min") * cardinal) + * (P(":") * Cg(Cc("sec") * cardinal))^-1 , rawset) lpegpatterns.splittime = pattern @@ -790,3 +799,6 @@ function parsers.totime(str) end -- print(os.time(parsers.totime("2019-03-05 12:12:12"))) +-- print(os.time(parsers.totime("2019/03/05 12:12:12"))) +-- print(os.time(parsers.totime("05-03-2019 12:12:12"))) +-- print(os.time(parsers.totime("05/03/2019 12:12:12"))) |