Added date class
authorArjen Baart <arjen@andromeda.nl>
Thu, 20 Jun 2019 04:41:48 +0000 (06:41 +0200)
committerArjen Baart <arjen@andromeda.nl>
Thu, 20 Jun 2019 04:41:48 +0000 (06:41 +0200)
18 files changed:
ChangeLog
TODO
configure.ac
src/Makefile.am
src/date.cpp
src/date.h
src/datelex.c
src/dateyacc.c
src/dateyacc.y
test/Makefile.am
test/date_arithmetic.cpp [new file with mode: 0644]
test/date_arithmetic.exp [new file with mode: 0644]
test/date_assign.cpp [new file with mode: 0644]
test/date_assign.exp [new file with mode: 0644]
test/date_compare.cpp [new file with mode: 0644]
test/date_compare.exp [new file with mode: 0644]
test/date_parse.cpp [new file with mode: 0644]
test/date_parse.exp [new file with mode: 0644]

index 8a198f7..393ab1b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,3 +3,8 @@ May 30, 2019 - Release 0.1
 
    - Extracted the classes not related to X windows from AXE
    - Implemented and brushed up the String class.
+
+Jun 22, 2019 - Release 0.2
+============================
+
+   - Added date class
diff --git a/TODO b/TODO
index 098f0b8..c08422f 100644 (file)
--- a/TODO
+++ b/TODO
@@ -6,5 +6,8 @@ Things to do:
 - String: Implement String != regex operator
 - String: index and rindex methods with String argument
 
-- Include classes: date, time, complex, integer
+- date: test parser for invalid dates and syntax errors
+- date: Parser for stream input
+
+- Include classes: time, complex, integer
 
index 921e3fb..3c53ac7 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.69])
-AC_INIT([libACL], [0.1], [arjen@androemda.nl])
+AC_INIT([libACL], [0.2], [arjen@androemda.nl])
 AM_INIT_AUTOMAKE([-Wall foreign])
 AC_CONFIG_MACRO_DIRS([m4])
 AC_CONFIG_FILES([Makefile src/Makefile test/Makefile doc/Makefile])
@@ -12,6 +12,7 @@ AC_CONFIG_HEADERS([config.h])
 # Checks for programs.
 AC_PROG_CXX
 AC_PROG_CC
+AC_PROG_YACC
 AM_PROG_AR
 
 # Checks for libraries.
index 1f96230..e6dcf30 100644 (file)
@@ -1,5 +1,5 @@
 lib_LTLIBRARIES = libACL.la
 
-libACL_la_SOURCES = string.cpp regex.cpp
+libACL_la_SOURCES = string.cpp regex.cpp date.cpp parsedate.c dateyacc.y datelex.c
 
-include_HEADERS = String.h
+include_HEADERS = String.h date.h
index 6ba3375..9ee5d91 100644 (file)
@@ -56,7 +56,7 @@ static unsigned short mon[] =
    30, 31, 30, 31
 };
 
-static char * abr_month_name[] =
+static const char * abr_month_name[] =
 {
    "xxx",
    "Jan", "Feb", "Mar", "Apr",
index 2a500d4..338b87b 100644 (file)
@@ -96,6 +96,16 @@ public:
       return add(l);
    }
 
+   date operator ++ ()        // prefix
+   {
+      return add(1);
+   }
+
+   date operator ++ (int)     // postfix
+   {
+      return add(1);
+   }
+
    friend date operator-(unsigned long,  date);
    friend date operator-(date,  unsigned long);
    friend long operator-(date&, date&);
@@ -105,6 +115,16 @@ public:
       return subtract(l);
    }
 
+   date operator -- ()        // prefix
+   {
+      return subtract(1);
+   }
+
+   date operator -- (int)     // postfix
+   {
+      return subtract(1);
+   }
+
 //   long(date);        // Calculate nr. of days since...
 
    int operator==(date d)
index ac8e492..bb27781 100644 (file)
@@ -62,6 +62,7 @@ static char rcsident[] = "$Header: /cvsroot/lib/AXE/src/datelex.c,v 1.2 2002-09-
 #endif /* RCSIDENT */
 
 #include <stdio.h>
+#include <string.h>
 #include "dateyacc.h"
 #include "parsedate.h"
 
index 26ebc79..40fe98d 100644 (file)
@@ -1,21 +1,19 @@
+/* A Bison parser, made by GNU Bison 3.0.4.  */
 
-/* A Bison parser, made by GNU Bison 2.4.1.  */
+/* Bison implementation for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
 
-/* Skeleton implementation for Bison's Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   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
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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/>.  */
 
@@ -28,7 +26,7 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-   
+
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
@@ -46,7 +44,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.4.1"
+#define YYBISON_VERSION "3.0.4"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
 /* Pull parsers.  */
 #define YYPULL 1
 
-/* Using locations.  */
-#define YYLSP_NEEDED 0
 
 
 
 /* Copy the first part of user declarations.  */
-
-/* Line 189 of yacc.c  */
-#line 51 "dateyacc.y"
+#line 51 "dateyacc.y" /* yacc.c:339  */
 
 #ifdef RCSIDENT
 static char rcsident[] = "$Header: /cvsroot/lib/AXE/src/dateyacc.y,v 1.2 2002-09-28 06:58:45 arjen Exp $";
@@ -78,17 +72,20 @@ static char rcsident[] = "$Header: /cvsroot/lib/AXE/src/dateyacc.y,v 1.2 2002-09
 #include "parsedate.h"
 struct parseddate yyans;
 
+int yylex();
+
 /* No error routine is needed here. */
 #define yyerror(s)
 
+#line 81 "dateyacc.c" /* yacc.c:339  */
 
-/* Line 189 of yacc.c  */
-#line 87 "dateyacc.c"
-
-/* Enabling traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
+# ifndef YY_NULLPTR
+#  if defined __cplusplus && 201103L <= __cplusplus
+#   define YY_NULLPTR nullptr
+#  else
+#   define YY_NULLPTR 0
+#  endif
+# endif
 
 /* Enabling verbose error messages.  */
 #ifdef YYERROR_VERBOSE
@@ -98,63 +95,81 @@ struct parseddate yyans;
 # define YYERROR_VERBOSE 0
 #endif
 
-/* Enabling the token table.  */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
 
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
 
-/* Tokens.  */
+/* Token type.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     DAY_NAME = 258,
-     MONTH_NAME = 259,
-     NUM9 = 260,
-     NUM23 = 261,
-     NUM59 = 262,
-     NUM99 = 263,
-     NUM2359 = 264,
-     NUM9999 = 265,
-     NUM235959 = 266,
-     NUM991231 = 267,
-     NUM99991231 = 268,
-     AMPM = 269,
-     STD_ZONE = 270,
-     DST_ZONE = 271,
-     DST_SUFFIX = 272
-   };
+  enum yytokentype
+  {
+    DAY_NAME = 258,
+    MONTH_NAME = 259,
+    NUM9 = 260,
+    NUM23 = 261,
+    NUM59 = 262,
+    NUM99 = 263,
+    NUM2359 = 264,
+    NUM9999 = 265,
+    NUM235959 = 266,
+    NUM991231 = 267,
+    NUM99991231 = 268,
+    AMPM = 269,
+    STD_ZONE = 270,
+    DST_ZONE = 271,
+    DST_SUFFIX = 272
+  };
 #endif
-
-
-
+/* Tokens.  */
+#define DAY_NAME 258
+#define MONTH_NAME 259
+#define NUM9 260
+#define NUM23 261
+#define NUM59 262
+#define NUM99 263
+#define NUM2359 264
+#define NUM9999 265
+#define NUM235959 266
+#define NUM991231 267
+#define NUM99991231 268
+#define AMPM 269
+#define STD_ZONE 270
+#define DST_ZONE 271
+#define DST_SUFFIX 272
+
+/* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
 
-/* Line 214 of yacc.c  */
-#line 64 "dateyacc.y"
+union YYSTYPE
+{
+#line 66 "dateyacc.y" /* yacc.c:355  */
 
     int IntVal;
 
+#line 156 "dateyacc.c" /* yacc.c:355  */
+};
 
-
-/* Line 214 of yacc.c  */
-#line 146 "dateyacc.c"
-} YYSTYPE;
+typedef union YYSTYPE YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 #endif
 
 
-/* Copy the second part of user declarations.  */
+extern YYSTYPE yylval;
+
+int yyparse (void);
+
 
 
-/* Line 264 of yacc.c  */
-#line 158 "dateyacc.c"
+/* Copy the second part of user declarations.  */
+
+#line 173 "dateyacc.c" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -168,11 +183,8 @@ typedef unsigned char yytype_uint8;
 
 #ifdef YYTYPE_INT8
 typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
 #else
-typedef short int yytype_int8;
+typedef signed char yytype_int8;
 #endif
 
 #ifdef YYTYPE_UINT16
@@ -192,8 +204,7 @@ typedef short int yytype_int16;
 #  define YYSIZE_T __SIZE_TYPE__
 # elif defined size_t
 #  define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
+# elif ! defined YYSIZE_T
 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 #  define YYSIZE_T size_t
 # else
@@ -204,42 +215,71 @@ typedef short int yytype_int16;
 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
 
 #ifndef YY_
-# if YYENABLE_NLS
+# 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
+
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__                                               \
+      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
+     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+#  define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
 # 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)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
+#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
-static int
-YYID (yyi)
-    int yyi;
+# define YY_INITIAL_VALUE(Value) Value
 #endif
-{
-  return yyi;
-}
+#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
 
+
 #if ! defined yyoverflow || YYERROR_VERBOSE
 
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
@@ -257,11 +297,11 @@ YYID (yyi)
 #    define alloca _alloca
 #   else
 #    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
 #     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
@@ -269,8 +309,8 @@ YYID (yyi)
 # endif
 
 # ifdef YYSTACK_ALLOC
