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
This commit is contained in:
parent
034b23ed3e
commit
e4107c4554
1 changed files with 2 additions and 2 deletions
4
toml.c
4
toml.c
|
@ -1768,7 +1768,7 @@ static int scan_string(context_t *ctx, char *p, int lineno, int dotisspecial) {
|
||||||
/* check for timestamp without quotes */
|
/* check for timestamp without quotes */
|
||||||
if (0 == scan_date(p, 0, 0, 0) || 0 == scan_time(p, 0, 0, 0)) {
|
if (0 == scan_date(p, 0, 0, 0) || 0 == scan_time(p, 0, 0, 0)) {
|
||||||
// forward thru the timestamp
|
// forward thru the timestamp
|
||||||
p += strspn(p, "0123456789.:+-T Z");
|
p += strspn(p, "0123456789.:+-Tt Zz");
|
||||||
// squeeze out any spaces at end of string
|
// squeeze out any spaces at end of string
|
||||||
for (; p[-1] == ' '; p--)
|
for (; p[-1] == ' '; p--)
|
||||||
;
|
;
|
||||||
|
@ -1984,7 +1984,7 @@ int toml_rtots(toml_raw_t src_, toml_timestamp_t *ret) {
|
||||||
p += 10;
|
p += 10;
|
||||||
if (*p) {
|
if (*p) {
|
||||||
// parse the T or space separator
|
// parse the T or space separator
|
||||||
if (*p != 'T' && *p != ' ')
|
if (*p != 'T' && *p != 't' && *p != ' ')
|
||||||
return -1;
|
return -1;
|
||||||
must_parse_time = 1;
|
must_parse_time = 1;
|
||||||
p++;
|
p++;
|
||||||
|
|
Loading…
Reference in a new issue