Import timelib 2022.08

This commit is contained in:
Derick Rethans 2023-07-11 15:59:35 +01:00
parent 47b7570f07
commit c02ac26685
3 changed files with 22784 additions and 23886 deletions

File diff suppressed because it is too large Load diff

View file

@ -661,9 +661,20 @@ static timelib_long timelib_get_month(const char **ptr)
static void timelib_eat_spaces(const char **ptr) static void timelib_eat_spaces(const char **ptr)
{ {
while (**ptr == ' ' || **ptr == '\t') { do {
if (**ptr == ' ' || **ptr == '\t') {
++*ptr; ++*ptr;
continue;
} }
if ((*ptr)[0] == '\xe2' && (*ptr)[1] == '\x80' && (*ptr)[2] == '\xaf') { // NNBSP
*ptr += 3;
continue;
}
if ((*ptr)[0] == '\xc2' && (*ptr)[1] == '\xa0') { // NBSP
*ptr += 2;
continue;
}
} while (false);
} }
static void timelib_eat_until_separator(const char **ptr) static void timelib_eat_until_separator(const char **ptr)
@ -992,7 +1003,9 @@ std:
/*!re2c /*!re2c
any = [\000-\377]; any = [\000-\377];
space = [ \t]+; nbsp = [\302][\240];
nnbsp = [\342][\200][\257];
space = [ \t]+ | nbsp+ | nnbsp+;
frac = "."[0-9]+; frac = "."[0-9]+;
ago = 'ago'; ago = 'ago';
@ -1318,6 +1331,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfulls|dayfull|dayabbr)
s->time->s = timelib_get_nr(&ptr, 2); s->time->s = timelib_get_nr(&ptr, 2);
} }
} }
timelib_eat_spaces(&ptr);
s->time->h += timelib_meridian(&ptr, s->time->h); s->time->h += timelib_meridian(&ptr, s->time->h);
TIMELIB_DEINIT; TIMELIB_DEINIT;
return TIMELIB_TIME12; return TIMELIB_TIME12;
@ -1745,6 +1759,9 @@ weekdayof = (reltextnumber|reltexttext) space (dayfulls|dayfull|dayabbr)
s->time->h = timelib_get_nr(&ptr, 2); s->time->h = timelib_get_nr(&ptr, 2);
s->time->i = timelib_get_nr(&ptr, 2); s->time->i = timelib_get_nr(&ptr, 2);
s->time->s = timelib_get_nr(&ptr, 2); s->time->s = timelib_get_nr(&ptr, 2);
timelib_eat_spaces(&ptr);
s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper); s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
if (tz_not_found) { if (tz_not_found) {
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database"); add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
@ -1858,6 +1875,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfulls|dayfull|dayabbr)
DEBUG_OUTPUT("tzcorrection | tz"); DEBUG_OUTPUT("tzcorrection | tz");
TIMELIB_INIT; TIMELIB_INIT;
TIMELIB_HAVE_TZ(); TIMELIB_HAVE_TZ();
timelib_eat_spaces(&ptr);
s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper); s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
if (tz_not_found) { if (tz_not_found) {
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database"); add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
@ -1936,7 +1954,12 @@ weekdayof = (reltextnumber|reltexttext) space (dayfulls|dayfull|dayabbr)
return TIMELIB_RELATIVE; return TIMELIB_RELATIVE;
} }
[ .,\t] [.,]
{
goto std;
}
space
{ {
goto std; goto std;
} }

View file

@ -30,9 +30,9 @@
# include "timelib_config.h" # include "timelib_config.h"
#endif #endif
#define TIMELIB_VERSION 202207 #define TIMELIB_VERSION 202208
#define TIMELIB_EXTENDED_VERSION 20220701 #define TIMELIB_EXTENDED_VERSION 20220801
#define TIMELIB_ASCII_VERSION "2022.07" #define TIMELIB_ASCII_VERSION "2022.08"
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>