-   /* Pacify GCC's `empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+   /* Pacify GCC's 'empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
 #  ifndef YYSTACK_ALLOC_MAXIMUM
     /* The OS might guarantee only one guard page at the bottom of the stack,
        and a page size can be as small as 4096 bytes.  So we cannot safely
@@ -284,25 +324,23 @@ 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)))
+             && (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__ \
-     || defined __cplusplus || defined _MSC_VER)
+#   if ! defined malloc && ! defined EXIT_SUCCESS
 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__ \
-     || defined __cplusplus || defined _MSC_VER)
+#   if ! defined free && ! defined EXIT_SUCCESS
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
@@ -312,7 +350,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
 
 #if (! defined yyoverflow \
      && (! defined __cplusplus \
-        || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
 
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
@@ -330,42 +368,46 @@ 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
    elements in the stack, and YYPTR gives the new location of the
    stack.  Advance YYPTR to a properly aligned location for the next
    stack.  */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack)                          \
-    do                                                                 \
-      {                                                                        \
-       YYSIZE_T yynewbytes;                                            \
-       YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
-       Stack = &yyptr->Stack_alloc;                                    \
-       yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-       yyptr += yynewbytes / sizeof (*yyptr);                          \
-      }                                                                        \
-    while (YYID (0))
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
+    do                                                                  \
+      {                                                                 \
+        YYSIZE_T yynewbytes;                                            \
+        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+        Stack = &yyptr->Stack_alloc;                                    \
+        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / sizeof (*yyptr);                          \
+      }                                                                 \
+    while (0)
 
 #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 (0)
+#  endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  43
 /* YYLAST -- Last index in YYTABLE.  */
@@ -377,17 +419,19 @@ union yyalloc
 #define YYNNTS  20
 /* YYNRULES -- Number of rules.  */
 #define YYNRULES  125
-/* YYNRULES -- Number of states.  */
+/* YYNSTATES -- Number of states.  */
 #define YYNSTATES  189
 
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+   by yylex, with out-of-bounds checking.  */
 #define YYUNDEFTOK  2
 #define YYMAXUTOK   272
 
-#define YYTRANSLATE(YYX)                                               \
+#define YYTRANSLATE(YYX)                                                \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, without out-of-bounds checking.  */
 static const yytype_uint8 yytranslate[] =
 {
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -421,94 +465,26 @@ static const yytype_uint8 yytranslate[] =
 };
 
 #if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
-   YYRHS.  */
-static const yytype_uint16 yyprhs[] =
-{
-       0,     0,     3,     5,     7,     9,    11,    13,    16,    20,
-      25,    29,    34,    37,    41,    46,    50,    55,    57,    60,
-      64,    67,    71,    74,    78,    83,    86,    90,    94,    98,
-     102,   105,   109,   114,   116,   119,   123,   128,   131,   135,
-     139,   143,   147,   150,   154,   159,   161,   164,   168,   171,
-     175,   179,   184,   189,   193,   198,   203,   205,   207,   211,
-     215,   220,   222,   224,   227,   230,   234,   240,   244,   247,
-     251,   257,   261,   263,   265,   267,   270,   273,   276,   280,
-     284,   288,   292,   296,   298,   300,   302,   304,   306,   308,
-     311,   313,   316,   319,   323,   325,   327,   331,   335,   341,
-     347,   351,   355,   361,   367,   371,   375,   377,   379,   381,
-     384,   387,   391,   393,   396,   399,   403,   406,   410,   412,
-     416,   420,   422,   426,   430,   432
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
-static const yytype_int8 yyrhs[] =
-{
-      26,     0,    -1,     6,    -1,     7,    -1,     5,    -1,    24,
-      -1,    31,    -1,    31,    27,    -1,    31,    27,    36,    -1,
-      31,    27,    36,    34,    -1,    31,    27,    34,    -1,    31,
-      27,    34,    36,    -1,    31,    36,    -1,    31,    36,    27,
-      -1,    31,    36,    27,    34,    -1,    31,    36,    34,    -1,
-      31,    36,    34,    27,    -1,    28,    -1,    28,    27,    -1,
-      28,    27,    36,    -1,    28,    36,    -1,    28,    36,    27,
-      -1,    27,    31,    -1,    27,    31,    36,    -1,    27,    31,
-      36,    34,    -1,    27,    28,    -1,    27,    28,    36,    -1,
-      27,    36,    31,    -1,    27,    36,    28,    -1,    27,    36,
-      29,    -1,    27,    29,    -1,    27,    29,    36,    -1,    27,
-      34,    36,    31,    -1,    36,    -1,    36,    31,    -1,    36,
-      31,    27,    -1,    36,    31,    27,    34,    -1,    36,    28,
-      -1,    36,    28,    27,    -1,    36,    27,    31,    -1,    36,
-      27,    28,    -1,    36,    27,    29,    -1,    36,    29,    -1,
-      36,    29,    27,    -1,    36,    34,    27,    31,    -1,    29,
-      -1,    29,    27,    -1,    29,    27,    36,    -1,    29,    36,
-      -1,    29,    36,    27,    -1,    34,    27,    31,    -1,    34,
-      27,    31,    36,    -1,    34,    27,    36,    31,    -1,    34,
-      36,    31,    -1,    34,    36,    31,    27,    -1,    34,    36,
-      27,    31,    -1,     9,    -1,    27,    -1,    30,    18,    42,
-      -1,    30,    18,    36,    -1,    30,    18,    36,    27,    -1,
-       1,    -1,     3,    -1,     3,    18,    -1,    31,    34,    -1,
-      32,    19,    34,    -1,    25,    19,    25,    19,    34,    -1,
-      33,    20,    34,    -1,    34,    31,    -1,    34,    19,    32,
-      -1,    34,    19,    25,    19,    25,    -1,    34,    20,    33,
-      -1,    30,    -1,    12,    -1,    13,    -1,    25,    35,    -1,
-      35,    25,    -1,    25,    25,    -1,    25,    19,    35,    -1,
-      35,    19,    25,    -1,    25,    20,    35,    -1,    35,    20,
-      25,    -1,    25,    20,    25,    -1,     7,    -1,     6,    -1,
-       8,    -1,     9,    -1,    10,    -1,     4,    -1,     4,    18,
-      -1,    38,    -1,    37,    39,    -1,    37,    40,    -1,    37,
-      39,    40,    -1,     9,    -1,    38,    -1,     5,    21,    24,
-      -1,     5,    18,    24,    -1,     5,    21,    24,    21,    24,
-      -1,     5,    18,    24,    18,    24,    -1,     6,    21,    24,
-      -1,     6,    18,    24,    -1,     6,    21,    24,    21,    24,
-      -1,     6,    18,    24,    18,    24,    -1,     9,    21,    24,
-      -1,     9,    18,    24,    -1,    11,    -1,    14,    -1,    15,
-      -1,    15,    17,    -1,    19,    15,    -1,    19,    15,    17,
-      -1,    16,    -1,    19,    16,    -1,    22,    41,    -1,    19,
-      22,    41,    -1,    19,    41,    -1,    19,    19,    41,    -1,
-       5,    -1,     5,    21,    24,    -1,     5,    18,    24,    -1,
-       6,    -1,     6,    21,    24,    -1,     6,    18,    24,    -1,
-       9,    -1,     9,    -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,    87,    87,    88,    92,    93,    97,    98,    99,   100,
-     101,   102,   103,   104,   105,   106,   107,   108,   109,   110,
-     111,   112,   113,   114,   115,   116,   117,   118,   119,   120,
-     121,   122,   123,   124,   125,   126,   127,   128,   129,   130,
-     131,   132,   133,   134,   135,   136,   137,   138,   139,   140,
-     141,   142,   143,   144,   145,   146,   147,   152,   153,   154,
-     155,   156,   163,   165,   170,   171,   172,   174,   178,   179,
-     180,   182,   183,   187,   193,   201,   203,   205,   210,   212,
-     217,   219,   221,   226,   228,   230,   232,   234,   239,   241,
-     246,   247,   248,   249,   253,   258,   262,   267,   272,   277,
-     282,   287,   292,   297,   302,   307,   312,   320,   330,   332,
-     334,   336,   338,   340,   342,   344,   346,   348,   353,   355,
-     357,   359,   361,   363,   365,   370
+       0,    89,    89,    90,    94,    95,    99,   100,   101,   102,
+     103,   104,   105,   106,   107,   108,   109,   110,   111,   112,
+     113,   114,   115,   116,   117,   118,   119,   120,   121,   122,
+     123,   124,   125,   126,   127,   128,   129,   130,   131,   132,
+     133,   134,   135,   136,   137,   138,   139,   140,   141,   142,
+     143,   144,   145,   146,   147,   148,   149,   154,   155,   156,
+     157,   158,   165,   167,   172,   173,   174,   176,   180,   181,
+     182,   184,   185,   189,   195,   203,   205,   207,   212,   214,
+     219,   221,   223,   228,   230,   232,   234,   236,   241,   243,
+     248,   249,   250,   251,   255,   260,   264,   269,   274,   279,
+     284,   289,   294,   299,   304,   309,   314,   322,   332,   334,
+     336,   338,   340,   342,   344,   346,   348,   350,   355,   357,
+     359,   361,   363,   365,   367,   372
 };
 #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[] =
@@ -519,13 +495,13 @@ static const char *const yytname[] =
   "'.'", "'-'", "'/'", "':'", "'+'", "$accept", "num59", "num", "goal",
   "dayname", "date.year", "year.date", "yymmdd", "date", "hyphen.date",
   "slash.date", "year", "month.name", "time", "hour", "hour.alone",
-  "am.pm", "zone", "zone.offset", "time2359", 0
+  "am.pm", "zone", "zone.offset", "time2359", YY_NULLPTR
 };
 #endif
 
 # ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
