From e4107c455491925b8982c22df1ce37c0ccb7d4e4 Mon Sep 17 00:00:00 2001 From: Kamil Giszczak Date: Wed, 27 Jul 2022 21:06:50 +0200 Subject: [PATCH] Allow to use 't' (lower case T) as a date-time delimiter (#76) as specified by TOML ABNF grammar: https://github.com/toml-lang/toml/blob/1.0.0/toml.abnf#L169 --- toml.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toml.c b/toml.c index fafe0da..2f4dc03 100644 --- a/toml.c +++ b/toml.c @@ -1768,7 +1768,7 @@ static int scan_string(context_t *ctx, char *p, int lineno, int dotisspecial) { /* check for timestamp without quotes */ if (0 == scan_date(p, 0, 0, 0) || 0 == scan_time(p, 0, 0, 0)) { // forward thru the timestamp - p += strspn(p, "0123456789.:+-T Z"); + p += strspn(p, "0123456789.:+-Tt Zz"); // squeeze out any spaces at end of string for (; p[-1] == ' '; p--) ; @@ -1984,7 +1984,7 @@ int toml_rtots(toml_raw_t src_, toml_timestamp_t *ret) { p += 10; if (*p) { // parse the T or space separator - if (*p != 'T' && *p != ' ') + if (*p != 'T' && *p != 't' && *p != ' ') return -1; must_parse_time = 1; p++;