summaryrefslogtreecommitdiff
path: root/libmisc/getdate.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmisc/getdate.c')
-rw-r--r--libmisc/getdate.c1012
1 files changed, 393 insertions, 619 deletions
diff --git a/libmisc/getdate.c b/libmisc/getdate.c
index af6424e7..fc17c183 100644
--- a/libmisc/getdate.c
+++ b/libmisc/getdate.c
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 3.5.1. */
+/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -34,6 +34,10 @@
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+ especially those whose name start with YY_ or yy_. They are
+ private implementation details that can be changed or removed. */
+
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
@@ -41,14 +45,11 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
-/* Undocumented macros, especially those whose name start with YY_,
- are private implementation details. Do not rely on them. */
-
-/* Identify Bison output. */
-#define YYBISON 1
+/* Identify Bison output, and Bison version. */
+#define YYBISON 30802
-/* Bison version. */
-#define YYBISON_VERSION "3.5.1"
+/* Bison version string. */
+#define YYBISON_VERSION "3.8.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -100,32 +101,9 @@
#include <ctype.h>
#include <time.h>
-#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
-# define IN_CTYPE_DOMAIN(c) 1
-#else
-# define IN_CTYPE_DOMAIN(c) isascii(c)
-#endif
-
-#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
-#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
-#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
-#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
-
-/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
- - Its arg may be any int or unsigned int; it need not be an unsigned char.
- - It's guaranteed to evaluate its argument exactly once.
- - It's typically faster.
- Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
- only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
- it's important to use the locale's definition of `digit' even when the
- host does not conform to Posix. */
-#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
-
#include "getdate.h"
-#if defined (STDC_HEADERS)
-# include <string.h>
-#endif
+#include <string.h>
/* Some old versions of bison generate parsers that use bcopy.
That loses on systems that don't provide the function, so we have
@@ -237,7 +215,7 @@ static int yyRelSeconds;
static int yyRelYear;
-#line 241 "getdate.c"
+#line 219 "getdate.c"
# ifndef YY_CAST
# ifdef __cplusplus
@@ -260,14 +238,6 @@ static int yyRelYear;
# endif
# endif
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
/* Debug traces. */
#ifndef YYDEBUG
@@ -277,30 +247,39 @@ static int yyRelYear;
extern int yydebug;
#endif
-/* Token type. */
+/* Token kinds. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
- tAGO = 258,
- tDAY = 259,
- tDAY_UNIT = 260,
- tDAYZONE = 261,
- tDST = 262,
- tHOUR_UNIT = 263,
- tID = 264,
- tMERIDIAN = 265,
- tMINUTE_UNIT = 266,
- tMONTH = 267,
- tMONTH_UNIT = 268,
- tSEC_UNIT = 269,
- tSNUMBER = 270,
- tUNUMBER = 271,
- tYEAR_UNIT = 272,
- tZONE = 273
+ YYEMPTY = -2,
+ YYEOF = 0, /* "end of file" */
+ YYerror = 256, /* error */
+ YYUNDEF = 257, /* "invalid token" */
+ tAGO = 258, /* tAGO */
+ tDAY = 259, /* tDAY */
+ tDAY_UNIT = 260, /* tDAY_UNIT */
+ tDAYZONE = 261, /* tDAYZONE */
+ tDST = 262, /* tDST */
+ tHOUR_UNIT = 263, /* tHOUR_UNIT */
+ tID = 264, /* tID */
+ tMERIDIAN = 265, /* tMERIDIAN */
+ tMINUTE_UNIT = 266, /* tMINUTE_UNIT */
+ tMONTH = 267, /* tMONTH */
+ tMONTH_UNIT = 268, /* tMONTH_UNIT */
+ tSEC_UNIT = 269, /* tSEC_UNIT */
+ tSNUMBER = 270, /* tSNUMBER */
+ tUNUMBER = 271, /* tUNUMBER */
+ tYEAR_UNIT = 272, /* tYEAR_UNIT */
+ tZONE = 273 /* tZONE */
};
+ typedef enum yytokentype yytoken_kind_t;
#endif
-/* Tokens. */
+/* Token kinds. */
+#define YYEMPTY -2
+#define YYEOF 0
+#define YYerror 256
+#define YYUNDEF 257
#define tAGO 258
#define tDAY 259
#define tDAY_UNIT 260
@@ -322,12 +301,12 @@ extern int yydebug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
-#line 172 "getdate.y"
+#line 149 "getdate.y"
int Number;
enum _MERIDIAN Meridian;
-#line 331 "getdate.c"
+#line 310 "getdate.c"
};
typedef union YYSTYPE YYSTYPE;
@@ -338,10 +317,52 @@ typedef union YYSTYPE YYSTYPE;
extern YYSTYPE yylval;
+
int yyparse (void);
+/* Symbol kind. */
+enum yysymbol_kind_t
+{
+ YYSYMBOL_YYEMPTY = -2,
+ YYSYMBOL_YYEOF = 0, /* "end of file" */
+ YYSYMBOL_YYerror = 1, /* error */
+ YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
+ YYSYMBOL_tAGO = 3, /* tAGO */
+ YYSYMBOL_tDAY = 4, /* tDAY */
+ YYSYMBOL_tDAY_UNIT = 5, /* tDAY_UNIT */
+ YYSYMBOL_tDAYZONE = 6, /* tDAYZONE */
+ YYSYMBOL_tDST = 7, /* tDST */
+ YYSYMBOL_tHOUR_UNIT = 8, /* tHOUR_UNIT */
+ YYSYMBOL_tID = 9, /* tID */
+ YYSYMBOL_tMERIDIAN = 10, /* tMERIDIAN */
+ YYSYMBOL_tMINUTE_UNIT = 11, /* tMINUTE_UNIT */
+ YYSYMBOL_tMONTH = 12, /* tMONTH */
+ YYSYMBOL_tMONTH_UNIT = 13, /* tMONTH_UNIT */
+ YYSYMBOL_tSEC_UNIT = 14, /* tSEC_UNIT */
+ YYSYMBOL_tSNUMBER = 15, /* tSNUMBER */
+ YYSYMBOL_tUNUMBER = 16, /* tUNUMBER */
+ YYSYMBOL_tYEAR_UNIT = 17, /* tYEAR_UNIT */
+ YYSYMBOL_tZONE = 18, /* tZONE */
+ YYSYMBOL_19_ = 19, /* ':' */
+ YYSYMBOL_20_ = 20, /* ',' */
+ YYSYMBOL_21_ = 21, /* '/' */
+ YYSYMBOL_YYACCEPT = 22, /* $accept */
+ YYSYMBOL_spec = 23, /* spec */
+ YYSYMBOL_item = 24, /* item */
+ YYSYMBOL_time = 25, /* time */
+ YYSYMBOL_zone = 26, /* zone */
+ YYSYMBOL_day = 27, /* day */
+ YYSYMBOL_date = 28, /* date */
+ YYSYMBOL_rel = 29, /* rel */
+ YYSYMBOL_relunit = 30, /* relunit */
+ YYSYMBOL_number = 31, /* number */
+ YYSYMBOL_o_merid = 32 /* o_merid */
+};
+typedef enum yysymbol_kind_t yysymbol_kind_t;
+
+
#ifdef short
@@ -381,6 +402,18 @@ typedef int_least16_t yytype_int16;
typedef short yytype_int16;
#endif
+/* Work around bug in HP-UX 11.23, which defines these macros
+ incorrectly for preprocessor constants. This workaround can likely
+ be removed in 2023, as HPE has promised support for HP-UX 11.23
+ (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
+ <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
+#ifdef __hpux
+# undef UINT_LEAST8_MAX
+# undef UINT_LEAST16_MAX
+# define UINT_LEAST8_MAX 255
+# define UINT_LEAST16_MAX 65535
+#endif
+
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
@@ -440,6 +473,7 @@ typedef int yytype_uint16;
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+
/* Stored state numbers (used for stacks). */
typedef yytype_int8 yy_state_t;
@@ -458,6 +492,7 @@ typedef int yy_state_fast_t;
# endif
#endif
+
#ifndef YY_ATTRIBUTE_PURE
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
@@ -476,17 +511,23 @@ typedef int yy_state_fast_t;
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
+# define YY_USE(E) ((void) (E))
#else
-# define YYUSE(E) /* empty */
+# define YY_USE(E) /* empty */
#endif
-#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
+# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
+# else
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# endif
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
@@ -515,7 +556,7 @@ typedef int yy_state_fast_t;
#define YY_ASSERT(E) ((void) (0 && (E)))
-#if ! defined yyoverflow || YYERROR_VERBOSE
+#if !defined yyoverflow
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -580,8 +621,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
+#endif /* !defined yyoverflow */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
@@ -657,14 +697,16 @@ union yyalloc
/* YYNSTATES -- Number of states. */
#define YYNSTATES 61
-#define YYUNDEFTOK 2
+/* YYMAXUTOK -- Last valid token kind. */
#define YYMAXUTOK 273
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
-#define YYTRANSLATE(YYX) \
- (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+#define YYTRANSLATE(YYX) \
+ (0 <= (YYX) && (YYX) <= YYMAXUTOK \
+ ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
+ : YYSYMBOL_YYUNDEF)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex. */
@@ -701,41 +743,44 @@ static const yytype_int8 yytranslate[] =
};
#if YYDEBUG
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_int16 yyrline[] =
{
- 0, 188, 188, 189, 192, 195, 198, 201, 204, 207,
- 210, 216, 222, 231, 237, 249, 252, 256, 261, 265,
- 269, 275, 279, 297, 303, 309, 313, 318, 322, 329,
- 337, 340, 343, 346, 349, 352, 355, 358, 361, 364,
- 367, 370, 373, 376, 379, 382, 385, 388, 391, 396,
- 430, 433
+ 0, 165, 165, 166, 169, 172, 175, 178, 181, 184,
+ 187, 193, 199, 208, 214, 226, 229, 233, 238, 242,
+ 246, 252, 256, 274, 280, 286, 290, 295, 299, 306,
+ 314, 317, 320, 323, 326, 329, 332, 335, 338, 341,
+ 344, 347, 350, 353, 356, 359, 362, 365, 368, 373,
+ 407, 410
};
#endif
-#if YYDEBUG || YYERROR_VERBOSE || 0
+/** Accessing symbol of state STATE. */
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
+
+#if YYDEBUG || 0
+/* The user-facing name of the symbol whose (internal) number is
+ YYSYMBOL. No bounds checking. */
+static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
+
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "tAGO", "tDAY", "tDAY_UNIT", "tDAYZONE",
- "tDST", "tHOUR_UNIT", "tID", "tMERIDIAN", "tMINUTE_UNIT", "tMONTH",
- "tMONTH_UNIT", "tSEC_UNIT", "tSNUMBER", "tUNUMBER", "tYEAR_UNIT",
- "tZONE", "':'", "','", "'/'", "$accept", "spec", "item", "time", "zone",
- "day", "date", "rel", "relunit", "number", "o_merid", YY_NULLPTR
+ "\"end of file\"", "error", "\"invalid token\"", "tAGO", "tDAY",
+ "tDAY_UNIT", "tDAYZONE", "tDST", "tHOUR_UNIT", "tID", "tMERIDIAN",
+ "tMINUTE_UNIT", "tMONTH", "tMONTH_UNIT", "tSEC_UNIT", "tSNUMBER",
+ "tUNUMBER", "tYEAR_UNIT", "tZONE", "':'", "','", "'/'", "$accept",
+ "spec", "item", "time", "zone", "day", "date", "rel", "relunit",
+ "number", "o_merid", YY_NULLPTR
};
-#endif
-# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
-static const yytype_int16 yytoknum[] =
+static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 58,
- 44, 47
-};
-# endif
+ return yytname[yysymbol];
+}
+#endif
#define YYPACT_NINF (-20)
@@ -747,8 +792,8 @@ static const yytype_int16 yytoknum[] =
#define yytable_value_is_error(Yyn) \
0
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
static const yytype_int8 yypact[] =
{
-20, 0, -20, -19, -20, -20, -20, -20, -13, -20,
@@ -760,9 +805,9 @@ static const yytype_int8 yypact[] =
-20
};
- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE does not specify something else to do. Zero
- means the default is an error. */
+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
static const yytype_int8 yydefact[] =
{
2, 0, 1, 18, 39, 16, 42, 45, 0, 36,
@@ -774,23 +819,23 @@ static const yytype_int8 yydefact[] =
13
};
- /* YYPGOTO[NTERM-NUM]. */
+/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
-7
};
- /* YYDEFGOTO[NTERM-NUM]. */
+/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 1, 15, 16, 17, 18, 19, 20, 21, 22,
+ 0, 1, 15, 16, 17, 18, 19, 20, 21, 22,
55
};
- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule whose
- number is the opposite. If YYTABLE_NINF, syntax error. */
+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int8 yytable[] =
{
2, 23, 52, 24, 3, 4, 5, 59, 6, 46,
@@ -811,8 +856,8 @@ static const yytype_int8 yycheck[] =
57
};
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
+ state STATE-NUM. */
static const yytype_int8 yystos[] =
{
0, 23, 0, 4, 5, 6, 8, 11, 12, 13,
@@ -824,7 +869,7 @@ static const yytype_int8 yystos[] =
32
};
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
static const yytype_int8 yyr1[] =
{
0, 22, 23, 23, 24, 24, 24, 24, 24, 24,
@@ -835,7 +880,7 @@ static const yytype_int8 yyr1[] =
32, 32
};
- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
static const yytype_int8 yyr2[] =
{
0, 2, 0, 2, 1, 1, 1, 1, 1, 1,
@@ -847,14 +892,15 @@ static const yytype_int8 yyr2[] =
};
+enum { YYENOMEM = -2 };
+
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
+#define YYNOMEM goto yyexhaustedlab
#define YYRECOVERING() (!!yyerrstatus)
@@ -876,10 +922,9 @@ static const yytype_int8 yyr2[] =
} \
while (0)
-/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
-
+/* Backward compatibility with an undocumented macro.
+ Use YYerror or YYUNDEF. */
+#define YYERRCODE YYUNDEF
/* Enable debugging if requested. */
@@ -896,19 +941,16 @@ do { \
YYFPRINTF Args; \
} while (0)
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
- Type, Value); \
+ Kind, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
@@ -919,18 +961,15 @@ do { \
`-----------------------------------*/
static void
-yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_value_print (FILE *yyo,
+ yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
FILE *yyoutput = yyo;
- YYUSE (yyoutput);
+ YY_USE (yyoutput);
if (!yyvaluep)
return;
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
-# endif
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YYUSE (yytype);
+ YY_USE (yykind);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
@@ -940,12 +979,13 @@ yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
`---------------------------*/
static void
-yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_print (FILE *yyo,
+ yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
YYFPRINTF (yyo, "%s %s (",
- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+ yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
- yy_symbol_value_print (yyo, yytype, yyvaluep);
+ yy_symbol_value_print (yyo, yykind, yyvaluep);
YYFPRINTF (yyo, ")");
}
@@ -978,7 +1018,8 @@ do { \
`------------------------------------------------*/
static void
-yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
+ int yyrule)
{
int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
@@ -990,9 +1031,8 @@ yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
- yystos[+yyssp[yyi + 1 - yynrhs]],
- &yyvsp[(yyi + 1) - (yynrhs)]
- );
+ YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+ &yyvsp[(yyi + 1) - (yynrhs)]);
YYFPRINTF (stderr, "\n");
}
}
@@ -1007,8 +1047,8 @@ do { \
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YYDPRINTF(Args) ((void) 0)
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
@@ -1031,259 +1071,30 @@ int yydebug;
#endif
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
-# else
-/* Return the length of YYSTR. */
-static YYPTRDIFF_T
-yystrlen (const char *yystr)
-{
- YYPTRDIFF_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-{
- char *yyd = yydest;
- const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
- quotes and backslashes, so that it's suitable for yyerror. The
- heuristic is that double-quoting is unnecessary unless the string
- contains an apostrophe, a comma, or backslash (other than
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
- null, do not copy; instead, return the length of what the result
- would have been. */
-static YYPTRDIFF_T
-yytnamerr (char *yyres, const char *yystr)
-{
- if (*yystr == '"')
- {
- YYPTRDIFF_T yyn = 0;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- else
- goto append;
-
- append:
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
- do_not_strip_quotes: ;
- }
- if (yyres)
- return yystpcpy (yyres, yystr) - yyres;
- else
- return yystrlen (yystr);
-}
-# endif
-/* 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.
- 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 (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
- yy_state_t *yyssp, int yytoken)
-{
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- /* Internationalized format string. */
- const char *yyformat = YY_NULLPTR;
- /* Arguments of yyformat: reported tokens (one for the "unexpected",
- one per "expected"). */
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Actual size of YYARG. */
- int yycount = 0;
- /* Cumulated lengths of YYARG. */
- YYPTRDIFF_T yysize = 0;
-
- /* There are many possibilities here to consider:
- - 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 yyn = yypact[+*yyssp];
- YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
- yysize = yysize0;
- 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];
- {
- YYPTRDIFF_T yysize1
- = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
- yysize = yysize1;
- else
- return 2;
- }
- }
- }
- }
-
- switch (yycount)
- {
-# define YYCASE_(N, S) \
- case N: \
- yyformat = S; \
- break
- default: /* Avoid compiler warnings. */
- 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_
- }
-
- {
- /* Don't count the "%s"s in the final size, but reserve room for
- the terminator. */
- YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
- if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
- yysize = yysize1;
- else
- return 2;
- }
-
- 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. |
`-----------------------------------------------*/
static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+yydestruct (const char *yymsg,
+ yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
{
- YYUSE (yyvaluep);
+ YY_USE (yyvaluep);
if (!yymsg)
yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+ YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YYUSE (yytype);
+ YY_USE (yykind);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
-
-
-/* The lookahead symbol. */
+/* Lookahead token kind. */
int yychar;
/* The semantic value of the lookahead symbol. */
@@ -1292,6 +1103,8 @@ YYSTYPE yylval;
int yynerrs;
+
+
/*----------.
| yyparse. |
`----------*/
@@ -1299,43 +1112,36 @@ int yynerrs;
int
yyparse (void)
{
- yy_state_fast_t yystate;
+ yy_state_fast_t yystate = 0;
/* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
-
- /* The stacks and their tools:
- 'yyss': related to states.
- 'yyvs': related to semantic values.
+ int yyerrstatus = 0;
- Refer to the stacks through separate pointers, to allow yyoverflow
+ /* Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
- /* The state stack. */
+ /* Their size. */
+ YYPTRDIFF_T yystacksize = YYINITDEPTH;
+
+ /* The state stack: array, bottom, top. */
yy_state_t yyssa[YYINITDEPTH];
- yy_state_t *yyss;
- yy_state_t *yyssp;
+ yy_state_t *yyss = yyssa;
+ yy_state_t *yyssp = yyss;
- /* The semantic value stack. */
+ /* The semantic value stack: array, bottom, top. */
YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs;
- YYSTYPE *yyvsp;
-
- YYPTRDIFF_T yystacksize;
+ YYSTYPE *yyvs = yyvsa;
+ YYSTYPE *yyvsp = yyvs;
int yyn;
+ /* The return value of yyparse. */
int yyresult;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
+ /* Lookahead symbol kind. */
+ yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
-#endif
+
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
@@ -1343,16 +1149,10 @@ yyparse (void)
Keep to zero when no symbol should be popped. */
int yylen = 0;
- yyssp = yyss = yyssa;
- yyvsp = yyvs = yyvsa;
- yystacksize = YYINITDEPTH;
-
YYDPRINTF ((stderr, "Starting parse\n"));
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
+
goto yysetstate;
@@ -1374,10 +1174,11 @@ yysetstate:
YY_IGNORE_USELESS_CAST_BEGIN
*yyssp = YY_CAST (yy_state_t, yystate);
YY_IGNORE_USELESS_CAST_END
+ YY_STACK_PRINT (yyss, yyssp);
if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
- goto yyexhaustedlab;
+ YYNOMEM;
#else
{
/* Get the current used size of the three stacks, in elements. */
@@ -1405,7 +1206,7 @@ yysetstate:
# else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ YYNOMEM;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
@@ -1416,10 +1217,10 @@ yysetstate:
YY_CAST (union yyalloc *,
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
if (! yyptr)
- goto yyexhaustedlab;
+ YYNOMEM;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
+# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
@@ -1438,6 +1239,7 @@ yysetstate:
}
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
+
if (yystate == YYFINAL)
YYACCEPT;
@@ -1458,18 +1260,29 @@ yybackup:
/* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
if (yychar == YYEMPTY)
{
- YYDPRINTF ((stderr, "Reading a token: "));
+ YYDPRINTF ((stderr, "Reading a token\n"));
yychar = yylex ();
}
if (yychar <= YYEOF)
{
- yychar = yytoken = YYEOF;
+ yychar = YYEOF;
+ yytoken = YYSYMBOL_YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
+ else if (yychar == YYerror)
+ {
+ /* The scanner already issued an error message, process directly
+ to error recovery. But do not keep the error token as
+ lookahead, it is too special and may lead us to an endless
+ loop in error recovery. */
+ yychar = YYUNDEF;
+ yytoken = YYSYMBOL_YYerror;
+ goto yyerrlab1;
+ }
else
{
yytoken = YYTRANSLATE (yychar);
@@ -1538,70 +1351,70 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 4:
-#line 192 "getdate.y"
+ case 4: /* item: time */
+#line 169 "getdate.y"
{
yyHaveTime++;
}
-#line 1547 "getdate.c"
+#line 1360 "getdate.c"
break;
- case 5:
-#line 195 "getdate.y"
+ case 5: /* item: zone */
+#line 172 "getdate.y"
{
yyHaveZone++;
}
-#line 1555 "getdate.c"
+#line 1368 "getdate.c"
break;
- case 6:
-#line 198 "getdate.y"
+ case 6: /* item: date */
+#line 175 "getdate.y"
{
yyHaveDate++;
}
-#line 1563 "getdate.c"
+#line 1376 "getdate.c"
break;
- case 7:
-#line 201 "getdate.y"
+ case 7: /* item: day */
+#line 178 "getdate.y"
{
yyHaveDay++;
}
-#line 1571 "getdate.c"
+#line 1384 "getdate.c"
break;
- case 8:
-#line 204 "getdate.y"
+ case 8: /* item: rel */
+#line 181 "getdate.y"
{
yyHaveRel++;
}
-#line 1579 "getdate.c"
+#line 1392 "getdate.c"
break;
- case 10:
-#line 210 "getdate.y"
+ case 10: /* time: tUNUMBER tMERIDIAN */
+#line 187 "getdate.y"
{
yyHour = (yyvsp[-1].Number);
yyMinutes = 0;
yySeconds = 0;
yyMeridian = (yyvsp[0].Meridian);
}
-#line 1590 "getdate.c"
+#line 1403 "getdate.c"
break;
- case 11:
-#line 216 "getdate.y"
+ case 11: /* time: tUNUMBER ':' tUNUMBER o_merid */
+#line 193 "getdate.y"
{
yyHour = (yyvsp[-3].Number);
yyMinutes = (yyvsp[-1].Number);
yySeconds = 0;
yyMeridian = (yyvsp[0].Meridian);
}
-#line 1601 "getdate.c"
+#line 1414 "getdate.c"
break;
- case 12:
-#line 222 "getdate.y"
+ case 12: /* time: tUNUMBER ':' tUNUMBER tSNUMBER */
+#line 199 "getdate.y"
{
yyHour = (yyvsp[-3].Number);
yyMinutes = (yyvsp[-1].Number);
@@ -1611,22 +1424,22 @@ yyreduce:
? -(yyvsp[0].Number) % 100 + (-(yyvsp[0].Number) / 100) * 60
: - ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60));
}
-#line 1615 "getdate.c"
+#line 1428 "getdate.c"
break;
- case 13:
-#line 231 "getdate.y"
+ case 13: /* time: tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid */
+#line 208 "getdate.y"
{
yyHour = (yyvsp[-5].Number);
yyMinutes = (yyvsp[-3].Number);
yySeconds = (yyvsp[-1].Number);
yyMeridian = (yyvsp[0].Meridian);
}
-#line 1626 "getdate.c"
+#line 1439 "getdate.c"
break;
- case 14:
-#line 237 "getdate.y"
+ case 14: /* time: tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER */
+#line 214 "getdate.y"
{
yyHour = (yyvsp[-5].Number);
yyMinutes = (yyvsp[-3].Number);
@@ -1637,71 +1450,71 @@ yyreduce:
? -(yyvsp[0].Number) % 100 + (-(yyvsp[0].Number) / 100) * 60
: - ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60));
}
-#line 1641 "getdate.c"
+#line 1454 "getdate.c"
break;
- case 15:
-#line 249 "getdate.y"
+ case 15: /* zone: tZONE */
+#line 226 "getdate.y"
{
yyTimezone = (yyvsp[0].Number);
}
-#line 1649 "getdate.c"
+#line 1462 "getdate.c"
break;
- case 16:
-#line 252 "getdate.y"
+ case 16: /* zone: tDAYZONE */
+#line 229 "getdate.y"
{
yyTimezone = (yyvsp[0].Number) - 60;
}
-#line 1657 "getdate.c"
+#line 1470 "getdate.c"
break;
- case 17:
-#line 256 "getdate.y"
+ case 17: /* zone: tZONE tDST */
+#line 233 "getdate.y"
{
yyTimezone = (yyvsp[-1].Number) - 60;
}
-#line 1665 "getdate.c"
+#line 1478 "getdate.c"
break;
- case 18:
-#line 261 "getdate.y"
+ case 18: /* day: tDAY */
+#line 238 "getdate.y"
{
yyDayOrdinal = 1;
yyDayNumber = (yyvsp[0].Number);
}
-#line 1674 "getdate.c"
+#line 1487 "getdate.c"
break;
- case 19:
-#line 265 "getdate.y"
+ case 19: /* day: tDAY ',' */
+#line 242 "getdate.y"
{
yyDayOrdinal = 1;
yyDayNumber = (yyvsp[-1].Number);
}
-#line 1683 "getdate.c"
+#line 1496 "getdate.c"
break;
- case 20:
-#line 269 "getdate.y"
+ case 20: /* day: tUNUMBER tDAY */
+#line 246 "getdate.y"
{
yyDayOrdinal = (yyvsp[-1].Number);
yyDayNumber = (yyvsp[0].Number);
}
-#line 1692 "getdate.c"
+#line 1505 "getdate.c"
break;
- case 21:
-#line 275 "getdate.y"
+ case 21: /* date: tUNUMBER '/' tUNUMBER */
+#line 252 "getdate.y"
{
yyMonth = (yyvsp[-2].Number);
yyDay = (yyvsp[0].Number);
}
-#line 1701 "getdate.c"
+#line 1514 "getdate.c"
break;
- case 22:
-#line 279 "getdate.y"
+ case 22: /* date: tUNUMBER '/' tUNUMBER '/' tUNUMBER */
+#line 256 "getdate.y"
{
/* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY.
The goal in recognizing YYYY/MM/DD is solely to support legacy
@@ -1720,71 +1533,71 @@ yyreduce:
yyYear = (yyvsp[0].Number);
}
}
-#line 1724 "getdate.c"
+#line 1537 "getdate.c"
break;
- case 23:
-#line 297 "getdate.y"
+ case 23: /* date: tUNUMBER tSNUMBER tSNUMBER */
+#line 274 "getdate.y"
{
/* ISO 8601 format. yyyy-mm-dd. */
yyYear = (yyvsp[-2].Number);
yyMonth = -(yyvsp[-1].Number);
yyDay = -(yyvsp[0].Number);
}
-#line 1735 "getdate.c"
+#line 1548 "getdate.c"
break;
- case 24:
-#line 303 "getdate.y"
+ case 24: /* date: tUNUMBER tMONTH tSNUMBER */
+#line 280 "getdate.y"
{
/* e.g. 17-JUN-1992. */
yyDay = (yyvsp[-2].Number);
yyMonth = (yyvsp[-1].Number);
yyYear = -(yyvsp[0].Number);
}
-#line 1746 "getdate.c"
+#line 1559 "getdate.c"
break;
- case 25:
-#line 309 "getdate.y"
+ case 25: /* date: tMONTH tUNUMBER */
+#line 286 "getdate.y"
{
yyMonth = (yyvsp[-1].Number);
yyDay = (yyvsp[0].Number);
}
-#line 1755 "getdate.c"
+#line 1568 "getdate.c"
break;
- case 26:
-#line 313 "getdate.y"
+ case 26: /* date: tMONTH tUNUMBER ',' tUNUMBER */
+#line 290 "getdate.y"
{
yyMonth = (yyvsp[-3].Number);
yyDay = (yyvsp[-2].Number);
yyYear = (yyvsp[0].Number);
}
-#line 1765 "getdate.c"
+#line 1578 "getdate.c"
break;
- case 27:
-#line 318 "getdate.y"
+ case 27: /* date: tUNUMBER tMONTH */
+#line 295 "getdate.y"
{
yyMonth = (yyvsp[0].Number);
yyDay = (yyvsp[-1].Number);
}
-#line 1774 "getdate.c"
+#line 1587 "getdate.c"
break;
- case 28:
-#line 322 "getdate.y"
+ case 28: /* date: tUNUMBER tMONTH tUNUMBER */
+#line 299 "getdate.y"
{
yyMonth = (yyvsp[-1].Number);
yyDay = (yyvsp[-2].Number);
yyYear = (yyvsp[0].Number);
}
-#line 1784 "getdate.c"
+#line 1597 "getdate.c"
break;
- case 29:
-#line 329 "getdate.y"
+ case 29: /* rel: relunit tAGO */
+#line 306 "getdate.y"
{
yyRelSeconds = -yyRelSeconds;
yyRelMinutes = -yyRelMinutes;
@@ -1793,155 +1606,155 @@ yyreduce:
yyRelMonth = -yyRelMonth;
yyRelYear = -yyRelYear;
}
-#line 1797 "getdate.c"
+#line 1610 "getdate.c"
break;
- case 31:
-#line 340 "getdate.y"
+ case 31: /* relunit: tUNUMBER tYEAR_UNIT */
+#line 317 "getdate.y"
{
yyRelYear += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1805 "getdate.c"
+#line 1618 "getdate.c"
break;
- case 32:
-#line 343 "getdate.y"
+ case 32: /* relunit: tSNUMBER tYEAR_UNIT */
+#line 320 "getdate.y"
{
yyRelYear += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1813 "getdate.c"
+#line 1626 "getdate.c"
break;
- case 33:
-#line 346 "getdate.y"
+ case 33: /* relunit: tYEAR_UNIT */
+#line 323 "getdate.y"
{
yyRelYear++;
}
-#line 1821 "getdate.c"
+#line 1634 "getdate.c"
break;
- case 34:
-#line 349 "getdate.y"
+ case 34: /* relunit: tUNUMBER tMONTH_UNIT */
+#line 326 "getdate.y"
{
yyRelMonth += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1829 "getdate.c"
+#line 1642 "getdate.c"
break;
- case 35:
-#line 352 "getdate.y"
+ case 35: /* relunit: tSNUMBER tMONTH_UNIT */
+#line 329 "getdate.y"
{
yyRelMonth += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1837 "getdate.c"
+#line 1650 "getdate.c"
break;
- case 36:
-#line 355 "getdate.y"
+ case 36: /* relunit: tMONTH_UNIT */
+#line 332 "getdate.y"
{
yyRelMonth++;
}
-#line 1845 "getdate.c"
+#line 1658 "getdate.c"
break;
- case 37:
-#line 358 "getdate.y"
+ case 37: /* relunit: tUNUMBER tDAY_UNIT */
+#line 335 "getdate.y"
{
yyRelDay += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1853 "getdate.c"
+#line 1666 "getdate.c"
break;
- case 38:
-#line 361 "getdate.y"
+ case 38: /* relunit: tSNUMBER tDAY_UNIT */
+#line 338 "getdate.y"
{
yyRelDay += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1861 "getdate.c"
+#line 1674 "getdate.c"
break;
- case 39:
-#line 364 "getdate.y"
+ case 39: /* relunit: tDAY_UNIT */
+#line 341 "getdate.y"
{
yyRelDay++;
}
-#line 1869 "getdate.c"
+#line 1682 "getdate.c"
break;
- case 40:
-#line 367 "getdate.y"
+ case 40: /* relunit: tUNUMBER tHOUR_UNIT */
+#line 344 "getdate.y"
{
yyRelHour += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1877 "getdate.c"
+#line 1690 "getdate.c"
break;
- case 41:
-#line 370 "getdate.y"
+ case 41: /* relunit: tSNUMBER tHOUR_UNIT */
+#line 347 "getdate.y"
{
yyRelHour += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1885 "getdate.c"
+#line 1698 "getdate.c"
break;
- case 42:
-#line 373 "getdate.y"
+ case 42: /* relunit: tHOUR_UNIT */
+#line 350 "getdate.y"
{
yyRelHour++;
}
-#line 1893 "getdate.c"
+#line 1706 "getdate.c"
break;
- case 43:
-#line 376 "getdate.y"
+ case 43: /* relunit: tUNUMBER tMINUTE_UNIT */
+#line 353 "getdate.y"
{
yyRelMinutes += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1901 "getdate.c"
+#line 1714 "getdate.c"
break;
- case 44:
-#line 379 "getdate.y"
+ case 44: /* relunit: tSNUMBER tMINUTE_UNIT */
+#line 356 "getdate.y"
{
yyRelMinutes += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1909 "getdate.c"
+#line 1722 "getdate.c"
break;
- case 45:
-#line 382 "getdate.y"
+ case 45: /* relunit: tMINUTE_UNIT */
+#line 359 "getdate.y"
{
yyRelMinutes++;
}
-#line 1917 "getdate.c"
+#line 1730 "getdate.c"
break;
- case 46:
-#line 385 "getdate.y"
+ case 46: /* relunit: tUNUMBER tSEC_UNIT */
+#line 362 "getdate.y"
{
yyRelSeconds += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1925 "getdate.c"
+#line 1738 "getdate.c"
break;
- case 47:
-#line 388 "getdate.y"
+ case 47: /* relunit: tSNUMBER tSEC_UNIT */
+#line 365 "getdate.y"
{
yyRelSeconds += (yyvsp[-1].Number) * (yyvsp[0].Number);
}
-#line 1933 "getdate.c"
+#line 1746 "getdate.c"
break;
- case 48:
-#line 391 "getdate.y"
+ case 48: /* relunit: tSEC_UNIT */
+#line 368 "getdate.y"
{
yyRelSeconds++;
}
-#line 1941 "getdate.c"
+#line 1754 "getdate.c"
break;
- case 49:
-#line 397 "getdate.y"
+ case 49: /* number: tUNUMBER */
+#line 374 "getdate.y"
{
if ((yyHaveTime != 0) && (yyHaveDate != 0) && (yyHaveRel == 0))
yyYear = (yyvsp[0].Number);
@@ -1972,27 +1785,27 @@ yyreduce:
}
}
}
-#line 1976 "getdate.c"
+#line 1789 "getdate.c"
break;
- case 50:
-#line 430 "getdate.y"
+ case 50: /* o_merid: %empty */
+#line 407 "getdate.y"
{
(yyval.Meridian) = MER24;
}
-#line 1984 "getdate.c"
+#line 1797 "getdate.c"
break;
- case 51:
-#line 434 "getdate.y"
+ case 51: /* o_merid: tMERIDIAN */
+#line 411 "getdate.y"
{
(yyval.Meridian) = (yyvsp[0].Meridian);
}
-#line 1992 "getdate.c"
+#line 1805 "getdate.c"
break;
-#line 1996 "getdate.c"
+#line 1809 "getdate.c"
default: break;
}
@@ -2007,11 +1820,10 @@ yyreduce:
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);
+ YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
@@ -2035,50 +1847,14 @@ yyreduce:
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);
-
+ yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
-#if ! YYERROR_VERBOSE
yyerror (YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
- yyssp, yytoken)
- {
- 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 = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
- if (!yymsg)
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- yysyntax_error_status = 2;
- }
- else
- {
- yysyntax_error_status = YYSYNTAX_ERROR;
- yymsgp = yymsg;
- }
- }
- yyerror (yymsgp);
- if (yysyntax_error_status == 2)
- goto yyexhaustedlab;
- }
-# undef YYSYNTAX_ERROR
-#endif
}
-
-
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
@@ -2111,6 +1887,7 @@ yyerrorlab:
label yyerrorlab therefore never appears in user code. */
if (0)
YYERROR;
+ ++yynerrs;
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
@@ -2127,13 +1904,14 @@ yyerrorlab:
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
+ /* Pop stack until we find a state that shifts the error token. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
{
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ yyn += YYSYMBOL_YYerror;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
{
yyn = yytable[yyn];
if (0 < yyn)
@@ -2147,7 +1925,7 @@ yyerrlab1:
yydestruct ("Error: popping",
- yystos[yystate], yyvsp);
+ YY_ACCESSING_SYMBOL (yystate), yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
@@ -2159,7 +1937,7 @@ yyerrlab1:
/* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+ YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
@@ -2170,7 +1948,7 @@ yyerrlab1:
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
- goto yyreturn;
+ goto yyreturnlab;
/*-----------------------------------.
@@ -2178,24 +1956,22 @@ yyacceptlab:
`-----------------------------------*/
yyabortlab:
yyresult = 1;
- goto yyreturn;
+ goto yyreturnlab;
-#if !defined yyoverflow || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here. |
-`-------------------------------------------------*/
+/*-----------------------------------------------------------.
+| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
+`-----------------------------------------------------------*/
yyexhaustedlab:
yyerror (YY_("memory exhausted"));
yyresult = 2;
- /* Fall through. */
-#endif
+ goto yyreturnlab;
-/*-----------------------------------------------------.
-| yyreturn -- parsing is finished, return the result. |
-`-----------------------------------------------------*/
-yyreturn:
+/*----------------------------------------------------------.
+| yyreturnlab -- parsing is finished, clean up and return. |
+`----------------------------------------------------------*/
+yyreturnlab:
if (yychar != YYEMPTY)
{
/* Make sure we have latest lookahead translation. See comments at
@@ -2211,20 +1987,18 @@ yyreturn:
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[+*yyssp], yyvsp);
+ YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
-#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
-#endif
+
return yyresult;
}
-#line 439 "getdate.y"
+
+#line 416 "getdate.y"
/* Month and day table. */
@@ -2440,7 +2214,7 @@ static int LookupWord (char *buff)
/* Make it lowercase. */
for (p = buff; '\0' != *p; p++)
- if (ISUPPER (*p))
+ if (isupper (*p))
*p = tolower (*p);
if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
@@ -2521,7 +2295,7 @@ static int LookupWord (char *buff)
}
/* Military timezones. */
- if (buff[1] == '\0' && ISALPHA (*buff))
+ if (buff[1] == '\0' && isalpha (*buff))
{
for (tp = MilitaryTable; tp->name; tp++)
if (strcmp (buff, tp->name) == 0)
@@ -2560,30 +2334,30 @@ yylex (void)
for (;;)
{
- while (ISSPACE (*yyInput))
+ while (isspace (*yyInput))
yyInput++;
- if (ISDIGIT (c = *yyInput) || c == '-' || c == '+')
+ if (isdigit (c = *yyInput) || c == '-' || c == '+')
{
if (c == '-' || c == '+')
{
sign = c == '-' ? -1 : 1;
- if (!ISDIGIT (*++yyInput))
+ if (!isdigit (*++yyInput))
/* skip the '-' sign */
continue;
}
else
sign = 0;
- for (yylval.Number = 0; ISDIGIT (c = *yyInput++);)
+ for (yylval.Number = 0; isdigit (c = *yyInput++);)
yylval.Number = 10 * yylval.Number + c - '0';
yyInput--;
if (sign < 0)
yylval.Number = -yylval.Number;
return (0 != sign) ? tSNUMBER : tUNUMBER;
}
- if (ISALPHA (c))
+ if (isalpha (c))
{
- for (p = buff; (c = *yyInput++, ISALPHA (c)) || c == '.';)
+ for (p = buff; (c = *yyInput++, isalpha (c)) || c == '.';)
if (p < &buff[sizeof buff - 1])
*p++ = c;
*p = '\0';