-   token YYLEX-NUM.  */
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+   (internal) symbol number NUM (which must be that of a token).  */
 static const yytype_uint16 yytoknum[] =
 {
        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
@@ -534,78 +510,18 @@ static const yytype_uint16 yytoknum[] =
 };
 # endif
 
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
-{
-       0,    23,    24,    24,    25,    25,    26,    26,    26,    26,
-      26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
-      26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
-      26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
-      26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
-      26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
-      26,    26,    27,    27,    28,    28,    28,    28,    29,    29,
-      29,    29,    29,    30,    30,    31,    31,    31,    32,    32,
-      33,    33,    33,    34,    34,    34,    34,    34,    35,    35,
-      36,    36,    36,    36,    37,    37,    38,    38,    38,    38,
-      38,    38,    38,    38,    38,    38,    38,    39,    40,    40,
-      40,    40,    40,    40,    40,    40,    40,    40,    41,    41,
-      41,    41,    41,    41,    41,    42
-};
+#define YYPACT_NINF -88
 
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
-{
-       0,     2,     1,     1,     1,     1,     1,     2,     3,     4,
-       3,     4,     2,     3,     4,     3,     4,     1,     2,     3,
-       2,     3,     2,     3,     4,     2,     3,     3,     3,     3,
-       2,     3,     4,     1,     2,     3,     4,     2,     3,     3,
-       3,     3,     2,     3,     4,     1,     2,     3,     2,     3,
-       3,     4,     4,     3,     4,     4,     1,     1,     3,     3,
-       4,     1,     1,     2,     2,     3,     5,     3,     2,     3,
-       5,     3,     1,     1,     1,     2,     2,     2,     3,     3,
-       3,     3,     3,     1,     1,     1,     1,     1,     1,     2,
-       1,     2,     2,     3,     1,     1,     3,     3,     5,     5,
-       3,     3,     5,     5,     3,     3,     1,     1,     1,     2,
-       2,     3,     1,     2,     2,     3,     2,     3,     1,     3,
-       3,     1,     3,     3,     1,     1
-};
+#define yypact_value_is_default(Yystate) \
+  (!!((Yystate) == (-88)))
 
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
-   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
-   means the default is an error.  */
-static const yytype_uint8 yydefact[] =
-{
-       0,    61,    62,    88,     4,     2,     3,    85,    86,    87,
-     106,    73,    74,     5,     0,     0,    57,    17,    45,    72,
-       6,     0,     0,     0,     0,    33,     0,    90,    63,    89,
-       0,     0,     0,     0,     0,     0,     4,     2,     3,     0,
-       0,    77,    75,     1,    86,    25,    30,    72,    22,     0,
-       0,     0,     0,    94,    18,    20,    46,    48,     0,    84,
-      83,     7,    64,    12,     0,     0,     2,     0,     0,     0,
-       0,    68,     0,     0,     0,     0,    76,     2,    86,     0,
-      37,    42,    34,     0,   107,   108,   112,     0,     0,    91,
-      92,    97,    96,   101,   100,   105,   104,     0,    78,    82,
-      80,    26,    31,    23,     0,    28,    29,    27,     0,    19,
-      21,    47,    49,    94,    59,    58,    10,     8,    84,    13,
-      15,    65,    67,     0,    69,     0,     0,    71,     0,    50,
-       0,     0,    53,    79,    81,    40,    41,    39,    38,    43,
-      35,     0,   109,   118,   121,   124,   110,   113,     0,     0,
-     116,   114,    93,     0,     0,     0,     0,     0,    24,    32,
-      60,    11,     9,    14,    16,     0,    51,    52,    55,    54,
-      36,    44,     0,     0,     0,     0,   111,   117,   115,    99,
-      98,   103,   102,    66,    70,   120,   119,   123,   122
-};
+#define YYTABLE_NINF -126
 
-/* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int16 yydefgoto[] =
-{
-      -1,    13,    69,    15,    16,    17,    18,    47,    71,    21,
-      22,    62,    72,    25,    26,    27,    89,    90,   150,   115
-};
+#define yytable_value_is_error(Yytable_value) \
+  0
 
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
-#define YYPACT_NINF -88
+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
 static const yytype_int16 yypact[] =
 {
      250,   -88,    -3,    19,    14,    25,    62,   -88,    86,   -88,
@@ -629,18 +545,49 @@ static const yytype_int16 yypact[] =
      -88,   -88,   -88,   -88,   -88,   -88,   -88,   -88,   -88
 };
 
-/* YYPGOTO[NTERM-NUM].  */
+  /* 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_uint8 yydefact[] =
+{
+       0,    61,    62,    88,     4,     2,     3,    85,    86,    87,
+     106,    73,    74,     5,     0,     0,    57,    17,    45,    72,
+       6,     0,     0,     0,     0,    33,     0,    90,    63,    89,
+       0,     0,     0,     0,     0,     0,     4,     2,     3,     0,
+       0,    77,    75,     1,    86,    25,    30,    72,    22,     0,
+       0,     0,     0,    94,    18,    20,    46,    48,     0,    84,
+      83,     7,    64,    12,     0,     0,     2,     0,     0,     0,
+       0,    68,     0,     0,     0,     0,    76,     2,    86,     0,
+      37,    42,    34,     0,   107,   108,   112,     0,     0,    91,
+      92,    97,    96,   101,   100,   105,   104,     0,    78,    82,
+      80,    26,    31,    23,     0,    28,    29,    27,     0,    19,
+      21,    47,    49,    94,    59,    58,    10,     8,    84,    13,
+      15,    65,    67,     0,    69,     0,     0,    71,     0,    50,
+       0,     0,    53,    79,    81,    40,    41,    39,    38,    43,
+      35,     0,   109,   118,   121,   124,   110,   113,     0,     0,
+     116,   114,    93,     0,     0,     0,     0,     0,    24,    32,
+      60,    11,     9,    14,    16,     0,    51,    52,    55,    54,
+      36,    44,     0,     0,     0,     0,   111,   117,   115,    99,
+      98,   103,   102,    66,    70,   120,   119,   123,   122
+};
+
+  /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
      -88,   -23,     0,   -88,    99,     5,     6,   157,    33,   100,
       85,    26,    13,   153,   -88,   -88,   -88,    79,   -87,   -88
 };
 
-/* 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.  */
-#define YYTABLE_NINF -126
+  /* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int16 yydefgoto[] =
+{
+      -1,    13,    69,    15,    16,    17,    18,    47,    71,    21,
+      22,    62,    72,    25,    26,    27,    89,    90,   150,   115
+};
+
+  /* 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_int16 yytable[] =
 {
       14,   151,  -125,     3,    36,    37,    38,    91,    92,    93,
@@ -723,8 +670,8 @@ static const yytype_int16 yycheck[] =
        5,     6,     7,     4,     5,     6,     7
 };
 
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
+  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+     symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
        0,     1,     3,     4,     5,     6,     7,     8,     9,    10,
@@ -748,95 +695,77 @@ static const yytype_uint8 yystos[] =
       24,    24,    24,    34,    25,    24,    24,    24,    24
 };
 
-#define yyerrok                (yyerrstatus = 0)
-#define yyclearin      (yychar = YYEMPTY)
-#define YYEMPTY                (-2)
-#define YYEOF          0
+  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,    23,    24,    24,    25,    25,    26,    26,    26,    26,
+      26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
+      26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
+      26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
+      26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
+      26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
+      26,    26,    27,    27,    28,    28,    28,    28,    29,    29,
+      29,    29,    29,    30,    30,    31,    31,    31,    32,    32,
+      33,    33,    33,    34,    34,    34,    34,    34,    35,    35,
+      36,    36,    36,    36,    37,    37,    38,    38,    38,    38,
+      38,    38,    38,    38,    38,    38,    38,    39,    40,    40,
+      40,    40,    40,    40,    40,    40,    40,    40,    41,    41,
+      41,    41,    41,    41,    41,    42
+};
+
+  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
+{
+       0,     2,     1,     1,     1,     1,     1,     2,     3,     4,
+       3,     4,     2,     3,     4,     3,     4,     1,     2,     3,
+       2,     3,     2,     3,     4,     2,     3,     3,     3,     3,
+       2,     3,     4,     1,     2,     3,     4,     2,     3,     3,
+       3,     3,     2,     3,     4,     1,     2,     3,     2,     3,
+       3,     4,     4,     3,     4,     4,     1,     1,     3,     3,
+       4,     1,     1,     2,     2,     3,     5,     3,     2,     3,
+       5,     3,     1,     1,     1,     2,     2,     2,     3,     3,
+       3,     3,     3,     1,     1,     1,     1,     1,     1,     2,
+       1,     2,     2,     3,     1,     1,     3,     3,     5,     5,
+       3,     3,     5,     5,     3,     3,     1,     1,     1,     2,
+       2,     3,     1,     2,     2,     3,     2,     3,     1,     3,
+       3,     1,     3,     3,     1,     1
+};
 
-#define YYACCEPT       goto yyacceptlab
-#define YYABORT                goto yyabortlab
-#define YYERROR                goto yyerrorlab
 
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = YYEMPTY)
+#define YYEMPTY         (-2)
+#define YYEOF           0
 
-/* Like YYERROR except do call yyerror.  This remains here temporarily
-   to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  */
+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
 
-#define YYFAIL         goto yyerrlab
 
 #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 (YY_("syntax error: cannot back up")); \
-      YYERROR;                                                 \
-    }                                                          \
-while (YYID (0))
-
-
-#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.  */
-
-#ifndef YY_LOCATION_PRINT
-# if 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
-#endif
+      YYERROR;                                                  \
+    }                                                           \
+while (0)
 
+/* Error token number */
+#define YYTERROR        1
+#define YYERRCODE       256
 
-/* YYLEX -- calling `yylex' with the right arguments.  */
 
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (YYLEX_PARAM)
-#else
-# define YYLEX yylex ()
-#endif
 
 /* Enable debugging if requested.  */
 #if YYDEBUG
@@ -846,54 +775,46 @@ while (YYID (0))
 #  define YYFPRINTF fprintf
 # endif
 
