diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-09-30 18:22:48 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-09-30 18:22:48 +0400 |
commit | c18578632fd3c9e513e613a86ba2b7c4ebee6c45 (patch) | |
tree | 377f4d4e3f0a6471a5012126078fcd97f4c67242 /lib/parse-datetime.c | |
parent | 974ab3dd887985e3aa347f3c6521f819296396a0 (diff) | |
download | coreutils-c18578632fd3c9e513e613a86ba2b7c4ebee6c45.tar.gz |
Imported Upstream version 8.23upstream/8.23
Diffstat (limited to 'lib/parse-datetime.c')
-rw-r--r-- | lib/parse-datetime.c | 1004 |
1 files changed, 485 insertions, 519 deletions
diff --git a/lib/parse-datetime.c b/lib/parse-datetime.c index 5c21d0ba..009b204b 100644 --- a/lib/parse-datetime.c +++ b/lib/parse-datetime.c @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.3. */ +/* A Bison parser, made by GNU Bison 2.7. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.3" +#define YYBISON_VERSION "2.7" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -59,19 +58,16 @@ /* Pull parsers. */ #define YYPULL 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ - -/* Line 189 of yacc.c */ -#line 1 "parse-datetime.y" +/* Line 371 of yacc.c */ +#line 1 "./lib/parse-datetime.y" /* Parse a string into an internal time stamp. - Copyright (C) 1999-2000, 2002-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2014 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -353,14 +349,16 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes, } +/* Line 371 of yacc.c */ +#line 354 "parse-datetime.c" -/* Line 189 of yacc.c */ -#line 359 "parse-datetime.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr +# else +# define YY_NULL 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -370,11 +368,14 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes, # define YYERROR_VERBOSE 0 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif /* Tokens. */ #ifndef YYTOKENTYPE @@ -428,13 +429,11 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes, - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { - -/* Line 214 of yacc.c */ -#line 297 "parse-datetime.y" +/* Line 387 of yacc.c */ +#line 297 "./lib/parse-datetime.y" long int intval; textint textintval; @@ -442,9 +441,8 @@ typedef union YYSTYPE relative_time rel; - -/* Line 214 of yacc.c */ -#line 448 "parse-datetime.c" +/* Line 387 of yacc.c */ +#line 446 "parse-datetime.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -452,11 +450,26 @@ typedef union YYSTYPE #endif -/* Copy the second part of user declarations. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (parser_control *pc); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + +/* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 460 "parse-datetime.c" +/* Line 390 of yacc.c */ +#line 473 "parse-datetime.c" #ifdef short # undef short @@ -509,24 +522,24 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint -# define YYID(n) (n) +# define YYID(N) (N) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) @@ -559,11 +572,12 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -586,24 +600,24 @@ YYID (yyi) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -632,23 +646,7 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of @@ -668,6 +666,26 @@ union yyalloc #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ #define YYFINAL 12 /* YYLAST -- Last index in YYTABLE. */ @@ -786,7 +804,7 @@ static const yytype_uint16 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -800,7 +818,7 @@ static const char *const yytname[] = "iso_8601_time", "o_zone_offset", "zone_offset", "local_zone", "zone", "day", "date", "iso_8601_date", "rel", "relunit", "relunit_snumber", "dayshift", "seconds", "signed_seconds", "unsigned_seconds", "number", - "hybrid", "o_colon_minutes", 0 + "hybrid", "o_colon_minutes", YY_NULL }; #endif @@ -845,8 +863,8 @@ static const yytype_uint8 yyr2[] = 0, 2 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { @@ -901,8 +919,7 @@ static const yytype_int8 yypgoto[] = /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ + number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { @@ -920,6 +937,12 @@ static const yytype_uint8 yytable[] = 101, 0, 88 }; +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-93))) + +#define yytable_value_is_error(Yytable_value) \ + YYID (0) + static const yytype_int8 yycheck[] = { 27, 5, 6, 7, 8, 9, 10, 4, 12, 15, @@ -981,72 +1004,35 @@ static const yytype_uint8 yystos[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ yyerror (pc, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) - +/* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - +/* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif /* YYLEX -- calling `yylex' with the right arguments. */ - #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) #else @@ -1097,6 +1083,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc) parser_control *pc; #endif { + FILE *yyo = yyoutput; + YYUSE (yyo); if (!yyvaluep) return; YYUSE (pc); @@ -1109,7 +1097,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc) switch (yytype) { default: - break; + break; } } @@ -1237,7 +1225,6 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -1340,115 +1327,145 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULL; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } - if (yysize_overflow) - return YYSIZE_MAXIMUM; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1479,32 +1496,16 @@ yydestruct (yymsg, yytype, yyvaluep, pc) { default: - break; + break; } } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (parser_control *pc); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1531,8 +1532,31 @@ yyparse (pc) /* The lookahead symbol. */ int yychar; + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +static YYSTYPE yyval_default; +# define YY_INITIAL_VALUE(Value) = Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); /* Number of syntax errors so far. */ int yynerrs; @@ -1545,7 +1569,7 @@ YYSTYPE yylval; `yyss': related to states. `yyvs': related to semantic values. - Refer to the stacks thru separate pointers, to allow yyoverflow + Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1563,7 +1587,7 @@ YYSTYPE yylval; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1581,9 +1605,8 @@ YYSTYPE yylval; Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1592,14 +1615,6 @@ YYSTYPE yylval; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - goto yysetstate; /*------------------------------------------------------------. @@ -1691,7 +1706,7 @@ yybackup: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -1722,8 +1737,8 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -1740,7 +1755,9 @@ yybackup: yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1777,9 +1794,8 @@ yyreduce: switch (yyn) { case 4: - -/* Line 1464 of yacc.c */ -#line 330 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 330 "./lib/parse-datetime.y" { pc->seconds = (yyvsp[(2) - (2)].timespec); pc->timespec_seen = true; @@ -1787,51 +1803,44 @@ yyreduce: break; case 7: - -/* Line 1464 of yacc.c */ -#line 343 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 343 "./lib/parse-datetime.y" { pc->times_seen++; pc->dates_seen++; } break; case 8: - -/* Line 1464 of yacc.c */ -#line 345 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 345 "./lib/parse-datetime.y" { pc->times_seen++; } break; case 9: - -/* Line 1464 of yacc.c */ -#line 347 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 347 "./lib/parse-datetime.y" { pc->local_zones_seen++; } break; case 10: - -/* Line 1464 of yacc.c */ -#line 349 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 349 "./lib/parse-datetime.y" { pc->zones_seen++; } break; case 11: - -/* Line 1464 of yacc.c */ -#line 351 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 351 "./lib/parse-datetime.y" { pc->dates_seen++; } break; case 12: - -/* Line 1464 of yacc.c */ -#line 353 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 353 "./lib/parse-datetime.y" { pc->days_seen++; } break; case 18: - -/* Line 1464 of yacc.c */ -#line 369 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 369 "./lib/parse-datetime.y" { set_hhmmss (pc, (yyvsp[(1) - (2)].textintval).value, 0, 0, 0); pc->meridian = (yyvsp[(2) - (2)].intval); @@ -1839,9 +1848,8 @@ yyreduce: break; case 19: - -/* Line 1464 of yacc.c */ -#line 374 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 374 "./lib/parse-datetime.y" { set_hhmmss (pc, (yyvsp[(1) - (4)].textintval).value, (yyvsp[(3) - (4)].textintval).value, 0, 0); pc->meridian = (yyvsp[(4) - (4)].intval); @@ -1849,9 +1857,8 @@ yyreduce: break; case 20: - -/* Line 1464 of yacc.c */ -#line 379 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 379 "./lib/parse-datetime.y" { set_hhmmss (pc, (yyvsp[(1) - (6)].textintval).value, (yyvsp[(3) - (6)].textintval).value, (yyvsp[(5) - (6)].timespec).tv_sec, (yyvsp[(5) - (6)].timespec).tv_nsec); pc->meridian = (yyvsp[(6) - (6)].intval); @@ -1859,9 +1866,8 @@ yyreduce: break; case 22: - -/* Line 1464 of yacc.c */ -#line 388 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 388 "./lib/parse-datetime.y" { set_hhmmss (pc, (yyvsp[(1) - (2)].textintval).value, 0, 0, 0); pc->meridian = MER24; @@ -1869,9 +1875,8 @@ yyreduce: break; case 23: - -/* Line 1464 of yacc.c */ -#line 393 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 393 "./lib/parse-datetime.y" { set_hhmmss (pc, (yyvsp[(1) - (4)].textintval).value, (yyvsp[(3) - (4)].textintval).value, 0, 0); pc->meridian = MER24; @@ -1879,9 +1884,8 @@ yyreduce: break; case 24: - -/* Line 1464 of yacc.c */ -#line 398 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 398 "./lib/parse-datetime.y" { set_hhmmss (pc, (yyvsp[(1) - (6)].textintval).value, (yyvsp[(3) - (6)].textintval).value, (yyvsp[(5) - (6)].timespec).tv_sec, (yyvsp[(5) - (6)].timespec).tv_nsec); pc->meridian = MER24; @@ -1889,9 +1893,8 @@ yyreduce: break; case 27: - -/* Line 1464 of yacc.c */ -#line 411 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 411 "./lib/parse-datetime.y" { pc->zones_seen++; pc->time_zone = time_zone_hhmm (pc, (yyvsp[(1) - (2)].textintval), (yyvsp[(2) - (2)].intval)); @@ -1899,9 +1902,8 @@ yyreduce: break; case 28: - -/* Line 1464 of yacc.c */ -#line 419 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 419 "./lib/parse-datetime.y" { pc->local_isdst = (yyvsp[(1) - (1)].intval); pc->dsts_seen += (0 < (yyvsp[(1) - (1)].intval)); @@ -1909,9 +1911,8 @@ yyreduce: break; case 29: - -/* Line 1464 of yacc.c */ -#line 424 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 424 "./lib/parse-datetime.y" { pc->local_isdst = 1; pc->dsts_seen += (0 < (yyvsp[(1) - (2)].intval)) + 1; @@ -1919,60 +1920,52 @@ yyreduce: break; case 30: - -/* Line 1464 of yacc.c */ -#line 434 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 434 "./lib/parse-datetime.y" { pc->time_zone = (yyvsp[(1) - (1)].intval); } break; case 31: - -/* Line 1464 of yacc.c */ -#line 436 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 436 "./lib/parse-datetime.y" { pc->time_zone = HOUR(7); } break; case 32: - -/* Line 1464 of yacc.c */ -#line 438 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 438 "./lib/parse-datetime.y" { pc->time_zone = (yyvsp[(1) - (2)].intval); apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1); } break; case 33: - -/* Line 1464 of yacc.c */ -#line 441 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 441 "./lib/parse-datetime.y" { pc->time_zone = HOUR(7); apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1); } break; case 34: - -/* Line 1464 of yacc.c */ -#line 444 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 444 "./lib/parse-datetime.y" { pc->time_zone = (yyvsp[(1) - (3)].intval) + time_zone_hhmm (pc, (yyvsp[(2) - (3)].textintval), (yyvsp[(3) - (3)].intval)); } break; case 35: - -/* Line 1464 of yacc.c */ -#line 446 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 446 "./lib/parse-datetime.y" { pc->time_zone = (yyvsp[(1) - (1)].intval) + 60; } break; case 36: - -/* Line 1464 of yacc.c */ -#line 448 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 448 "./lib/parse-datetime.y" { pc->time_zone = (yyvsp[(1) - (2)].intval) + 60; } break; case 37: - -/* Line 1464 of yacc.c */ -#line 453 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 453 "./lib/parse-datetime.y" { pc->day_ordinal = 0; pc->day_number = (yyvsp[(1) - (1)].intval); @@ -1980,9 +1973,8 @@ yyreduce: break; case 38: - -/* Line 1464 of yacc.c */ -#line 458 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 458 "./lib/parse-datetime.y" { pc->day_ordinal = 0; pc->day_number = (yyvsp[(1) - (2)].intval); @@ -1990,9 +1982,8 @@ yyreduce: break; case 39: - -/* Line 1464 of yacc.c */ -#line 463 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 463 "./lib/parse-datetime.y" { pc->day_ordinal = (yyvsp[(1) - (2)].intval); pc->day_number = (yyvsp[(2) - (2)].intval); @@ -2000,9 +1991,8 @@ yyreduce: break; case 40: - -/* Line 1464 of yacc.c */ -#line 468 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 468 "./lib/parse-datetime.y" { pc->day_ordinal = (yyvsp[(1) - (2)].textintval).value; pc->day_number = (yyvsp[(2) - (2)].intval); @@ -2010,9 +2000,8 @@ yyreduce: break; case 41: - -/* Line 1464 of yacc.c */ -#line 476 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 476 "./lib/parse-datetime.y" { pc->month = (yyvsp[(1) - (3)].textintval).value; pc->day = (yyvsp[(3) - (3)].textintval).value; @@ -2020,9 +2009,8 @@ yyreduce: break; case 42: - -/* Line 1464 of yacc.c */ -#line 481 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 481 "./lib/parse-datetime.y" { /* Interpret as YYYY/MM/DD if the first value has 4 or more digits, otherwise as MM/DD/YY. @@ -2045,9 +2033,8 @@ yyreduce: break; case 43: - -/* Line 1464 of yacc.c */ -#line 501 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 501 "./lib/parse-datetime.y" { /* e.g. 17-JUN-1992. */ pc->day = (yyvsp[(1) - (3)].textintval).value; @@ -2058,9 +2045,8 @@ yyreduce: break; case 44: - -/* Line 1464 of yacc.c */ -#line 509 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 509 "./lib/parse-datetime.y" { /* e.g. JUN-17-1992. */ pc->month = (yyvsp[(1) - (3)].intval); @@ -2071,9 +2057,8 @@ yyreduce: break; case 45: - -/* Line 1464 of yacc.c */ -#line 517 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 517 "./lib/parse-datetime.y" { pc->month = (yyvsp[(1) - (2)].intval); pc->day = (yyvsp[(2) - (2)].textintval).value; @@ -2081,9 +2066,8 @@ yyreduce: break; case 46: - -/* Line 1464 of yacc.c */ -#line 522 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 522 "./lib/parse-datetime.y" { pc->month = (yyvsp[(1) - (4)].intval); pc->day = (yyvsp[(2) - (4)].textintval).value; @@ -2092,9 +2076,8 @@ yyreduce: break; case 47: - -/* Line 1464 of yacc.c */ -#line 528 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 528 "./lib/parse-datetime.y" { pc->day = (yyvsp[(1) - (2)].textintval).value; pc->month = (yyvsp[(2) - (2)].intval); @@ -2102,9 +2085,8 @@ yyreduce: break; case 48: - -/* Line 1464 of yacc.c */ -#line 533 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 533 "./lib/parse-datetime.y" { pc->day = (yyvsp[(1) - (3)].textintval).value; pc->month = (yyvsp[(2) - (3)].intval); @@ -2113,9 +2095,8 @@ yyreduce: break; case 50: - -/* Line 1464 of yacc.c */ -#line 543 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 543 "./lib/parse-datetime.y" { /* ISO 8601 format. YYYY-MM-DD. */ pc->year = (yyvsp[(1) - (3)].textintval); @@ -2125,240 +2106,206 @@ yyreduce: break; case 51: - -/* Line 1464 of yacc.c */ -#line 553 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 553 "./lib/parse-datetime.y" { apply_relative_time (pc, (yyvsp[(1) - (2)].rel), (yyvsp[(2) - (2)].intval)); } break; case 52: - -/* Line 1464 of yacc.c */ -#line 555 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 555 "./lib/parse-datetime.y" { apply_relative_time (pc, (yyvsp[(1) - (1)].rel), 1); } break; case 53: - -/* Line 1464 of yacc.c */ -#line 557 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 557 "./lib/parse-datetime.y" { apply_relative_time (pc, (yyvsp[(1) - (1)].rel), 1); } break; case 54: - -/* Line 1464 of yacc.c */ -#line 562 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 562 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].intval); } break; case 55: - -/* Line 1464 of yacc.c */ -#line 564 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 564 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].textintval).value; } break; case 56: - -/* Line 1464 of yacc.c */ -#line 566 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 566 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 1; } break; case 57: - -/* Line 1464 of yacc.c */ -#line 568 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 568 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].intval); } break; case 58: - -/* Line 1464 of yacc.c */ -#line 570 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 570 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].textintval).value; } break; case 59: - -/* Line 1464 of yacc.c */ -#line 572 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 572 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 1; } break; case 60: - -/* Line 1464 of yacc.c */ -#line 574 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 574 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].intval) * (yyvsp[(2) - (2)].intval); } break; case 61: - -/* Line 1464 of yacc.c */ -#line 576 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 576 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].textintval).value * (yyvsp[(2) - (2)].intval); } break; case 62: - -/* Line 1464 of yacc.c */ -#line 578 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 578 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (1)].intval); } break; case 63: - -/* Line 1464 of yacc.c */ -#line 580 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 580 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].intval); } break; case 64: - -/* Line 1464 of yacc.c */ -#line 582 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 582 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].textintval).value; } break; case 65: - -/* Line 1464 of yacc.c */ -#line 584 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 584 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 1; } break; case 66: - -/* Line 1464 of yacc.c */ -#line 586 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 586 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].intval); } break; case 67: - -/* Line 1464 of yacc.c */ -#line 588 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 588 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].textintval).value; } break; case 68: - -/* Line 1464 of yacc.c */ -#line 590 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 590 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 1; } break; case 69: - -/* Line 1464 of yacc.c */ -#line 592 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 592 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].intval); } break; case 70: - -/* Line 1464 of yacc.c */ -#line 594 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 594 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].textintval).value; } break; case 71: - -/* Line 1464 of yacc.c */ -#line 596 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 596 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].timespec).tv_sec; (yyval.rel).ns = (yyvsp[(1) - (2)].timespec).tv_nsec; } break; case 72: - -/* Line 1464 of yacc.c */ -#line 598 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 598 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].timespec).tv_sec; (yyval.rel).ns = (yyvsp[(1) - (2)].timespec).tv_nsec; } break; case 73: - -/* Line 1464 of yacc.c */ -#line 600 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 600 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 1; } break; case 75: - -/* Line 1464 of yacc.c */ -#line 606 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 606 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].textintval).value; } break; case 76: - -/* Line 1464 of yacc.c */ -#line 608 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 608 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].textintval).value; } break; case 77: - -/* Line 1464 of yacc.c */ -#line 610 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 610 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].textintval).value * (yyvsp[(2) - (2)].intval); } break; case 78: - -/* Line 1464 of yacc.c */ -#line 612 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 612 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].textintval).value; } break; case 79: - -/* Line 1464 of yacc.c */ -#line 614 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 614 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].textintval).value; } break; case 80: - -/* Line 1464 of yacc.c */ -#line 616 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 616 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].textintval).value; } break; case 81: - -/* Line 1464 of yacc.c */ -#line 621 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 621 "./lib/parse-datetime.y" { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (1)].intval); } break; case 85: - -/* Line 1464 of yacc.c */ -#line 629 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 629 "./lib/parse-datetime.y" { (yyval.timespec).tv_sec = (yyvsp[(1) - (1)].textintval).value; (yyval.timespec).tv_nsec = 0; } break; case 87: - -/* Line 1464 of yacc.c */ -#line 635 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 635 "./lib/parse-datetime.y" { (yyval.timespec).tv_sec = (yyvsp[(1) - (1)].textintval).value; (yyval.timespec).tv_nsec = 0; } break; case 88: - -/* Line 1464 of yacc.c */ -#line 640 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 640 "./lib/parse-datetime.y" { digits_to_date_time (pc, (yyvsp[(1) - (1)].textintval)); } break; case 89: - -/* Line 1464 of yacc.c */ -#line 645 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 645 "./lib/parse-datetime.y" { /* Hybrid all-digit and relative offset, so that we accept e.g., "YYYYMMDD +N days" as well as "YYYYMMDD N days". */ @@ -2368,25 +2315,33 @@ yyreduce: break; case 90: - -/* Line 1464 of yacc.c */ -#line 655 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 655 "./lib/parse-datetime.y" { (yyval.intval) = -1; } break; case 91: - -/* Line 1464 of yacc.c */ -#line 657 "parse-datetime.y" +/* Line 1792 of yacc.c */ +#line 657 "./lib/parse-datetime.y" { (yyval.intval) = (yyvsp[(2) - (2)].textintval).value; } break; - -/* Line 1464 of yacc.c */ -#line 2388 "parse-datetime.c" +/* Line 1792 of yacc.c */ +#line 2332 "parse-datetime.c" default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -2414,6 +2369,10 @@ yyreduce: | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -2421,37 +2380,36 @@ yyerrlab: #if ! YYERROR_VERBOSE yyerror (pc, YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (pc, yymsg); - } - else - { - yyerror (pc, YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (pc, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } @@ -2510,7 +2468,7 @@ yyerrlab1: for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -2533,7 +2491,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2557,7 +2517,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2569,8 +2529,13 @@ yyexhaustedlab: yyreturn: if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, pc); + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, pc); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -2594,9 +2559,8 @@ yyreturn: } - -/* Line 1684 of yacc.c */ -#line 660 "parse-datetime.y" +/* Line 2055 of yacc.c */ +#line 660 "./lib/parse-datetime.y" static table const meridian_table[] = @@ -3243,8 +3207,6 @@ parse_datetime (struct timespec *result, char const *p, char tz1buf[TZBUFSIZE]; bool large_tz = TZBUFSIZE < tzsize; bool setenv_ok; - /* Free tz0, in case this is the 2nd or subsequent time through. */ - free (tz0); tz0 = get_tz (tz0buf); z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf; for (s = tzbase; *s != '"'; s++) @@ -3256,7 +3218,12 @@ parse_datetime (struct timespec *result, char const *p, if (!setenv_ok) goto fail; tz_was_altered = true; + p = s + 1; + while (c = *p, c_isspace (c)) + p++; + + break; } } @@ -3412,7 +3379,7 @@ parse_datetime (struct timespec *result, char const *p, + sizeof pc.time_zone * CHAR_BIT / 3]; if (!tz_was_altered) tz0 = get_tz (tz0buf); - sprintf (tz1buf, "XXX%s%ld:%02d", "-" + (time_zone < 0), + sprintf (tz1buf, "XXX%s%ld:%02d", &"-"[time_zone < 0], abs_time_zone_hour, abs_time_zone_min); if (setenv ("TZ", tz1buf, 1) != 0) goto fail; @@ -3561,4 +3528,3 @@ main (int ac, char **av) return 0; } #endif /* TEST */ - |