-# define YYDPRINTF(Args)                       \
-do {                                           \
-  if (yydebug)                                 \
-    YYFPRINTF Args;                            \
-} while (YYID (0))
+# define YYDPRINTF(Args)                        \
+do {                                            \
+  if (yydebug)                                  \
+    YYFPRINTF Args;                             \
+} while (0)
 
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                   \
-do {                                                                     \
-  if (yydebug)                                                           \
-    {                                                                    \
-      YYFPRINTF (stderr, "%s ", Title);                                          \
-      yy_symbol_print (stderr,                                           \
-                 Type, Value); \
-      YYFPRINTF (stderr, "\n");                                                  \
-    }                                                                    \
-} while (YYID (0))
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
 
 
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, "%s ", Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Type, Value); \
+      YYFPRINTF (stderr, "\n");                                           \
+    }                                                                     \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT.  |
+`----------------------------------------*/
 
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-#endif
 {
+  FILE *yyo = yyoutput;
+  YYUSE (yyo);
   if (!yyvaluep)
     return;
 # ifdef YYPRINT
   if (yytype < YYNTOKENS)
     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
-  YYUSE (yyoutput);
 # endif
-  switch (yytype)
-    {
-      default:
-       break;
-    }
+  YYUSE (yytype);
 }
 
 
@@ -901,22 +822,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
 | Print this symbol on YYOUTPUT.  |
 `--------------------------------*/
 
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-#endif
 {
-  if (yytype < YYNTOKENS)
-    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
-  else
-    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+  YYFPRINTF (yyoutput, "%s %s (",
+             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
 
   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
   YYFPRINTF (yyoutput, ")");
@@ -927,16 +837,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
 | TOP (included).                                                   |
 `------------------------------------------------------------------*/
 
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
-    yytype_int16 *yybottom;
-    yytype_int16 *yytop;
-#endif
 {
   YYFPRINTF (stderr, "Stack now");
   for (; yybottom <= yytop; yybottom++)
@@ -947,49 +849,42 @@ yy_stack_print (yybottom, yytop)
   YYFPRINTF (stderr, "\n");
 }
 
-# define YY_STACK_PRINT(Bottom, Top)                           \
-do {                                                           \
-  if (yydebug)                                                 \
-    yy_stack_print ((Bottom), (Top));                          \
-} while (YYID (0))
+# define YY_STACK_PRINT(Bottom, Top)                            \
+do {                                                            \
+  if (yydebug)                                                  \
+    yy_stack_print ((Bottom), (Top));                           \
+} while (0)
 
 
 /*------------------------------------------------.
 | Report that the YYRULE is going to be reduced.  |
 `------------------------------------------------*/
 
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule)
-    YYSTYPE *yyvsp;
-    int yyrule;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
 {
+  unsigned long int yylno = yyrline[yyrule];
   int yynrhs = yyr2[yyrule];
   int yyi;
-  unsigned long int yylno = yyrline[yyrule];
   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
-            yyrule - 1, yylno);
+             yyrule - 1, yylno);
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
-                      &(yyvsp[(yyi + 1) - (yynrhs)])
-                                      );
+      yy_symbol_print (stderr,
+                       yystos[yyssp[yyi + 1 - yynrhs]],
+                       &(yyvsp[(yyi + 1) - (yynrhs)])
+                                              );
       YYFPRINTF (stderr, "\n");
     }
 }
 
-# define YY_REDUCE_PRINT(Rule)         \
-do {                                   \
-  if (yydebug)                         \
-    yy_reduce_print (yyvsp, Rule); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, Rule); \
+} while (0)
 
 /* Nonzero means print parse trace.  It is left uninitialized so that
    multiple parsers can coexist.  */
@@ -1003,7 +898,7 @@ int yydebug;
 
 
 /* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef        YYINITDEPTH
+#ifndef YYINITDEPTH
 # define YYINITDEPTH 200
 #endif
 
@@ -1018,7 +913,6 @@ int yydebug;
 # define YYMAXDEPTH 10000
 #endif
 
-\f
 
 #if YYERROR_VERBOSE
 
@@ -1027,15 +921,8 @@ int yydebug;
 #   define yystrlen strlen
 #  else
 /* Return the length of YYSTR.  */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static YYSIZE_T
 yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
-    const char *yystr;
-#endif
 {
   YYSIZE_T yylen;
   for (yylen = 0; yystr[yylen]; yylen++)
@@ -1051,16 +938,8 @@ yystrlen (yystr)
 #  else
 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
    YYDEST.  */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static char *
 yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
-    char *yydest;
-    const char *yysrc;
-#endif
 {
   char *yyd = yydest;
   const char *yys = yysrc;
@@ -1090,27 +969,27 @@ yytnamerr (char *yyres, const char *yystr)
       char const *yyp = yystr;
 
       for (;;)
-       switch (*++yyp)
-         {
-         case '\'':
-         case ',':
-           goto do_not_strip_quotes;
-
-         case '\\':
-           if (*++yyp != '\\')
-             goto do_not_strip_quotes;
-           /* Fall through.  */
-         default:
-           if (yyres)
-             yyres[yyn] = *yyp;
-           yyn++;
-           break;
-
-         case '"':
-           if (yyres)
-             yyres[yyn] = '\0';
-           return yyn;
-         }
+        switch (*++yyp)
+          {
+          case '\'':
+          case ',':
+            goto do_not_strip_quotes;
+
+          case '\\':
+            if (*++yyp != '\\')
+              goto do_not_strip_quotes;
+            /* Fall through.  */
+          default:
+            if (yyres)
+              yyres[yyn] = *yyp;
+            yyn++;
+            break;
+
+          case '"':
+            if (yyres)
+              yyres[yyn] = '\0';
+            return yyn;
+          }
     do_not_strip_quotes: ;
     }
 
@@ -1121,161 +1000,160 @@ 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)
+/* 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 (YYSIZE_T *yymsg_alloc, char **yymsg,
+                yytype_int16 *yyssp, int yytoken)
 {
-  int yyn = yypact[yystate];
+  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+  YYSIZE_T yysize = yysize0;
+  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+  /* Internationalized format string. */
+  const char *yyformat = YY_NULLPTR;
+  /* 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:
+     - 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];
+      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_NULLPTR, yytname[yyx]);
+                  if (! (yysize <= yysize1
+                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                    return 2;
+                  yysize = yysize1;
+                }
+              }
+        }
+    }
 
-  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
-    return 0;
-  else
+  switch (yycount)
     {
-      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;
-         }
-
-      yyf = YY_(yyformat);
-      yysize1 = yysize + yystrlen (yyf);
-      yysize_overflow |= (yysize1 < yysize);
-      yysize = yysize1;
-
-      if (yysize_overflow)
-       return YYSIZE_MAXIMUM;
-
-      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;
+# 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_
+    }
+
+  {
+    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+      return 2;
+    yysize = yysize1;
+  }
+
+  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 */
-\f
 
 /*-----------------------------------------------.
 | Release the memory associated to this symbol.  |
 `-----------------------------------------------*/
 
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep)
-    const char *yymsg;
-    int yytype;
-    YYSTYPE *yyvaluep;
-#endif
 {
   YYUSE (yyvaluep);
-
   if (!yymsg)
     yymsg = "Deleting";
   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 
-  switch (yytype)
-    {
-
-      default:
-       break;
-    }
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YYUSE (yytype);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
-/* 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 (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
+
 
 
 /* The lookahead symbol.  */
@@ -1283,49 +1161,26 @@ int yychar;
 
 /* The semantic value of the lookahead symbol.  */
 YYSTYPE yylval;
-
 /* Number of syntax errors so far.  */
 int yynerrs;
 
 
+/*----------.
+| yyparse.  |
+`----------*/
 
-/*-------------------------.
-| yyparse or yypush_parse.  |
-`-------------------------*/
-
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
-    void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 int
 yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
 {
-
-
     int yystate;
     /* 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.
+       '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.  */
@@ -1343,7 +1198,7 @@ yyparse ()
   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;
@@ -1361,9 +1216,8 @@ yyparse ()
      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"));
@@ -1372,14 +1226,6 @@ yyparse ()
   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;
 
 /*------------------------------------------------------------.
@@ -1400,23 +1246,23 @@ yyparse ()
 
 #ifdef yyoverflow
       {
-       /* Give user a chance to reallocate the stack.  Use copies of
-          these so that the &'s don't force the real ones into
-          memory.  */
-       YYSTYPE *yyvs1 = yyvs;
-       yytype_int16 *yyss1 = yyss;
-
-       /* Each stack pointer address is followed by the size of the
-          data in use in that stack, in bytes.  This used to be a
-          conditional around just the two extra args, but that might
-          be undefined if yyoverflow is a macro.  */
-       yyoverflow (YY_("memory exhausted"),
-                   &yyss1, yysize * sizeof (*yyssp),
-                   &yyvs1, yysize * sizeof (*yyvsp),
-                   &yystacksize);
-
-       yyss = yyss1;
-       yyvs = yyvs1;
+        /* Give user a chance to reallocate the stack.  Use copies of
+           these so that the &'s don't force the real ones into
+           memory.  */
+        YYSTYPE *yyvs1 = yyvs;
+        yytype_int16 *yyss1 = yyss;
+
+        /* Each stack pointer address is followed by the size of the
+           data in use in that stack, in bytes.  This used to be a
+           conditional around just the two extra args, but that might
+           be undefined if yyoverflow is a macro.  */
+        yyoverflow (YY_("memory exhausted"),
+                    &yyss1, yysize * sizeof (*yyssp),
+                    &yyvs1, yysize * sizeof (*yyvsp),
+                    &yystacksize);
+
+        yyss = yyss1;
+        yyvs = yyvs1;
       }
 #else /* no yyoverflow */
 # ifndef YYSTACK_RELOCATE
@@ -1424,22 +1270,22 @@ yyparse ()
 # else
       /* Extend the stack our own way.  */
       if (YYMAXDEPTH <= yystacksize)
-       goto yyexhaustedlab;
+        goto yyexhaustedlab;
       yystacksize *= 2;
       if (YYMAXDEPTH < yystacksize)
-       yystacksize = YYMAXDEPTH;
+        yystacksize = YYMAXDEPTH;
 
       {
-       yytype_int16 *yyss1 = yyss;
-       union yyalloc *yyptr =
-         (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-       if (! yyptr)
-         goto yyexhaustedlab;
-       YYSTACK_RELOCATE (yyss_alloc, yyss);
-       YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+        yytype_int16 *yyss1 = yyss;
+        union yyalloc *yyptr =
+          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+        if (! yyptr)
+          goto yyexhaustedlab;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 #  undef YYSTACK_RELOCATE
-       if (yyss1 != yyssa)
-         YYSTACK_FREE (yyss1);
+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
       }
 # endif
 #endif /* no yyoverflow */
@@ -1448,10 +1294,10 @@ yyparse ()
       yyvsp = yyvs + yysize - 1;
 
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-                 (unsigned long int) yystacksize));
+                  (unsigned long int) yystacksize));
 
       if (yyss + yystacksize - 1 <= yyssp)
-       YYABORT;
+        YYABORT;
     }
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1471,7 +1317,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.  */
@@ -1480,7 +1326,7 @@ yybackup:
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
-      yychar = YYLEX;
+      yychar = yylex ();
     }
 
   if (yychar <= YYEOF)
@@ -1502,8 +1348,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;
     }
@@ -1520,7 +1366,9 @@ yybackup:
   yychar = YYEMPTY;
 
   yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
   goto yynewstate;
 
@@ -1543,7 +1391,7 @@ yyreduce:
   yylen = yyr2[yyn];
 
   /* If YYLEN is nonzero, implement the default value of the action:
-     `$$ = $1'.
+     '$$ = $1'.
 
      Otherwise, the following line sets YYVAL to garbage.
      This behavior is undocumented and Bison
@@ -1557,444 +1405,399 @@ yyreduce:
   switch (yyn)
     {
         case 56:
-
-/* Line 1455 of yacc.c  */
-#line 148 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (1)].IntVal) / 100;
-         yyans.minute = (yyvsp[(1) - (1)].IntVal) % 100;
+#line 150 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[0].IntVal) / 100;
+         yyans.minute = (yyvsp[0].IntVal) % 100;
          yyans.second = -1;            /* unspecified */
-       ;}
+       }
+#line 1414 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 61:
-
-/* Line 1455 of yacc.c  */
-#line 157 "dateyacc.y"
+#line 159 "dateyacc.y" /* yacc.c:1646  */
     { extern char *yyinbuf;
          if (yyans.error == NULL) yyans.error = yyinbuf;
-       ;}
+       }
+#line 1422 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 62:
-
-/* Line 1455 of yacc.c  */
-#line 164 "dateyacc.y"
-    { yyans.c_weekday = (yyvsp[(1) - (1)].IntVal); ;}
+#line 166 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.c_weekday = (yyvsp[0].IntVal); }
+#line 1428 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 63:
-
-/* Line 1455 of yacc.c  */
-#line 166 "dateyacc.y"
-    { yyans.c_weekday = (yyvsp[(1) - (2)].IntVal); ;}
+#line 168 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.c_weekday = (yyvsp[-1].IntVal); }
+#line 1434 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 66:
-
-/* Line 1455 of yacc.c  */
-#line 173 "dateyacc.y"
-    { yyans.day = (yyvsp[(1) - (5)].IntVal); yyans.month = (yyvsp[(3) - (5)].IntVal); ;}
+#line 175 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.day = (yyvsp[-4].IntVal); yyans.month = (yyvsp[-2].IntVal); }
+#line 1440 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 70:
-
-/* Line 1455 of yacc.c  */
-#line 181 "dateyacc.y"
-    { yyans.day = (yyvsp[(5) - (5)].IntVal); yyans.month = (yyvsp[(3) - (5)].IntVal); ;}
+#line 183 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.day = (yyvsp[0].IntVal); yyans.month = (yyvsp[-2].IntVal); }
+#line 1446 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 73:
-
-/* Line 1455 of yacc.c  */
-#line 188 "dateyacc.y"
-    { yyans.year  = ((yyvsp[(1) - (1)].IntVal) / 10000) + 1900;        /* ajs */
-         yyans.month = ((yyvsp[(1) - (1)].IntVal) % 10000) / 100;      /* ajs */
-         yyans.day   = ((yyvsp[(1) - (1)].IntVal) % 100);              /* ajs */
-       ;}
+#line 190 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.year  = ((yyvsp[0].IntVal) / 10000) + 1900;        /* ajs */
+         yyans.month = ((yyvsp[0].IntVal) % 10000) / 100;      /* ajs */
+         yyans.day   = ((yyvsp[0].IntVal) % 100);              /* ajs */
+       }
+#line 1455 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 74:
-
-/* Line 1455 of yacc.c  */
-#line 194 "dateyacc.y"
-    { yyans.year  = ((yyvsp[(1) - (1)].IntVal) / 10000);               /* ajs */
-         yyans.month = ((yyvsp[(1) - (1)].IntVal) % 10000) / 100;      /* ajs */
-         yyans.day   = ((yyvsp[(1) - (1)].IntVal) % 100);              /* ajs */
-       ;}
+#line 196 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.year  = ((yyvsp[0].IntVal) / 10000);               /* ajs */
+         yyans.month = ((yyvsp[0].IntVal) % 10000) / 100;      /* ajs */
+         yyans.day   = ((yyvsp[0].IntVal) % 100);              /* ajs */
+       }
+#line 1464 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 75:
-
-/* Line 1455 of yacc.c  */
-#line 202 "dateyacc.y"
-    { yyans.day = (yyvsp[(1) - (2)].IntVal); ;}
+#line 204 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.day = (yyvsp[-1].IntVal); }
+#line 1470 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 76:
-
-/* Line 1455 of yacc.c  */
-#line 204 "dateyacc.y"
-    { yyans.day = (yyvsp[(2) - (2)].IntVal); ;}
+#line 206 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.day = (yyvsp[0].IntVal); }
+#line 1476 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 77:
-
-/* Line 1455 of yacc.c  */
-#line 206 "dateyacc.y"
-    { yyans.month = (yyvsp[(1) - (2)].IntVal); yyans.day = (yyvsp[(2) - (2)].IntVal); ;}
+#line 208 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.month = (yyvsp[-1].IntVal); yyans.day = (yyvsp[0].IntVal); }
+#line 1482 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 78:
-
-/* Line 1455 of yacc.c  */
-#line 211 "dateyacc.y"
-    { yyans.day = (yyvsp[(1) - (3)].IntVal); ;}
+#line 213 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.day = (yyvsp[-2].IntVal); }
+#line 1488 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 79:
-
-/* Line 1455 of yacc.c  */
-#line 213 "dateyacc.y"
-    { yyans.day = (yyvsp[(3) - (3)].IntVal); ;}
+#line 215 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.day = (yyvsp[0].IntVal); }
+#line 1494 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 80:
-
-/* Line 1455 of yacc.c  */
-#line 218 "dateyacc.y"
-    { yyans.day = (yyvsp[(1) - (3)].IntVal); ;}
+#line 220 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.day = (yyvsp[-2].IntVal); }
+#line 1500 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 81:
-
-/* Line 1455 of yacc.c  */
-#line 220 "dateyacc.y"
-    { yyans.day = (yyvsp[(3) - (3)].IntVal); ;}
+#line 222 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.day = (yyvsp[0].IntVal); }
+#line 1506 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 82:
-
-/* Line 1455 of yacc.c  */
-#line 222 "dateyacc.y"
-    { yyans.month = (yyvsp[(1) - (3)].IntVal); yyans.day = (yyvsp[(3) - (3)].IntVal); ;}
+#line 224 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.month = (yyvsp[-2].IntVal); yyans.day = (yyvsp[0].IntVal); }
+#line 1512 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 83:
-
-/* Line 1455 of yacc.c  */
-#line 227 "dateyacc.y"
-    { yyans.year = 2000 + (yyvsp[(1) - (1)].IntVal); ;}
+#line 229 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.year = 2000 + (yyvsp[0].IntVal); }
+#line 1518 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 84:
-
-/* Line 1455 of yacc.c  */
-#line 229 "dateyacc.y"
-    { yyans.year = 2000 + (yyvsp[(1) - (1)].IntVal); ;}
+#line 231 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.year = 2000 + (yyvsp[0].IntVal); }
+#line 1524 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 85:
-
-/* Line 1455 of yacc.c  */
-#line 231 "dateyacc.y"
-    { yyans.year = 1900 + (yyvsp[(1) - (1)].IntVal); ;}
+#line 233 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.year = 1900 + (yyvsp[0].IntVal); }
+#line 1530 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 86:
-
-/* Line 1455 of yacc.c  */
-#line 233 "dateyacc.y"
-    { yyans.year = (yyvsp[(1) - (1)].IntVal); ;}
+#line 235 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.year = (yyvsp[0].IntVal); }
+#line 1536 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 87:
-
-/* Line 1455 of yacc.c  */
-#line 235 "dateyacc.y"
-    { yyans.year = (yyvsp[(1) - (1)].IntVal); ;}
+#line 237 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.year = (yyvsp[0].IntVal); }
+#line 1542 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 88:
-
-/* Line 1455 of yacc.c  */
-#line 240 "dateyacc.y"
-    { yyans.month = (yyvsp[(1) - (1)].IntVal); ;}
+#line 242 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.month = (yyvsp[0].IntVal); }
+#line 1548 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 89:
-
-/* Line 1455 of yacc.c  */
-#line 242 "dateyacc.y"
-    { yyans.month = (yyvsp[(1) - (2)].IntVal); ;}
+#line 244 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.month = (yyvsp[-1].IntVal); }
+#line 1554 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 94:
-
-/* Line 1455 of yacc.c  */
-#line 254 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (1)].IntVal) / 100;
-         yyans.minute = (yyvsp[(1) - (1)].IntVal) % 100;
+#line 256 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[0].IntVal) / 100;
+         yyans.minute = (yyvsp[0].IntVal) % 100;
          yyans.second = -1;            /* unspecified */
-       ;}
+       }
+#line 1563 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 96:
-
-/* Line 1455 of yacc.c  */
-#line 263 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (3)].IntVal);
-         yyans.minute = (yyvsp[(3) - (3)].IntVal);
+#line 265 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[-2].IntVal);
+         yyans.minute = (yyvsp[0].IntVal);
          yyans.second = -1;            /* unspecified */
-       ;}
+       }
+#line 1572 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 97:
-
-/* Line 1455 of yacc.c  */
-#line 268 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (3)].IntVal);
-         yyans.minute = (yyvsp[(3) - (3)].IntVal);
+#line 270 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[-2].IntVal);
+         yyans.minute = (yyvsp[0].IntVal);
          yyans.second = -1;            /* unspecified */
-       ;}
+       }
+#line 1581 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 98:
-
-/* Line 1455 of yacc.c  */
-#line 273 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (5)].IntVal);
-         yyans.minute = (yyvsp[(3) - (5)].IntVal);
-         yyans.second = (yyvsp[(5) - (5)].IntVal);
-       ;}
+#line 275 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[-4].IntVal);
+         yyans.minute = (yyvsp[-2].IntVal);
+         yyans.second = (yyvsp[0].IntVal);
+       }
+#line 1590 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 99:
-
-/* Line 1455 of yacc.c  */
-#line 278 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (5)].IntVal);
-         yyans.minute = (yyvsp[(3) - (5)].IntVal);
-         yyans.second = (yyvsp[(5) - (5)].IntVal);
-       ;}
+#line 280 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[-4].IntVal);
+         yyans.minute = (yyvsp[-2].IntVal);
+         yyans.second = (yyvsp[0].IntVal);
+       }
+#line 1599 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 100:
-
-/* Line 1455 of yacc.c  */
-#line 283 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (3)].IntVal);
-         yyans.minute = (yyvsp[(3) - (3)].IntVal);
+#line 285 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[-2].IntVal);
+         yyans.minute = (yyvsp[0].IntVal);
          yyans.second = -1;            /* unspecified */
-       ;}
+       }
+#line 1608 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 101:
-
-/* Line 1455 of yacc.c  */
-#line 288 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (3)].IntVal);
-         yyans.minute = (yyvsp[(3) - (3)].IntVal);
+#line 290 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[-2].IntVal);
+         yyans.minute = (yyvsp[0].IntVal);
          yyans.second = -1;            /* unspecified */
-       ;}
+       }
+#line 1617 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 102:
-
-/* Line 1455 of yacc.c  */
-#line 293 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (5)].IntVal);
-         yyans.minute = (yyvsp[(3) - (5)].IntVal);
-         yyans.second = (yyvsp[(5) - (5)].IntVal);
-       ;}
+#line 295 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[-4].IntVal);
+         yyans.minute = (yyvsp[-2].IntVal);
+         yyans.second = (yyvsp[0].IntVal);
+       }
+#line 1626 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 103:
-
-/* Line 1455 of yacc.c  */
-#line 298 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (5)].IntVal);
-         yyans.minute = (yyvsp[(3) - (5)].IntVal);
-         yyans.second = (yyvsp[(5) - (5)].IntVal);
-       ;}
+#line 300 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[-4].IntVal);
+         yyans.minute = (yyvsp[-2].IntVal);
+         yyans.second = (yyvsp[0].IntVal);
+       }
+#line 1635 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 104:
-
-/* Line 1455 of yacc.c  */
-#line 303 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (3)].IntVal) / 100;
-         yyans.minute = (yyvsp[(1) - (3)].IntVal) % 100;
-         yyans.second = (yyvsp[(3) - (3)].IntVal);
-       ;}
+#line 305 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[-2].IntVal) / 100;
+         yyans.minute = (yyvsp[-2].IntVal) % 100;
+         yyans.second = (yyvsp[0].IntVal);
+       }
+#line 1644 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 105:
-
-/* Line 1455 of yacc.c  */
-#line 308 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (3)].IntVal) / 100;
-         yyans.minute = (yyvsp[(1) - (3)].IntVal) % 100;
-         yyans.second = (yyvsp[(3) - (3)].IntVal);
-       ;}
+#line 310 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[-2].IntVal) / 100;
+         yyans.minute = (yyvsp[-2].IntVal) % 100;
+         yyans.second = (yyvsp[0].IntVal);
+       }
+#line 1653 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 106:
-
-/* Line 1455 of yacc.c  */
-#line 313 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (1)].IntVal) / 10000;
-         yyans.minute = ((yyvsp[(1) - (1)].IntVal) % 10000) / 100;
-         yyans.second = (yyvsp[(1) - (1)].IntVal) % 100;
-       ;}
+#line 315 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[0].IntVal) / 10000;
+         yyans.minute = ((yyvsp[0].IntVal) % 10000) / 100;
+         yyans.second = (yyvsp[0].IntVal) % 100;
+       }
+#line 1662 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 107:
-
-/* Line 1455 of yacc.c  */
-#line 321 "dateyacc.y"
+#line 323 "dateyacc.y" /* yacc.c:1646  */
     { if (yyans.hour < 1 || yyans.hour > 12)
            yyans.hour = -1;            /* invalid */
          else
          { if (yyans.hour == 12) yyans.hour = 0;
-           yyans.hour += (yyvsp[(1) - (1)].IntVal);            /* 0 for AM, 12 for PM */
-       } ;}
+           yyans.hour += (yyvsp[0].IntVal);            /* 0 for AM, 12 for PM */
+       } }
+#line 1673 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 108:
-
-/* Line 1455 of yacc.c  */
-#line 331 "dateyacc.y"
-    { yyans.zone = (yyvsp[(1) - (1)].IntVal); yyans.dst = 0; ;}
+#line 333 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.zone = (yyvsp[0].IntVal); yyans.dst = 0; }
+#line 1679 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 109:
-
-/* Line 1455 of yacc.c  */
-#line 333 "dateyacc.y"
-    { yyans.zone = (yyvsp[(1) - (2)].IntVal) + 60; yyans.dst = 1; ;}
+#line 335 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.zone = (yyvsp[-1].IntVal) + 60; yyans.dst = 1; }
+#line 1685 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 110:
-
-/* Line 1455 of yacc.c  */
-#line 335 "dateyacc.y"
-    { yyans.zone = (yyvsp[(2) - (2)].IntVal); yyans.dst = 0; ;}
+#line 337 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.zone = (yyvsp[0].IntVal); yyans.dst = 0; }
+#line 1691 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 111:
-
-/* Line 1455 of yacc.c  */
-#line 337 "dateyacc.y"
-    { yyans.zone = (yyvsp[(2) - (3)].IntVal) + 60; yyans.dst = 1; ;}
+#line 339 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.zone = (yyvsp[-1].IntVal) + 60; yyans.dst = 1; }
+#line 1697 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 112:
-
-/* Line 1455 of yacc.c  */
-#line 339 "dateyacc.y"
-    { yyans.zone = (yyvsp[(1) - (1)].IntVal); yyans.dst = 1; ;}
+#line 341 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.zone = (yyvsp[0].IntVal); yyans.dst = 1; }
+#line 1703 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 113:
-
-/* Line 1455 of yacc.c  */
-#line 341 "dateyacc.y"
-    { yyans.zone = (yyvsp[(2) - (2)].IntVal); yyans.dst = 1; ;}
+#line 343 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.zone = (yyvsp[0].IntVal); yyans.dst = 1; }
+#line 1709 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 114:
-
-/* Line 1455 of yacc.c  */
-#line 343 "dateyacc.y"
-    { yyans.zone = (yyvsp[(2) - (2)].IntVal); yyans.dst = 0; ;}
+#line 345 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.zone = (yyvsp[0].IntVal); yyans.dst = 0; }
+#line 1715 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 115:
-
-/* Line 1455 of yacc.c  */
-#line 345 "dateyacc.y"
-    { yyans.zone = (yyvsp[(3) - (3)].IntVal); yyans.dst = 0; ;}
+#line 347 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.zone = (yyvsp[0].IntVal); yyans.dst = 0; }
+#line 1721 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 116:
-
-/* Line 1455 of yacc.c  */
-#line 347 "dateyacc.y"
-    { yyans.zone = - (yyvsp[(2) - (2)].IntVal); yyans.dst = 0; ;}
+#line 349 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.zone = - (yyvsp[0].IntVal); yyans.dst = 0; }
+#line 1727 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 117:
-
-/* Line 1455 of yacc.c  */
-#line 349 "dateyacc.y"
-    { yyans.zone = - (yyvsp[(3) - (3)].IntVal); yyans.dst = 0; ;}
+#line 351 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.zone = - (yyvsp[0].IntVal); yyans.dst = 0; }
+#line 1733 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 118:
-
-/* Line 1455 of yacc.c  */
-#line 354 "dateyacc.y"
-    { (yyval.IntVal) = 60 * (yyvsp[(1) - (1)].IntVal); ;}
+#line 356 "dateyacc.y" /* yacc.c:1646  */
+    { (yyval.IntVal) = 60 * (yyvsp[0].IntVal); }
+#line 1739 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 119:
-
-/* Line 1455 of yacc.c  */
-#line 356 "dateyacc.y"
-    { (yyval.IntVal) = 60 * (yyvsp[(1) - (3)].IntVal) + (yyvsp[(3) - (3)].IntVal); ;}
+#line 358 "dateyacc.y" /* yacc.c:1646  */
+    { (yyval.IntVal) = 60 * (yyvsp[-2].IntVal) + (yyvsp[0].IntVal); }
+#line 1745 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 120:
-
-/* Line 1455 of yacc.c  */
-#line 358 "dateyacc.y"
-    { (yyval.IntVal) = 60 * (yyvsp[(1) - (3)].IntVal) + (yyvsp[(3) - (3)].IntVal); ;}
+#line 360 "dateyacc.y" /* yacc.c:1646  */
+    { (yyval.IntVal) = 60 * (yyvsp[-2].IntVal) + (yyvsp[0].IntVal); }
+#line 1751 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 121:
-
-/* Line 1455 of yacc.c  */
-#line 360 "dateyacc.y"
-    { (yyval.IntVal) = 60 * (yyvsp[(1) - (1)].IntVal); ;}
+#line 362 "dateyacc.y" /* yacc.c:1646  */
+    { (yyval.IntVal) = 60 * (yyvsp[0].IntVal); }
+#line 1757 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 122:
-
-/* Line 1455 of yacc.c  */
-#line 362 "dateyacc.y"
-    { (yyval.IntVal) = 60 * (yyvsp[(1) - (3)].IntVal) + (yyvsp[(3) - (3)].IntVal); ;}
+#line 364 "dateyacc.y" /* yacc.c:1646  */
+    { (yyval.IntVal) = 60 * (yyvsp[-2].IntVal) + (yyvsp[0].IntVal); }
+#line 1763 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 123:
-
-/* Line 1455 of yacc.c  */
-#line 364 "dateyacc.y"
-    { (yyval.IntVal) = 60 * (yyvsp[(1) - (3)].IntVal) + (yyvsp[(3) - (3)].IntVal); ;}
+#line 366 "dateyacc.y" /* yacc.c:1646  */
+    { (yyval.IntVal) = 60 * (yyvsp[-2].IntVal) + (yyvsp[0].IntVal); }
+#line 1769 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 124:
-
-/* Line 1455 of yacc.c  */
-#line 366 "dateyacc.y"
-    { (yyval.IntVal) = 60 * ((yyvsp[(1) - (1)].IntVal) / 100) | ((yyvsp[(1) - (1)].IntVal) % 100); ;}
+#line 368 "dateyacc.y" /* yacc.c:1646  */
+    { (yyval.IntVal) = 60 * ((yyvsp[0].IntVal) / 100) | ((yyvsp[0].IntVal) % 100); }
+#line 1775 "dateyacc.c" /* yacc.c:1646  */
     break;
 
   case 125:
-
-/* Line 1455 of yacc.c  */
-#line 371 "dateyacc.y"
-    { yyans.hour   = (yyvsp[(1) - (1)].IntVal) / 100;  /* ajs */
-         yyans.minute = (yyvsp[(1) - (1)].IntVal) % 100;       /* ajs */
+#line 373 "dateyacc.y" /* yacc.c:1646  */
+    { yyans.hour   = (yyvsp[0].IntVal) / 100;  /* ajs */
+         yyans.minute = (yyvsp[0].IntVal) % 100;       /* ajs */
          yyans.second = -1;            /* ajs */
-       ;}
+       }
+#line 1784 "dateyacc.c" /* yacc.c:1646  */
     break;
 
 
-
-/* Line 1455 of yacc.c  */
-#line 1996 "dateyacc.c"
+#line 1788 "dateyacc.c" /* yacc.c:1646  */
       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);
@@ -2003,7 +1806,7 @@ yyreduce:
 
   *++yyvsp = yyval;
 
-  /* Now `shift' the result of the reduction.  Determine what state
+  /* Now 'shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
 
@@ -2018,10 +1821,14 @@ yyreduce:
   goto yynewstate;
 
 
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| 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)
     {
@@ -2029,37 +1836,36 @@ yyerrlab:
 #if ! YYERROR_VERBOSE
       yyerror (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 (yymsg);
-         }
-       else
-         {
-           yyerror (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 (yymsgp);
+        if (yysyntax_error_status == 2)
+          goto yyexhaustedlab;
       }
+# undef YYSYNTAX_ERROR
 #endif
     }
 
@@ -2068,20 +1874,20 @@ yyerrlab:
   if (yyerrstatus == 3)
     {
       /* If just tried and failed to reuse lookahead token after an
-        error, discard it.  */
+         error, discard it.  */
 
       if (yychar <= YYEOF)
-       {
-         /* Return failure if at end of input.  */
-         if (yychar == YYEOF)
-           YYABORT;
-       }
+        {
+          /* Return failure if at end of input.  */
+          if (yychar == YYEOF)
+            YYABORT;
+        }
       else
-       {
-         yydestruct ("Error: discarding",
-                     yytoken, &yylval);
-         yychar = YYEMPTY;
-       }
+        {
+          yydestruct ("Error: discarding",
+                      yytoken, &yylval);
+          yychar = YYEMPTY;
+        }
     }
 
   /* Else will try to reuse lookahead token after shifting the error
@@ -2100,7 +1906,7 @@ yyerrorlab:
   if (/*CONSTCOND*/ 0)
      goto yyerrorlab;
 
-  /* Do not reclaim the symbols of the rule which action triggered
+  /* Do not reclaim the symbols of the rule whose action triggered
      this YYERROR.  */
   YYPOPSTACK (yylen);
   yylen = 0;
@@ -2113,35 +1919,37 @@ yyerrorlab:
 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
 `-------------------------------------------------------------*/
 yyerrlab1:
-  yyerrstatus = 3;     /* Each real token shifted decrements this.  */
+  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
   for (;;)
     {
       yyn = yypact[yystate];
-      if (yyn != YYPACT_NINF)
-       {
-         yyn += YYTERROR;
-         if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
-           {
-             yyn = yytable[yyn];
-             if (0 < yyn)
-               break;
-           }
-       }
+      if (!yypact_value_is_default (yyn))
+        {
+          yyn += YYTERROR;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+            {
+              yyn = yytable[yyn];
+              if (0 < yyn)
+                break;
+            }
+        }
 
       /* Pop the current state because it cannot handle the error token.  */
       if (yyssp == yyss)
-       YYABORT;
+        YYABORT;
 
 
       yydestruct ("Error: popping",
-                 yystos[yystate], yyvsp);
+                  yystos[yystate], yyvsp);
       YYPOPSTACK (1);
       yystate = *yyssp;
       YY_STACK_PRINT (yyss, yyssp);
     }
 
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
 
   /* Shift the error token.  */
@@ -2165,7 +1973,7 @@ yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
-#if !defined(yyoverflow) || YYERROR_VERBOSE
+#if !defined yyoverflow || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
@@ -2177,16 +1985,21 @@ yyexhaustedlab:
 
 yyreturn:
   if (yychar != YYEMPTY)
-     yydestruct ("Cleanup: discarding lookahead",
-                yytoken, &yylval);
-  /* Do not reclaim the symbols of the rule which action triggered
+    {
+      /* 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);
+    }
+  /* Do not reclaim the symbols of the rule whose action triggered
      this YYABORT or YYACCEPT.  */
   YYPOPSTACK (yylen);
   YY_STACK_PRINT (yyss, yyssp);
   while (yyssp != yyss)
     {
       yydestruct ("Cleanup: popping",
-                 yystos[*yyssp], yyvsp);
+                  yystos[*yyssp], yyvsp);
       YYPOPSTACK (1);
     }
 #ifndef yyoverflow
@@ -2197,13 +2010,7 @@ yyreturn:
   if (yymsg != yymsgbuf)
     YYSTACK_FREE (yymsg);
 #endif
-  /* Make sure YYID is used.  */
-  return YYID (yyresult);
+  return yyresult;
 }
-
-
-
-/* Line 1675 of yacc.c  */
-#line 377 "dateyacc.y"
-
+#line 379 "dateyacc.y" /* yacc.c:1906  */
 
index b3b0525..1a7555f 100644 (file)
@@ -57,6 +57,8 @@ static char rcsident[] = "$Header: /cvsroot/lib/AXE/src/dateyacc.y,v 1.2 2002-09
 #include "parsedate.h"
 struct parseddate yyans;
 
+int yylex();
+
 /* No error routine is needed here. */
 #define yyerror(s)
 %}
index db615db..b8642c1 100644 (file)
@@ -2,7 +2,8 @@ TESTS = $(check_PROGRAMS) check_output
 
 AM_CPPFLAGS = -I../src
 LDADD = ../src/.libs/libACL.la
-check_PROGRAMS = string_assign string_basics string_compare string_cat string_substring string_regex
+check_PROGRAMS = string_assign string_basics string_compare string_cat string_substring string_regex \
+                 date_assign date_parse date_compare date_arithmetic
 
 string_assign_SOURCES      = string_assign.cpp
 string_basics_SOURCES      = string_basics.cpp
@@ -10,3 +11,9 @@ string_compare_SOURCES     = string_compare.cpp
 string_cat_SOURCES         = string_cat.cpp
 string_substring_SOURCES   = string_substring.cpp
 string_regex_SOURCES       = string_regex.cpp
+
+date_assign_SOURCES        = date_assign.cpp
+date_parse_SOURCES         = date_parse.cpp
+date_compare_SOURCES       = date_compare.cpp
+date_arithmetic_SOURCES    = date_arithmetic.cpp
diff --git a/test/date_arithmetic.cpp b/test/date_arithmetic.cpp
new file mode 100644 (file)
index 0000000..e8462d4
--- /dev/null
@@ -0,0 +1,80 @@
+/*******************************************************
+ *  Unit test for the date class
+ *
+ * test date add and subtract expressions
+ ******************************************************
+ *
+ */
+
+#include "date.h"
+#include <assert.h>
+
+int main()
+{
+   date   d0(9, 6, 2019);
+   date   period0(5, 3, 6);
+
+   date d1;
+   date d2;
+   d2 = d0 + period0;
+
+   std::cout << d0 << " + " << period0 << " = " << d2 << "\n";
+   assert(d2 == date(14, 9, 2025));
+
+   date    period1(30, 11, 3);   // 3 years, 11 months and 30 days
+   d2 = d0 + period1;
+   std::cout << d0 << " + " << period1 << " = " << d2 << "\n";
+   assert(d2 == date(8, 6, 2023));
+
+   long   days = 365;
+   d2 = d0 + days;
+   std::cout << d0 << " + " << days << " days = " << d2 << "\n";
+   assert(d2 == date(8, 6, 2020));    //  2020 is a leapyear
+
+   d1 = date(22, 7, 2019);
+   std::cout << d1 << " += " << days << " = ";
+   d1 += days;
+   std::cout << d1 << "\n";
+   assert(d1 == date(21, 7, 2020));
+
+   d1 = date(28, 2, 2020);
+   std::cout << d1 << " ++  = ";
+   d1++;                            // postfix
+   std::cout << d1 << "\n";
+   assert(d1 == date(29, 2, 2020));
+   std::cout << "++ " << d1;
+   ++d1;                            // prefix
+   std::cout << " = " << d1 << "\n";
+   assert(d1 == date(1, 3, 2020));
+
+   d2 = date(8, 6, 2020);
+   days = d2 - d0;
+   std::cout << d2 << " - " << d0 << " = " << days << " days\n";
+   assert(days == 365);
+
+   d2 = date(8, 6, 2020);
+   days = 365;
+   d1 = d2 - days;
+   std::cout << d2 << " - " << days << " days = " << d1 << "\n";
+   assert(d1 == date(9, 6, 2019));    //  2020 is a leapyear
+
+   d1 = date(22, 7, 2020);
+   days = 365;
+   std::cout << d1 << " -= " << days << " = ";
+   d1 -= days;
+   std::cout << d1 << "\n";
+   assert(d1 == date(23, 7, 2019));
+
+   d1 = date(1, 3, 2020);
+   std::cout << d1 << " --  = ";
+   d1--;                            // postfix
+   std::cout << d1 << "\n";
+   assert(d1 == date(29, 2, 2020));
+   std::cout << "-- " << d1;
+   --d1;                            // prefix
+   std::cout << " = " << d1 << "\n";
+   assert(d1 == date(28, 2, 2020));
+
+   return 0;
+}
+
diff --git a/test/date_arithmetic.exp b/test/date_arithmetic.exp
new file mode 100644 (file)
index 0000000..04530e4
--- /dev/null
@@ -0,0 +1,12 @@
+09-06-2019 + 05-03-6 = 14-09-2025
+09-06-2019 + 30-11-3 = 08-06-2023
+09-06-2019 + 365 days = 08-06-2020
+22-07-2019 += 365 = 21-07-2020
+28-02-2020 ++  = 29-02-2020
+++ 29-02-2020 = 01-03-2020
+08-06-2020 - 09-06-2019 = 365 days
+08-06-2020 - 365 days = 09-06-2019
+22-07-2020 -= 365 = 23-07-2019
+01-03-2020 --  = 29-02-2020
+-- 29-02-2020 = 28-02-2020
+PASS date_arithmetic (exit status: 0)
diff --git a/test/date_assign.cpp b/test/date_assign.cpp
new file mode 100644 (file)
index 0000000..85412cf
--- /dev/null
@@ -0,0 +1,72 @@
+/*******************************************************
+ *  Unit test for the date class
+ *
+ * test contrustor and assignment of Sting objects
+ ******************************************************
+ *
+ */
+
+#include "date.h"
+#include <assert.h>
+
+int main()
+{
+   // Default contructor: all zero
+   date d0;
+
+   std::cout << "The default contructor makes a zero date: \"" << d0 << "\"\n";
+   assert(d0.Day() == 0);
+   assert(d0.Month() == 0);
+   assert(d0.Year() == 0);
+
+   // Constructors with default arguments
+   date d1(5);
+
+   std::cout << "Contructor with just day = 5: \"" << d1 << "\"\n";
+   assert(d1.Day() == 5);
+   assert(d1.Month() == 0);
+   assert(d1.Year() == 0);
+
+   date d2(10, 7);
+
+   std::cout << "Contructor with just day = 10 and month = 7: \"" << d2 << "\"\n";
+   assert(d2.Day() == 10);
+   assert(d2.Month() == 7);
+   assert(d2.Year() == 0);
+
+   date d3(15, 9, 2002);
+
+   std::cout << "Contructor with day = 15 month = 9, and year = 2002: \"" << d3 << "\"\n";
+   assert(d3.Day() == 15);
+   assert(d3.Month() == 9);
+   assert(d3.Year() == 2002);
+
+   date d4(88, 55, 1000);
+
+   std::cout << "Contructor with day = 88 month = 55, and year = 1000: \"" << d4 << "\"\n";
+   assert(d4.Day() == 88);
+   assert(d4.Month() == 55);
+   assert(d4.Year() == 1000);
+
+   // The copy constructor is just a bitwise copy
+
+   date d5(d3);
+
+   std::cout << "Copy contructor from day = 15 month = 9, and year = 2002: \"" << d5 << "\"\n";
+   assert(d5.Day() == 15);
+   assert(d5.Month() == 9);
+   assert(d5.Year() == 2002);
+
+   // Also assignment is just a bitwise copy
+
+   date d6;
+
+   d6 = d3;
+   std::cout << "Assigned from day = 15 month = 9, and year = 2002: \"" << d6 << "\"\n";
+   assert(d6.Day() == 15);
+   assert(d6.Month() == 9);
+   assert(d6.Year() == 2002);
+
+   return 0;
+}
+
diff --git a/test/date_assign.exp b/test/date_assign.exp
new file mode 100644 (file)
index 0000000..8b22c81
--- /dev/null
@@ -0,0 +1,8 @@
+The default contructor makes a zero date: "00-00-0"
+Contructor with just day = 5: "05-00-0"
+Contructor with just day = 10 and month = 7: "10-07-0"
+Contructor with day = 15 month = 9, and year = 2002: "15-09-2002"
+Contructor with day = 88 month = 55, and year = 1000: "88-55-1000"
+Copy contructor from day = 15 month = 9, and year = 2002: "15-09-2002"
+Assigned from day = 15 month = 9, and year = 2002: "15-09-2002"
+PASS date_assign (exit status: 0)
diff --git a/test/date_compare.cpp b/test/date_compare.cpp
new file mode 100644 (file)
index 0000000..d322a54
--- /dev/null
@@ -0,0 +1,60 @@
+/*******************************************************
+ *  Unit test for the date class
+ *
+ * test date relational operators
+ ******************************************************
+ *
+ */
+
+#include "date.h"
+#include <assert.h>
+
+int main()
+{
+   date   d0(9, 6, 2019);
+   date   d1(9, 6, 2019);
+   date   d2(7, 8, 2019);
+
+   //  equal dates
+
+   std::cout << d0 << " == " << d1 << " = " << (d0 == d1) << "\n";
+   assert((d0 == d1) == true);
+
+   std::cout << d0 << " != " << d1 << " = " << (d0 != d1) << "\n";
+   assert((d0 != d1) == false);
+
+   std::cout << d0 << " < " << d1 << " = " << (d0 < d1) << "\n";
+   assert((d0 < d1) == false);
+
+   std::cout << d0 << " <= " << d1 << " = " << (d0 <= d1) << "\n";
+   assert((d0 <= d1) == true);
+
+   std::cout << d0 << " > " << d1 << " = " << (d0 > d1) << "\n";
+   assert((d0 > d1) == false);
+
+   std::cout << d0 << " >= " << d1 << " = " << (d0 >= d1) << "\n";
+   assert((d0 >= d1) == true);
+
+   //  unequal dates
+
+   std::cout << d0 << " == " << d2 << " = " << (d0 == d2) << "\n";
+   assert((d0 == d2) == false);
+
+   std::cout << d0 << " != " << d2 << " = " << (d0 != d2) << "\n";
+   assert((d0 != d2) == true);
+
+   std::cout << d0 << " < " << d2 << " = " << (d0 < d2) << "\n";
+   assert((d0 < d2) == true);
+
+   std::cout << d0 << " <= " << d2 << " = " << (d0 <= d2) << "\n";
+   assert((d0 <= d2) == true);
+
+   std::cout << d0 << " > " << d2 << " = " << (d0 > d2) << "\n";
+   assert((d0 > d2) == false);
+
+   std::cout << d0 << " >= " << d2 << " = " << (d0 >= d2) << "\n";
+   assert((d0 >= d2) == false);
+
+   return 0;
+}
+
diff --git a/test/date_compare.exp b/test/date_compare.exp
new file mode 100644 (file)
index 0000000..499b9cd
--- /dev/null
@@ -0,0 +1,13 @@
+09-06-2019 == 09-06-2019 = 1
+09-06-2019 != 09-06-2019 = 0
+09-06-2019 < 09-06-2019 = 0
+09-06-2019 <= 09-06-2019 = 1
+09-06-2019 > 09-06-2019 = 0
+09-06-2019 >= 09-06-2019 = 1
+09-06-2019 == 07-08-2019 = 0
+09-06-2019 != 07-08-2019 = 1
+09-06-2019 < 07-08-2019 = 1
+09-06-2019 <= 07-08-2019 = 1
+09-06-2019 > 07-08-2019 = 0
+09-06-2019 >= 07-08-2019 = 0
+PASS date_compare (exit status: 0)
diff --git a/test/date_parse.cpp b/test/date_parse.cpp
new file mode 100644 (file)
index 0000000..23d344b
--- /dev/null
@@ -0,0 +1,83 @@
+/*******************************************************
+ *  Unit test for the date class
+ *
+ * test the date parser that converts String to date
+ ******************************************************
+ *
+ */
+
+#include "date.h"
+#include <assert.h>
+
+int main()
+{
+   date   d0;
+   String the_date;
+
+
+   the_date = "20120208";
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(8, 2, 2012));
+
+   the_date = "2012-02-08";
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(8, 2, 2012));
+
+   the_date = "2012 02 08";
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(8, 2, 2012));
+
+   the_date = "08-02-2012";
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(8, 2, 2012));
+
+   the_date = "02/08/2012";
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(8, 2, 2012));
+
+   the_date = "Feb 8 2012";
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(8, 2, 2012));
+
+   the_date = "2012 Feb 8";
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(8, 2, 2012));
+
+   the_date = "8 FEB 2012";
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(8, 2, 2012));
+
+   the_date = "2012 8 feb";
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(8, 2, 2012));
+
+   the_date = "8 February 2012";
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(8, 2, 2012));
+
+   the_date = "Sun Jun 16 13:02:56 CEST 2019";   // A UNIX date string
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(16, 6, 2019));
+
+   //  Without a year: year = -1
+   the_date = "8 February";
+   d0 = date(the_date);
+   std::cout << "String \"" << the_date << "\" converts to: \"" << d0 << "\"\n";
+   assert(d0 == date(8, 2, -1));
+
+   //  TODO: test for invalid dates and syntax errors
+
+   return 0;
+}
+
diff --git a/test/date_parse.exp b/test/date_parse.exp
new file mode 100644 (file)
index 0000000..d7d025d
--- /dev/null
@@ -0,0 +1,13 @@
+String "20120208" converts to: "08-02-2012"
+String "2012-02-08" converts to: "08-02-2012"
+String "2012 02 08" converts to: "08-02-2012"
+String "08-02-2012" converts to: "08-02-2012"
+String "02/08/2012" converts to: "08-02-2012"
+String "Feb 8 2012" converts to: "08-02-2012"
+String "2012 Feb 8" converts to: "08-02-2012"
+String "8 FEB 2012" converts to: "08-02-2012"
+String "2012 8 feb" converts to: "08-02-2012"
+String "8 February 2012" converts to: "08-02-2012"
+String "Sun Jun 16 13:02:56 CEST 2019" converts to: "16-06-2019"
+String "8 February" converts to: "08-02--1"
+PASS date_parse (exit status: 0)