diff options
Diffstat (limited to 'generic/tclDate.c')
| -rw-r--r-- | generic/tclDate.c | 1694 |
1 files changed, 1040 insertions, 654 deletions
diff --git a/generic/tclDate.c b/generic/tclDate.c index 05f6d44..6222a8a 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -1,7 +1,9 @@ -/* A Bison parser, made by GNU Bison 1.875e. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 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 @@ -15,16 +17,24 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + 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. -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -36,17 +46,19 @@ /* Identify Bison output. */ #define YYBISON 1 +/* Bison version. */ +#define YYBISON_VERSION "2.3" + /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ -#define YYPURE 0 +#define YYPURE 1 /* Using locations. */ -#define YYLSP_NEEDED 0 +#define YYLSP_NEEDED 1 -/* If NAME_PREFIX is specified substitute the variables and functions - names. */ +/* Substitute the variable and function names. */ #define yyparse TclDateparse #define yylex TclDatelex #define yyerror TclDateerror @@ -54,7 +66,7 @@ #define yychar TclDatechar #define yydebug TclDatedebug #define yynerrs TclDatenerrs - +#define yylloc TclDatelloc /* Tokens. */ #ifndef YYTOKENTYPE @@ -67,39 +79,38 @@ tDAYZONE = 260, tID = 261, tMERIDIAN = 262, - tMINUTE_UNIT = 263, - tMONTH = 264, - tMONTH_UNIT = 265, - tSTARDATE = 266, - tSEC_UNIT = 267, - tSNUMBER = 268, - tUNUMBER = 269, - tZONE = 270, - tEPOCH = 271, - tDST = 272, - tISOBASE = 273, - tDAY_UNIT = 274, - tNEXT = 275 + tMONTH = 263, + tMONTH_UNIT = 264, + tSTARDATE = 265, + tSEC_UNIT = 266, + tSNUMBER = 267, + tUNUMBER = 268, + tZONE = 269, + tEPOCH = 270, + tDST = 271, + tISOBASE = 272, + tDAY_UNIT = 273, + tNEXT = 274 }; #endif +/* Tokens. */ #define tAGO 258 #define tDAY 259 #define tDAYZONE 260 #define tID 261 #define tMERIDIAN 262 -#define tMINUTE_UNIT 263 -#define tMONTH 264 -#define tMONTH_UNIT 265 -#define tSTARDATE 266 -#define tSEC_UNIT 267 -#define tSNUMBER 268 -#define tUNUMBER 269 -#define tZONE 270 -#define tEPOCH 271 -#define tDST 272 -#define tISOBASE 273 -#define tDAY_UNIT 274 -#define tNEXT 275 +#define tMONTH 263 +#define tMONTH_UNIT 264 +#define tSTARDATE 265 +#define tSEC_UNIT 266 +#define tSNUMBER 267 +#define tUNUMBER 268 +#define tZONE 269 +#define tEPOCH 270 +#define tDST 271 +#define tISOBASE 272 +#define tDAY_UNIT 273 +#define tNEXT 274 @@ -118,9 +129,7 @@ * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. - * */ - #include "tclInt.h" /* @@ -138,6 +147,10 @@ */ typedef struct DateInfo { + + Tcl_Obj* messages; /* Error messages */ + const char* separatrix; /* String separating messages */ + time_t dateYear; time_t dateMonth; time_t dateDay; @@ -165,42 +178,40 @@ typedef struct DateInfo { time_t dateDayNumber; int dateHaveDay; - char *dateInput; + const char *dateStart; + const char *dateInput; time_t *dateRelPointer; int dateDigitCount; } DateInfo; -#define YYPARSE_PARAM info -#define YYLEX_PARAM info - #define YYMALLOC ckalloc -#define YYFREE ckfree - -#define yyDSTmode (((DateInfo *) info)->dateDSTmode) -#define yyDayOrdinal (((DateInfo *) info)->dateDayOrdinal) -#define yyDayNumber (((DateInfo *) info)->dateDayNumber) -#define yyMonthOrdinal (((DateInfo *) info)->dateMonthOrdinal) -#define yyHaveDate (((DateInfo *) info)->dateHaveDate) -#define yyHaveDay (((DateInfo *) info)->dateHaveDay) -#define yyHaveOrdinalMonth (((DateInfo *) info)->dateHaveOrdinalMonth) -#define yyHaveRel (((DateInfo *) info)->dateHaveRel) -#define yyHaveTime (((DateInfo *) info)->dateHaveTime) -#define yyHaveZone (((DateInfo *) info)->dateHaveZone) -#define yyTimezone (((DateInfo *) info)->dateTimezone) -#define yyDay (((DateInfo *) info)->dateDay) -#define yyMonth (((DateInfo *) info)->dateMonth) -#define yyYear (((DateInfo *) info)->dateYear) -#define yyHour (((DateInfo *) info)->dateHour) -#define yyMinutes (((DateInfo *) info)->dateMinutes) -#define yySeconds (((DateInfo *) info)->dateSeconds) -#define yyMeridian (((DateInfo *) info)->dateMeridian) -#define yyRelMonth (((DateInfo *) info)->dateRelMonth) -#define yyRelDay (((DateInfo *) info)->dateRelDay) -#define yyRelSeconds (((DateInfo *) info)->dateRelSeconds) -#define yyRelPointer (((DateInfo *) info)->dateRelPointer) -#define yyInput (((DateInfo *) info)->dateInput) -#define yyDigitCount (((DateInfo *) info)->dateDigitCount) +#define YYFREE(x) (ckfree((void*) (x))) + +#define yyDSTmode (info->dateDSTmode) +#define yyDayOrdinal (info->dateDayOrdinal) +#define yyDayNumber (info->dateDayNumber) +#define yyMonthOrdinal (info->dateMonthOrdinal) +#define yyHaveDate (info->dateHaveDate) +#define yyHaveDay (info->dateHaveDay) +#define yyHaveOrdinalMonth (info->dateHaveOrdinalMonth) +#define yyHaveRel (info->dateHaveRel) +#define yyHaveTime (info->dateHaveTime) +#define yyHaveZone (info->dateHaveZone) +#define yyTimezone (info->dateTimezone) +#define yyDay (info->dateDay) +#define yyMonth (info->dateMonth) +#define yyYear (info->dateYear) +#define yyHour (info->dateHour) +#define yyMinutes (info->dateMinutes) +#define yySeconds (info->dateSeconds) +#define yyMeridian (info->dateMeridian) +#define yyRelMonth (info->dateRelMonth) +#define yyRelDay (info->dateRelDay) +#define yyRelSeconds (info->dateRelSeconds) +#define yyRelPointer (info->dateRelPointer) +#define yyInput (info->dateInput) +#define yyDigitCount (info->dateDigitCount) #define EPOCH 1970 #define START_OF_TIME 1902 @@ -222,7 +233,7 @@ typedef struct DateInfo { */ typedef struct _TABLE { - char *name; + const char *name; int type; time_t value; } TABLE; @@ -243,17 +254,6 @@ typedef enum _MERIDIAN { MERam, MERpm, MER24 } MERIDIAN; -/* - * Prototypes of internal functions. - */ - -static int LookupWord(char *buff); -static void TclDateerror(char *s); -static int TclDatelex(void *info); -static time_t ToSeconds(time_t Hours, time_t Minutes, - time_t Seconds, MERIDIAN Meridian); -MODULE_SCOPE int yyparse(void *); - /* Enabling traces. */ @@ -269,76 +269,228 @@ MODULE_SCOPE int yyparse(void *); # define YYERROR_VERBOSE 0 #endif -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE -typedef union YYSTYPE { +{ time_t Number; enum _MERIDIAN Meridian; -} YYSTYPE; -/* Line 191 of yacc.c. */ +} +/* Line 187 of yacc.c. */ + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif /* Copy the second part of user declarations. */ -/* Line 214 of yacc.c. */ +/* + * Prototypes of internal functions. + */ + +static int LookupWord(YYSTYPE* yylvalPtr, char *buff); + static void TclDateerror(YYLTYPE* location, + DateInfo* info, const char *s); + static int TclDatelex(YYSTYPE* yylvalPtr, YYLTYPE* location, + DateInfo* info); +static time_t ToSeconds(time_t Hours, time_t Minutes, + time_t Seconds, MERIDIAN Meridian); +MODULE_SCOPE int yyparse(DateInfo*); + + + +/* Line 216 of yacc.c. */ + + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#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; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif -#if ! defined (yyoverflow) || YYERROR_VERBOSE +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif -# ifndef YYFREE -# define YYFREE free +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# 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) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int # endif -# ifndef YYMALLOC -# define YYMALLOC malloc +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid # endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# 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 i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# endif -# else -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# 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) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (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 + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif +# else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif # endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short int yyss; + yytype_int16 yyss; YYSTYPE yyvs; - }; + YYLTYPE yyls; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -346,24 +498,24 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ +# if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ - register YYSIZE_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (0) + while (YYID (0)) # endif # endif @@ -381,46 +533,40 @@ union yyalloc yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (0) + while (YYID (0)) #endif -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short int yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ +/* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 79 -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 27 -/* YYNNTS -- Number of nonterminals. */ +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 26 +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 16 -/* YYNRULES -- Number of rules. */ +/* YYNRULES -- Number of rules. */ #define YYNRULES 56 -/* YYNRULES -- Number of states. */ +/* YYNRULES -- Number of states. */ #define YYNSTATES 83 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 275 +#define YYMAXUTOK 274 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 26, 23, 22, 25, 24, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 21, 2, + 2, 2, 2, 25, 22, 21, 24, 23, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 20, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -442,13 +588,13 @@ static const unsigned char yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20 + 15, 16, 17, 18, 19 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned char yyprhs[] = +static const yytype_uint8 yyprhs[] = { 0, 0, 3, 4, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 28, 33, 39, 46, 54, 57, @@ -458,80 +604,80 @@ static const unsigned char yyprhs[] = 167, 169, 171, 173, 175, 177, 178 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yysigned_char yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = { - 28, 0, -1, -1, 28, 29, -1, 30, -1, 31, - -1, 33, -1, 34, -1, 32, -1, 37, -1, 35, - -1, 36, -1, 41, -1, 14, 7, -1, 14, 21, - 14, 42, -1, 14, 21, 14, 22, 14, -1, 14, - 21, 14, 21, 14, 42, -1, 14, 21, 14, 21, - 14, 22, 14, -1, 15, 17, -1, 15, -1, 5, - -1, 4, -1, 4, 23, -1, 14, 4, -1, 39, - 14, 4, -1, 20, 4, -1, 14, 24, 14, -1, - 14, 24, 14, 24, 14, -1, 18, -1, 14, 22, - 9, 22, 14, -1, 14, 22, 14, 22, 14, -1, - 9, 14, -1, 9, 14, 23, 14, -1, 14, 9, - -1, 16, -1, 14, 9, 14, -1, 20, 9, -1, - 20, 14, 9, -1, 18, 15, 18, -1, 18, 15, - 14, 21, 14, 21, 14, -1, 18, 18, -1, 11, - 14, 25, 14, -1, 38, 3, -1, 38, -1, 39, - 14, 40, -1, 14, 40, -1, 20, 40, -1, 20, - 14, 40, -1, 40, -1, 22, -1, 26, -1, 12, - -1, 19, -1, 10, -1, 14, -1, -1, 7, -1 + 27, 0, -1, -1, 27, 28, -1, 29, -1, 30, + -1, 32, -1, 33, -1, 31, -1, 36, -1, 34, + -1, 35, -1, 40, -1, 13, 7, -1, 13, 20, + 13, 41, -1, 13, 20, 13, 21, 13, -1, 13, + 20, 13, 20, 13, 41, -1, 13, 20, 13, 20, + 13, 21, 13, -1, 14, 16, -1, 14, -1, 5, + -1, 4, -1, 4, 22, -1, 13, 4, -1, 38, + 13, 4, -1, 19, 4, -1, 13, 23, 13, -1, + 13, 23, 13, 23, 13, -1, 17, -1, 13, 21, + 8, 21, 13, -1, 13, 21, 13, 21, 13, -1, + 8, 13, -1, 8, 13, 22, 13, -1, 13, 8, + -1, 15, -1, 13, 8, 13, -1, 19, 8, -1, + 19, 13, 8, -1, 17, 14, 17, -1, 17, 14, + 13, 20, 13, 20, 13, -1, 17, 17, -1, 10, + 13, 24, 13, -1, 37, 3, -1, 37, -1, 38, + 13, 39, -1, 13, 39, -1, 19, 39, -1, 19, + 13, 39, -1, 39, -1, 21, -1, 25, -1, 11, + -1, 18, -1, 9, -1, 13, -1, -1, 7, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = +static const yytype_uint16 yyrline[] = { - 0, 185, 185, 186, 189, 192, 195, 198, 201, 204, - 207, 211, 216, 219, 225, 231, 239, 245, 256, 260, - 264, 270, 274, 278, 282, 286, 292, 296, 301, 306, - 311, 316, 320, 325, 329, 334, 341, 345, 351, 360, - 369, 379, 393, 398, 401, 404, 407, 410, 413, 418, - 421, 426, 430, 434, 440, 458, 461 + 0, 225, 225, 226, 229, 232, 235, 238, 241, 244, + 247, 251, 256, 259, 265, 271, 279, 285, 296, 300, + 304, 310, 314, 318, 322, 326, 332, 336, 341, 346, + 351, 356, 360, 365, 369, 374, 381, 385, 391, 400, + 409, 419, 433, 438, 441, 444, 447, 450, 453, 458, + 461, 466, 470, 474, 480, 498, 501 }; #endif -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "tAGO", "tDAY", "tDAYZONE", "tID", - "tMERIDIAN", "tMINUTE_UNIT", "tMONTH", "tMONTH_UNIT", "tSTARDATE", - "tSEC_UNIT", "tSNUMBER", "tUNUMBER", "tZONE", "tEPOCH", "tDST", - "tISOBASE", "tDAY_UNIT", "tNEXT", "':'", "'-'", "','", "'/'", "'.'", - "'+'", "$accept", "spec", "item", "time", "zone", "day", "date", - "ordMonth", "iso", "trek", "relspec", "relunits", "sign", "unit", - "number", "o_merid", 0 + "tMERIDIAN", "tMONTH", "tMONTH_UNIT", "tSTARDATE", "tSEC_UNIT", + "tSNUMBER", "tUNUMBER", "tZONE", "tEPOCH", "tDST", "tISOBASE", + "tDAY_UNIT", "tNEXT", "':'", "'-'", "','", "'/'", "'.'", "'+'", + "$accept", "spec", "item", "time", "zone", "day", "date", "ordMonth", + "iso", "trek", "relspec", "relunits", "sign", "unit", "number", + "o_merid", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 58, 45, 44, 47, 46, 43 + 58, 45, 44, 47, 46, 43 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = +static const yytype_uint8 yyr1[] = { - 0, 27, 28, 28, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, - 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 34, 34, 35, 35, - 35, 36, 37, 37, 38, 38, 38, 38, 38, 39, - 39, 40, 40, 40, 41, 42, 42 + 0, 26, 27, 27, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, + 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 33, 33, 34, 34, + 34, 35, 36, 36, 37, 37, 37, 37, 37, 38, + 38, 39, 39, 39, 40, 41, 41 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = +static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 7, 2, 1, @@ -544,7 +690,7 @@ static const unsigned char yyr2[] = /* 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 unsigned char yydefact[] = +static const yytype_uint8 yydefact[] = { 2, 0, 1, 21, 20, 0, 53, 0, 51, 54, 19, 34, 28, 52, 0, 49, 50, 3, 4, 5, @@ -557,8 +703,8 @@ static const unsigned char yydefact[] = 0, 17, 39 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yysigned_char yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = { -1, 1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 67 @@ -566,25 +712,25 @@ static const yysigned_char yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -23 -static const yysigned_char yypact[] = +#define YYPACT_NINF -22 +static const yytype_int8 yypact[] = { - -23, 2, -23, -22, -23, -5, -23, -4, -23, 22, - -2, -23, 12, -23, 38, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, 30, 11, -23, -23, - -23, 17, 10, -23, -23, 35, 40, -6, 47, -23, - -23, 45, -23, -23, -23, 46, -23, -23, 41, 48, - 50, -23, 16, 44, 49, 43, 51, -23, -23, -23, - -23, -23, -23, -23, -23, 54, 55, -23, 56, 59, - 60, 61, -3, -23, -23, -23, -23, 57, 62, -23, - 63, -23, -23 + -22, 2, -22, -21, -22, -4, -22, 1, -22, 22, + 18, -22, 8, -22, 40, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, 32, 28, -22, -22, + -22, 24, 26, -22, -22, 42, 47, -5, 49, -22, + -22, 15, -22, -22, -22, 48, -22, -22, 43, 50, + 51, -22, 17, 44, 46, 45, 52, -22, -22, -22, + -22, -22, -22, -22, -22, 56, 57, -22, 58, 60, + 61, 62, -3, -22, -22, -22, -22, 59, 63, -22, + 64, -22, -22 }; /* YYPGOTO[NTERM-NUM]. */ -static const yysigned_char yypgoto[] = +static const yytype_int8 yypgoto[] = { - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -9, -23, 7 + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -9, -22, 6 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -592,61 +738,45 @@ static const yysigned_char yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 -static const unsigned char yytable[] = +static const yytype_uint8 yytable[] = { 39, 30, 2, 53, 64, 46, 3, 4, 54, 31, - 32, 5, 6, 7, 8, 40, 9, 10, 11, 78, - 12, 13, 14, 64, 15, 48, 33, 41, 16, 34, - 42, 35, 6, 47, 8, 50, 59, 65, 66, 61, - 49, 13, 43, 36, 37, 60, 38, 44, 6, 51, - 8, 6, 45, 8, 52, 58, 6, 13, 8, 56, - 13, 55, 62, 57, 63, 13, 68, 70, 72, 73, - 74, 69, 71, 75, 76, 77, 81, 82, 80, 79 + 5, 6, 7, 8, 32, 9, 10, 11, 78, 12, + 13, 14, 41, 15, 64, 42, 33, 16, 56, 34, + 35, 6, 57, 8, 40, 47, 59, 65, 66, 61, + 13, 48, 36, 37, 43, 38, 49, 60, 44, 6, + 50, 8, 6, 45, 8, 51, 58, 6, 13, 8, + 52, 13, 55, 62, 63, 68, 13, 69, 70, 72, + 73, 74, 71, 75, 76, 77, 81, 82, 79, 80 }; -static const unsigned char yycheck[] = +static const yytype_uint8 yycheck[] = { - 9, 23, 0, 9, 7, 14, 4, 5, 14, 14, - 14, 9, 10, 11, 12, 17, 14, 15, 16, 22, - 18, 19, 20, 7, 22, 14, 4, 15, 26, 7, - 18, 9, 10, 3, 12, 25, 45, 21, 22, 48, - 23, 19, 4, 21, 22, 4, 24, 9, 10, 14, - 12, 10, 14, 12, 14, 9, 10, 19, 12, 14, - 19, 14, 14, 18, 14, 19, 22, 24, 14, 14, - 14, 22, 21, 14, 14, 14, 14, 14, 21, 72 + 9, 22, 0, 8, 7, 14, 4, 5, 13, 13, + 8, 9, 10, 11, 13, 13, 14, 15, 21, 17, + 18, 19, 14, 21, 7, 17, 4, 25, 13, 7, + 8, 9, 17, 11, 16, 3, 45, 20, 21, 48, + 18, 13, 20, 21, 4, 23, 22, 4, 8, 9, + 24, 11, 9, 13, 11, 13, 8, 9, 18, 11, + 13, 18, 13, 13, 13, 21, 18, 21, 23, 13, + 13, 13, 20, 13, 13, 13, 13, 13, 72, 20 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const unsigned char yystos[] = +static const yytype_uint8 yystos[] = { - 0, 28, 0, 4, 5, 9, 10, 11, 12, 14, - 15, 16, 18, 19, 20, 22, 26, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 23, 14, 14, 4, 7, 9, 21, 22, 24, 40, - 17, 15, 18, 4, 9, 14, 40, 3, 14, 23, - 25, 14, 14, 9, 14, 14, 14, 18, 9, 40, - 4, 40, 14, 14, 7, 21, 22, 42, 22, 22, - 24, 21, 14, 14, 14, 14, 14, 14, 22, 42, - 21, 14, 14 + 0, 27, 0, 4, 5, 8, 9, 10, 11, 13, + 14, 15, 17, 18, 19, 21, 25, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 22, 13, 13, 4, 7, 8, 20, 21, 23, 39, + 16, 14, 17, 4, 8, 13, 39, 3, 13, 22, + 24, 13, 13, 8, 13, 13, 13, 17, 8, 39, + 4, 39, 13, 13, 7, 20, 21, 41, 21, 21, + 23, 20, 13, 13, 13, 13, 13, 13, 21, 41, + 20, 13, 13 }; -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -672,15 +802,15 @@ do \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ + YYPOPSTACK (1); \ goto yybackup; \ } \ else \ - { \ - yyerror ("syntax error: cannot back up");\ + { \ + yyerror (&yylloc, info, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (0) +while (YYID (0)) #define YYTERROR 1 @@ -691,22 +821,25 @@ while (0) 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 (N) \ - { \ - (Current).first_line = (Rhs)[1].first_line; \ - (Current).first_column = (Rhs)[1].first_column; \ - (Current).last_line = (Rhs)[N].last_line; \ - (Current).last_column = (Rhs)[N].last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = (Rhs)[0].last_line; \ - (Current).first_column = (Current).last_column = (Rhs)[0].last_column; \ - } \ -} while(0) +# 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 @@ -718,8 +851,8 @@ do { \ # 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) + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -729,9 +862,9 @@ do { \ /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) #else -# define YYLEX yylex () +# define YYLEX yylex (&yylval, &yylloc, info) #endif /* Enable debugging if requested. */ @@ -746,36 +879,104 @@ do { \ do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (0) +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, info); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) + +/*--------------------------------. +| Print this symbol 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, YYLTYPE const * const yylocationp, DateInfo* info) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, info) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + DateInfo* info; +#endif +{ + if (!yyvaluep) + return; + YYUSE (yylocationp); + YYUSE (info); +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| 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, YYLTYPE const * const yylocationp, DateInfo* info) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, info) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + DateInfo* info; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, info); + YYFPRINTF (yyoutput, ")"); +} /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (short int *bottom, short int *top) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) - short int *bottom; - short int *top; + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) + for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -784,37 +985,47 @@ yy_stack_print (bottom, top) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (0) +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, DateInfo* info) #else static void -yy_reduce_print (yyrule) +yy_reduce_print (yyvsp, yylsp, yyrule, info) + YYSTYPE *yyvsp; + YYLTYPE *yylsp; int yyrule; + DateInfo* info; #endif { + int yynrhs = yyr2[yyrule]; int yyi; - unsigned int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", - yyrule - 1, yylno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , info); + fprintf (stderr, "\n"); + } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (Rule); \ -} while (0) + yy_reduce_print (yyvsp, yylsp, Rule, info); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -836,13 +1047,9 @@ int yydebug; if the built-in stack extension method is used). Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif @@ -852,45 +1059,47 @@ int yydebug; #if YYERROR_VERBOSE # ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) +# if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -# else +#else +static YYSIZE_T yystrlen (yystr) - const char *yystr; -# endif + const char *yystr; +#endif { - register const char *yys = yystr; - - while (*yys++ != '\0') + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) continue; - - return yys - yystr - 1; + return yylen; } # endif # endif # ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static char * -# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -# else +#else +static char * yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif + char *yydest; + const char *yysrc; +#endif { - register char *yyd = yydest; - register const char *yys = yysrc; + char *yyd = yydest; + const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; @@ -900,65 +1109,186 @@ yystpcpy (yydest, yysrc) # endif # endif -#endif /* !YYERROR_VERBOSE */ +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } - + if (! yyres) + return yystrlen (yystr); -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ + return yystpcpy (yyres, yystr) - yyres; +} +# endif -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#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) { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + int yyn = yypact[yystate]; - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - switch (yytype) { - default: - break; + 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; } - YYFPRINTF (yyoutput, ")"); } +#endif /* YYERROR_VERBOSE */ + -#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, DateInfo* info) #else static void -yydestruct (yymsg, yytype, yyvaluep) +yydestruct (yymsg, yytype, yyvaluep, yylocationp, info) const char *yymsg; int yytype; YYSTYPE *yyvaluep; + YYLTYPE *yylocationp; + DateInfo* info; #endif { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + YYUSE (yyvaluep); + YYUSE (yylocationp); + YYUSE (info); if (!yymsg) yymsg = "Deleting"; @@ -968,7 +1298,7 @@ yydestruct (yymsg, yytype, yyvaluep) { default: - break; + break; } } @@ -976,14 +1306,14 @@ yydestruct (yymsg, yytype, yyvaluep) /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); -# else +#else int yyparse (); -# endif +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) -int yyparse (void); +#if defined __STDC__ || defined __cplusplus +int yyparse (DateInfo* info); #else int yyparse (); #endif @@ -991,14 +1321,6 @@ int yyparse (); -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; @@ -1007,31 +1329,51 @@ int yynerrs; `----------*/ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif +#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 (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) int -yyparse (void) +yyparse (DateInfo* info) #else int -yyparse () - +yyparse (info) + DateInfo* info; #endif #endif { - - register int yystate; - register int yyn; + /* The look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; +/* Location data for the look-ahead symbol. */ +YYLTYPE yylloc; + + int yystate; + int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif /* Three stacks and their tools: `yyss': related to states, @@ -1042,29 +1384,34 @@ yyparse () to reallocate them elsewhere. */ /* The state stack. */ - short int yyssa[YYINITDEPTH]; - short int *yyss = yyssa; - register short int *yyssp; + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; + YYSTYPE *yyvsp; + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; - -#define YYPOPSTACK (yyvsp--, yyssp--) +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; + YYLTYPE yyloc; - - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1080,9 +1427,12 @@ yyparse () yyssp = yyss; yyvsp = yyvs; - - - yyvsp[0] = yylval; + yylsp = yyls; +#if YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 0; +#endif goto yysetstate; @@ -1091,8 +1441,7 @@ yyparse () `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ + have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: @@ -1105,46 +1454,46 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of + /* 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; - short int *yyss1 = yyss; - + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; /* 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 ("parser stack overflow", + yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - + &yyls1, yysize * sizeof (*yylsp), &yystacksize); - + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyoverflowlab; + goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - short int *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - goto yyoverflowlab; + goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1154,7 +1503,7 @@ yyparse () yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - + yylsp = yyls + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1172,12 +1521,10 @@ yyparse () `-----------*/ yybackup: -/* Do appropriate processing given the current state. */ -/* Read a look-ahead token if we need one and don't already have one. */ -/* yyresume: */ + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; @@ -1219,22 +1566,21 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the token being shifted unless it is eof. */ + /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; - *++yyvsp = yylval; - - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - yystate = yyn; + *++yyvsp = yylval; + *++yylsp = yylloc; goto yynewstate; @@ -1265,7 +1611,8 @@ yyreduce: GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; - + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); YY_REDUCE_PRINT (yyn); switch (yyn) { @@ -1331,31 +1678,31 @@ yyreduce: case 13: { - yyHour = yyvsp[-1].Number; + yyHour = (yyvsp[(1) - (2)].Number); yyMinutes = 0; yySeconds = 0; - yyMeridian = yyvsp[0].Meridian; + yyMeridian = (yyvsp[(2) - (2)].Meridian); ;} break; case 14: { - yyHour = yyvsp[-3].Number; - yyMinutes = yyvsp[-1].Number; + yyHour = (yyvsp[(1) - (4)].Number); + yyMinutes = (yyvsp[(3) - (4)].Number); yySeconds = 0; - yyMeridian = yyvsp[0].Meridian; + yyMeridian = (yyvsp[(4) - (4)].Meridian); ;} break; case 15: { - yyHour = yyvsp[-4].Number; - yyMinutes = yyvsp[-2].Number; + yyHour = (yyvsp[(1) - (5)].Number); + yyMinutes = (yyvsp[(3) - (5)].Number); yyMeridian = MER24; yyDSTmode = DSToff; - yyTimezone = (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60); + yyTimezone = ((yyvsp[(5) - (5)].Number) % 100 + ((yyvsp[(5) - (5)].Number) / 100) * 60); ++yyHaveZone; ;} break; @@ -1363,22 +1710,22 @@ yyreduce: case 16: { - yyHour = yyvsp[-5].Number; - yyMinutes = yyvsp[-3].Number; - yySeconds = yyvsp[-1].Number; - yyMeridian = yyvsp[0].Meridian; + yyHour = (yyvsp[(1) - (6)].Number); + yyMinutes = (yyvsp[(3) - (6)].Number); + yySeconds = (yyvsp[(5) - (6)].Number); + yyMeridian = (yyvsp[(6) - (6)].Meridian); ;} break; case 17: { - yyHour = yyvsp[-6].Number; - yyMinutes = yyvsp[-4].Number; - yySeconds = yyvsp[-2].Number; + yyHour = (yyvsp[(1) - (7)].Number); + yyMinutes = (yyvsp[(3) - (7)].Number); + yySeconds = (yyvsp[(5) - (7)].Number); yyMeridian = MER24; yyDSTmode = DSToff; - yyTimezone = (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60); + yyTimezone = ((yyvsp[(7) - (7)].Number) % 100 + ((yyvsp[(7) - (7)].Number) / 100) * 60); ++yyHaveZone; ;} break; @@ -1386,7 +1733,7 @@ yyreduce: case 18: { - yyTimezone = yyvsp[-1].Number; + yyTimezone = (yyvsp[(1) - (2)].Number); yyDSTmode = DSTon; ;} break; @@ -1394,7 +1741,7 @@ yyreduce: case 19: { - yyTimezone = yyvsp[0].Number; + yyTimezone = (yyvsp[(1) - (1)].Number); yyDSTmode = DSToff; ;} break; @@ -1402,7 +1749,7 @@ yyreduce: case 20: { - yyTimezone = yyvsp[0].Number; + yyTimezone = (yyvsp[(1) - (1)].Number); yyDSTmode = DSTon; ;} break; @@ -1411,7 +1758,7 @@ yyreduce: { yyDayOrdinal = 1; - yyDayNumber = yyvsp[0].Number; + yyDayNumber = (yyvsp[(1) - (1)].Number); ;} break; @@ -1419,23 +1766,23 @@ yyreduce: { yyDayOrdinal = 1; - yyDayNumber = yyvsp[-1].Number; + yyDayNumber = (yyvsp[(1) - (2)].Number); ;} break; case 23: { - yyDayOrdinal = yyvsp[-1].Number; - yyDayNumber = yyvsp[0].Number; + yyDayOrdinal = (yyvsp[(1) - (2)].Number); + yyDayNumber = (yyvsp[(2) - (2)].Number); ;} break; case 24: { - yyDayOrdinal = yyvsp[-2].Number * yyvsp[-1].Number; - yyDayNumber = yyvsp[0].Number; + yyDayOrdinal = (yyvsp[(1) - (3)].Number) * (yyvsp[(2) - (3)].Number); + yyDayNumber = (yyvsp[(3) - (3)].Number); ;} break; @@ -1443,76 +1790,76 @@ yyreduce: { yyDayOrdinal = 2; - yyDayNumber = yyvsp[0].Number; + yyDayNumber = (yyvsp[(2) - (2)].Number); ;} break; case 26: { - yyMonth = yyvsp[-2].Number; - yyDay = yyvsp[0].Number; + yyMonth = (yyvsp[(1) - (3)].Number); + yyDay = (yyvsp[(3) - (3)].Number); ;} break; case 27: { - yyMonth = yyvsp[-4].Number; - yyDay = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; + yyMonth = (yyvsp[(1) - (5)].Number); + yyDay = (yyvsp[(3) - (5)].Number); + yyYear = (yyvsp[(5) - (5)].Number); ;} break; case 28: { - yyYear = yyvsp[0].Number / 10000; - yyMonth = (yyvsp[0].Number % 10000)/100; - yyDay = yyvsp[0].Number % 100; + yyYear = (yyvsp[(1) - (1)].Number) / 10000; + yyMonth = ((yyvsp[(1) - (1)].Number) % 10000)/100; + yyDay = (yyvsp[(1) - (1)].Number) % 100; ;} break; case 29: { - yyDay = yyvsp[-4].Number; - yyMonth = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; + yyDay = (yyvsp[(1) - (5)].Number); + yyMonth = (yyvsp[(3) - (5)].Number); + yyYear = (yyvsp[(5) - (5)].Number); ;} break; case 30: { - yyMonth = yyvsp[-2].Number; - yyDay = yyvsp[0].Number; - yyYear = yyvsp[-4].Number; + yyMonth = (yyvsp[(3) - (5)].Number); + yyDay = (yyvsp[(5) - (5)].Number); + yyYear = (yyvsp[(1) - (5)].Number); ;} break; case 31: { - yyMonth = yyvsp[-1].Number; - yyDay = yyvsp[0].Number; + yyMonth = (yyvsp[(1) - (2)].Number); + yyDay = (yyvsp[(2) - (2)].Number); ;} break; case 32: { - yyMonth = yyvsp[-3].Number; - yyDay = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; + yyMonth = (yyvsp[(1) - (4)].Number); + yyDay = (yyvsp[(2) - (4)].Number); + yyYear = (yyvsp[(4) - (4)].Number); ;} break; case 33: { - yyMonth = yyvsp[0].Number; - yyDay = yyvsp[-1].Number; + yyMonth = (yyvsp[(2) - (2)].Number); + yyDay = (yyvsp[(1) - (2)].Number); ;} break; @@ -1528,9 +1875,9 @@ yyreduce: case 35: { - yyMonth = yyvsp[-1].Number; - yyDay = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; + yyMonth = (yyvsp[(2) - (3)].Number); + yyDay = (yyvsp[(1) - (3)].Number); + yyYear = (yyvsp[(3) - (3)].Number); ;} break; @@ -1538,53 +1885,53 @@ yyreduce: { yyMonthOrdinal = 1; - yyMonth = yyvsp[0].Number; + yyMonth = (yyvsp[(2) - (2)].Number); ;} break; case 37: { - yyMonthOrdinal = yyvsp[-1].Number; - yyMonth = yyvsp[0].Number; + yyMonthOrdinal = (yyvsp[(2) - (3)].Number); + yyMonth = (yyvsp[(3) - (3)].Number); ;} break; case 38: { - if (yyvsp[-1].Number != HOUR( 7)) YYABORT; - yyYear = yyvsp[-2].Number / 10000; - yyMonth = (yyvsp[-2].Number % 10000)/100; - yyDay = yyvsp[-2].Number % 100; - yyHour = yyvsp[0].Number / 10000; - yyMinutes = (yyvsp[0].Number % 10000)/100; - yySeconds = yyvsp[0].Number % 100; + if ((yyvsp[(2) - (3)].Number) != HOUR( 7)) YYABORT; + yyYear = (yyvsp[(1) - (3)].Number) / 10000; + yyMonth = ((yyvsp[(1) - (3)].Number) % 10000)/100; + yyDay = (yyvsp[(1) - (3)].Number) % 100; + yyHour = (yyvsp[(3) - (3)].Number) / 10000; + yyMinutes = ((yyvsp[(3) - (3)].Number) % 10000)/100; + yySeconds = (yyvsp[(3) - (3)].Number) % 100; ;} break; case 39: { - if (yyvsp[-5].Number != HOUR( 7)) YYABORT; - yyYear = yyvsp[-6].Number / 10000; - yyMonth = (yyvsp[-6].Number % 10000)/100; - yyDay = yyvsp[-6].Number % 100; - yyHour = yyvsp[-4].Number; - yyMinutes = yyvsp[-2].Number; - yySeconds = yyvsp[0].Number; + if ((yyvsp[(2) - (7)].Number) != HOUR( 7)) YYABORT; + yyYear = (yyvsp[(1) - (7)].Number) / 10000; + yyMonth = ((yyvsp[(1) - (7)].Number) % 10000)/100; + yyDay = (yyvsp[(1) - (7)].Number) % 100; + yyHour = (yyvsp[(3) - (7)].Number); + yyMinutes = (yyvsp[(5) - (7)].Number); + yySeconds = (yyvsp[(7) - (7)].Number); ;} break; case 40: { - yyYear = yyvsp[-1].Number / 10000; - yyMonth = (yyvsp[-1].Number % 10000)/100; - yyDay = yyvsp[-1].Number % 100; - yyHour = yyvsp[0].Number / 10000; - yyMinutes = (yyvsp[0].Number % 10000)/100; - yySeconds = yyvsp[0].Number % 100; + yyYear = (yyvsp[(1) - (2)].Number) / 10000; + yyMonth = ((yyvsp[(1) - (2)].Number) % 10000)/100; + yyDay = (yyvsp[(1) - (2)].Number) % 100; + yyHour = (yyvsp[(2) - (2)].Number) / 10000; + yyMinutes = ((yyvsp[(2) - (2)].Number) % 10000)/100; + yySeconds = (yyvsp[(2) - (2)].Number) % 100; ;} break; @@ -1596,11 +1943,11 @@ yyreduce: * in a range accessible with a 32 bit clock seconds value. */ - yyYear = yyvsp[-2].Number/1000 + 2323 - 377; + yyYear = (yyvsp[(2) - (4)].Number)/1000 + 2323 - 377; yyDay = 1; yyMonth = 1; - yyRelDay += ((yyvsp[-2].Number%1000)*(365 + IsLeapYear(yyYear)))/1000; - yyRelSeconds += yyvsp[0].Number * 144 * 60; + yyRelDay += (((yyvsp[(2) - (4)].Number)%1000)*(365 + IsLeapYear(yyYear)))/1000; + yyRelSeconds += (yyvsp[(4) - (4)].Number) * 144 * 60; ;} break; @@ -1616,56 +1963,56 @@ yyreduce: case 44: { - *yyRelPointer += yyvsp[-2].Number * yyvsp[-1].Number * yyvsp[0].Number; + *yyRelPointer += (yyvsp[(1) - (3)].Number) * (yyvsp[(2) - (3)].Number) * (yyvsp[(3) - (3)].Number); ;} break; case 45: { - *yyRelPointer += yyvsp[-1].Number * yyvsp[0].Number; + *yyRelPointer += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number); ;} break; case 46: { - *yyRelPointer += yyvsp[0].Number; + *yyRelPointer += (yyvsp[(2) - (2)].Number); ;} break; case 47: { - *yyRelPointer += yyvsp[-1].Number * yyvsp[0].Number; + *yyRelPointer += (yyvsp[(2) - (3)].Number) * (yyvsp[(3) - (3)].Number); ;} break; case 48: { - *yyRelPointer += yyvsp[0].Number; + *yyRelPointer += (yyvsp[(1) - (1)].Number); ;} break; case 49: { - yyval.Number = -1; + (yyval.Number) = -1; ;} break; case 50: { - yyval.Number = 1; + (yyval.Number) = 1; ;} break; case 51: { - yyval.Number = yyvsp[0].Number; + (yyval.Number) = (yyvsp[(1) - (1)].Number); yyRelPointer = &yyRelSeconds; ;} break; @@ -1673,7 +2020,7 @@ yyreduce: case 52: { - yyval.Number = yyvsp[0].Number; + (yyval.Number) = (yyvsp[(1) - (1)].Number); yyRelPointer = &yyRelDay; ;} break; @@ -1681,7 +2028,7 @@ yyreduce: case 53: { - yyval.Number = yyvsp[0].Number; + (yyval.Number) = (yyvsp[(1) - (1)].Number); yyRelPointer = &yyRelMonth; ;} break; @@ -1690,15 +2037,15 @@ yyreduce: { if (yyHaveTime && yyHaveDate && !yyHaveRel) { - yyYear = yyvsp[0].Number; + yyYear = (yyvsp[(1) - (1)].Number); } else { yyHaveTime++; if (yyDigitCount <= 2) { - yyHour = yyvsp[0].Number; + yyHour = (yyvsp[(1) - (1)].Number); yyMinutes = 0; } else { - yyHour = yyvsp[0].Number / 100; - yyMinutes = yyvsp[0].Number % 100; + yyHour = (yyvsp[(1) - (1)].Number) / 100; + yyMinutes = (yyvsp[(1) - (1)].Number) % 100; } yySeconds = 0; yyMeridian = MER24; @@ -1709,31 +2056,30 @@ yyreduce: case 55: { - yyval.Meridian = MER24; + (yyval.Meridian) = MER24; ;} break; case 56: { - yyval.Meridian = yyvsp[0].Meridian; + (yyval.Meridian) = (yyvsp[(1) - (1)].Meridian); ;} break; - } - -/* Line 1043 of yacc.c. */ - - - yyvsp -= yylen; - yyssp -= yylen; +/* Line 1267 of yacc.c. */ + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + YYPOPSTACK (yylen); + yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; - + *++yylsp = yyloc; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule @@ -1758,69 +2104,44 @@ yyerrlab: if (!yyerrstatus) { ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - YYSIZE_T yysize = 0; - int yytype = YYTRANSLATE (yychar); - const char* yyprefix; - char *yymsg; - int yyx; - - /* 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; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 0; - - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) +#if ! YYERROR_VERBOSE + yyerror (&yylloc, info, YY_("syntax error")); +#else + { + 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 { - yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); - yycount += 1; - if (yycount == 5) - { - yysize = 0; - break; - } + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; } - yysize += (sizeof ("syntax error, unexpected ") - + yystrlen (yytname[yytype])); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); - - if (yycount < 5) - { - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - yyp = yystpcpy (yyp, yyprefix); - yyp = yystpcpy (yyp, yytname[yyx]); - yyprefix = " or "; - } - } - yyerror (yymsg); - YYSTACK_FREE (yymsg); - } - else - yyerror ("syntax error; also virtual memory exhausted"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror ("syntax error"); + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (&yylloc, info, yymsg); + } + else + { + yyerror (&yylloc, info, YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif } - + yyerror_range[0] = yylloc; if (yyerrstatus == 3) { @@ -1828,23 +2149,15 @@ yyerrlab: error, discard it. */ if (yychar <= YYEOF) - { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ + { + /* Return failure if at end of input. */ if (yychar == YYEOF) - for (;;) - { - - YYPOPSTACK; - if (yyssp == yyss) - YYABORT; - yydestruct ("Error: popping", - yystos[*yyssp], yyvsp); - } - } + YYABORT; + } else { - yydestruct ("Error: discarding", yytoken, &yylval); + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, info); yychar = YYEMPTY; } } @@ -1859,15 +2172,18 @@ yyerrlab: `---------------------------------------------------*/ yyerrorlab: -#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ - if (0) + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) goto yyerrorlab; -#endif -yyvsp -= yylen; - yyssp -= yylen; + yyerror_range[0] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; @@ -1896,9 +2212,10 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - - yydestruct ("Error: popping", yystos[yystate], yyvsp); - YYPOPSTACK; + yyerror_range[0] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp, info); + YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } @@ -1908,8 +2225,13 @@ yyerrlab1: *++yyvsp = yylval; + yyerror_range[1] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the look-ahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + *++yylsp = yyloc; - /* Shift the error token. */ + /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; @@ -1927,42 +2249,53 @@ yyacceptlab: | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: - yydestruct ("Error: discarding lookahead", - yytoken, &yylval); - yychar = YYEMPTY; yyresult = 1; goto yyreturn; #ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (&yylloc, info, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, info); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp, info); + YYPOPSTACK (1); + } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif - return yyresult; +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); } -MODULE_SCOPE int yychar; -MODULE_SCOPE YYSTYPE yylval; -MODULE_SCOPE int yynerrs; - /* * Month and day table. */ -static TABLE MonthDayTable[] = { +static const TABLE MonthDayTable[] = { { "january", tMONTH, 1 }, { "february", tMONTH, 2 }, { "march", tMONTH, 3 }, @@ -1987,14 +2320,14 @@ static TABLE MonthDayTable[] = { { "thurs", tDAY, 4 }, { "friday", tDAY, 5 }, { "saturday", tDAY, 6 }, - { NULL } + { NULL, 0, 0 } }; /* * Time units table. */ -static TABLE UnitsTable[] = { +static const TABLE UnitsTable[] = { { "year", tMONTH_UNIT, 12 }, { "month", tMONTH_UNIT, 1 }, { "fortnight", tDAY_UNIT, 14 }, @@ -2005,14 +2338,14 @@ static TABLE UnitsTable[] = { { "min", tSEC_UNIT, 60 }, { "second", tSEC_UNIT, 1 }, { "sec", tSEC_UNIT, 1 }, - { NULL } + { NULL, 0, 0 } }; /* * Assorted relative-time words. */ -static TABLE OtherTable[] = { +static const TABLE OtherTable[] = { { "tomorrow", tDAY_UNIT, 1 }, { "yesterday", tDAY_UNIT, -1 }, { "today", tDAY_UNIT, 0 }, @@ -2037,7 +2370,7 @@ static TABLE OtherTable[] = { { "ago", tAGO, 1 }, { "epoch", tEPOCH, 0 }, { "stardate", tSTARDATE, 0 }, - { NULL } + { NULL, 0, 0 } }; /* @@ -2045,7 +2378,7 @@ static TABLE OtherTable[] = { * point constants to work around an SGI compiler bug). */ -static TABLE TimezoneTable[] = { +static const TABLE TimezoneTable[] = { { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */ { "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */ { "utc", tZONE, HOUR( 0) }, @@ -2123,14 +2456,14 @@ static TABLE TimezoneTable[] = { /* ADDED BY Marco Nijdam */ { "dst", tDST, HOUR( 0) }, /* DST on (hour is ignored) */ /* End ADDED */ - { NULL } + { NULL, 0, 0 } }; /* * Military timezone table. */ -static TABLE MilitaryTable[] = { +static const TABLE MilitaryTable[] = { { "a", tZONE, -HOUR( 1) }, { "b", tZONE, -HOUR( 2) }, { "c", tZONE, -HOUR( 3) }, @@ -2156,7 +2489,7 @@ static TABLE MilitaryTable[] = { { "x", tZONE, HOUR( 11) }, { "y", tZONE, HOUR( 12) }, { "z", tZONE, HOUR( 0) }, - { NULL } + { NULL, 0, 0 } }; /* @@ -2165,8 +2498,25 @@ static TABLE MilitaryTable[] = { static void TclDateerror( - char *s) + YYLTYPE* location, + DateInfo* infoPtr, + const char *s) { + Tcl_Obj* t; + Tcl_AppendToObj(infoPtr->messages, infoPtr->separatrix, -1); + Tcl_AppendToObj(infoPtr->messages, s, -1); + Tcl_AppendToObj(infoPtr->messages, " (characters ", -1); + t = Tcl_NewIntObj(location->first_column); + Tcl_IncrRefCount(t); + Tcl_AppendObjToObj(infoPtr->messages, t); + Tcl_DecrRefCount(t); + Tcl_AppendToObj(infoPtr->messages, "-", -1); + t = Tcl_NewIntObj(location->last_column); + Tcl_IncrRefCount(t); + Tcl_AppendObjToObj(infoPtr->messages, t); + Tcl_DecrRefCount(t); + Tcl_AppendToObj(infoPtr->messages, ")", -1); + infoPtr->separatrix = "\n"; } static time_t @@ -2201,11 +2551,12 @@ ToSeconds( static int LookupWord( + YYSTYPE* yylvalPtr, char *buff) { register char *p; register char *q; - register TABLE *tp; + register const TABLE *tp; int i, abbrev; /* @@ -2215,11 +2566,11 @@ LookupWord( Tcl_UtfToLower(buff); if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) { - yylval.Meridian = MERam; + yylvalPtr->Meridian = MERam; return tMERIDIAN; } if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) { - yylval.Meridian = MERpm; + yylvalPtr->Meridian = MERpm; return tMERIDIAN; } @@ -2239,25 +2590,25 @@ LookupWord( for (tp = MonthDayTable; tp->name; tp++) { if (abbrev) { if (strncmp(buff, tp->name, 3) == 0) { - yylval.Number = tp->value; + yylvalPtr->Number = tp->value; return tp->type; } } else if (strcmp(buff, tp->name) == 0) { - yylval.Number = tp->value; + yylvalPtr->Number = tp->value; return tp->type; } } for (tp = TimezoneTable; tp->name; tp++) { if (strcmp(buff, tp->name) == 0) { - yylval.Number = tp->value; + yylvalPtr->Number = tp->value; return tp->type; } } for (tp = UnitsTable; tp->name; tp++) { if (strcmp(buff, tp->name) == 0) { - yylval.Number = tp->value; + yylvalPtr->Number = tp->value; return tp->type; } } @@ -2271,7 +2622,7 @@ LookupWord( buff[i] = '\0'; for (tp = UnitsTable; tp->name; tp++) { if (strcmp(buff, tp->name) == 0) { - yylval.Number = tp->value; + yylvalPtr->Number = tp->value; return tp->type; } } @@ -2279,7 +2630,7 @@ LookupWord( for (tp = OtherTable; tp->name; tp++) { if (strcmp(buff, tp->name) == 0) { - yylval.Number = tp->value; + yylvalPtr->Number = tp->value; return tp->type; } } @@ -2292,7 +2643,7 @@ LookupWord( && isalpha(UCHAR(*buff))) { /* INTL: ISO only */ for (tp = MilitaryTable; tp->name; tp++) { if (strcmp(buff, tp->name) == 0) { - yylval.Number = tp->value; + yylvalPtr->Number = tp->value; return tp->type; } } @@ -2313,7 +2664,7 @@ LookupWord( if (i) { for (tp = TimezoneTable; tp->name; tp++) { if (strcmp(buff, tp->name) == 0) { - yylval.Number = tp->value; + yylvalPtr->Number = tp->value; return tp->type; } } @@ -2324,15 +2675,18 @@ LookupWord( static int TclDatelex( - void *info) + YYSTYPE* yylvalPtr, + YYLTYPE* location, + DateInfo *info) { register char c; register char *p; char buff[20]; int Count; + location->first_column = yyInput - info->dateStart; for ( ; ; ) { - while (isspace(UCHAR(*yyInput))) { + while (TclIsSpaceProc(*yyInput)) { yyInput++; } @@ -2342,9 +2696,9 @@ TclDatelex( */ Count = 0; - for (yylval.Number = 0; + for (yylvalPtr->Number = 0; isdigit(UCHAR(c = *yyInput++)); ) { /* INTL: digit */ - yylval.Number = 10 * yylval.Number + c - '0'; + yylvalPtr->Number = 10 * yylvalPtr->Number + c - '0'; Count++; } yyInput--; @@ -2355,8 +2709,10 @@ TclDatelex( */ if (Count >= 6) { + location->last_column = yyInput - info->dateStart - 1; return tISOBASE; } else { + location->last_column = yyInput - info->dateStart - 1; return tUNUMBER; } } @@ -2369,15 +2725,18 @@ TclDatelex( } *p = '\0'; yyInput--; - return LookupWord(buff); + location->last_column = yyInput - info->dateStart - 1; + return LookupWord(yylvalPtr, buff); } if (c != '(') { + location->last_column = yyInput - info->dateStart; return *yyInput++; } Count = 0; do { c = *yyInput++; if (c == '\0') { + location->last_column = yyInput - info->dateStart - 1; return c; } else if (c == '(') { Count++; @@ -2393,12 +2752,13 @@ TclClockOldscanObjCmd( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Count of paraneters */ - Tcl_Obj *CONST *objv) /* Parameters */ + Tcl_Obj *const *objv) /* Parameters */ { Tcl_Obj *result, *resultElement; int yr, mo, da; DateInfo dateInfo; - void *info = (void *) &dateInfo; + DateInfo* info = &dateInfo; + int status; if (objc != 5) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2407,6 +2767,7 @@ TclClockOldscanObjCmd( } yyInput = Tcl_GetString( objv[1] ); + dateInfo.dateStart = yyInput; yyHaveDate = 0; if (Tcl_GetIntFromObj(interp, objv[2], &yr) != TCL_OK @@ -2431,34 +2792,60 @@ TclClockOldscanObjCmd( yyHaveRel = 0; yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL; - if (yyparse(info)) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("syntax error", -1)); + dateInfo.messages = Tcl_NewObj(); + dateInfo.separatrix = ""; + Tcl_IncrRefCount(dateInfo.messages); + + status = yyparse(&dateInfo); + if (status == 1) { + Tcl_SetObjResult(interp, dateInfo.messages); + Tcl_DecrRefCount(dateInfo.messages); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", NULL); + return TCL_ERROR; + } else if (status == 2) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("memory exhausted", -1)); + Tcl_DecrRefCount(dateInfo.messages); + Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); + return TCL_ERROR; + } else if (status != 0) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("Unknown status returned " + "from date parser. Please " + "report this error as a " + "bug in Tcl.", -1)); + Tcl_DecrRefCount(dateInfo.messages); + Tcl_SetErrorCode(interp, "TCL", "BUG", NULL); return TCL_ERROR; } + Tcl_DecrRefCount(dateInfo.messages); if (yyHaveDate > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one date in string", -1)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", NULL); return TCL_ERROR; } if (yyHaveTime > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one time of day in string", -1)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", NULL); return TCL_ERROR; } if (yyHaveZone > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one time zone in string", -1)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", NULL); return TCL_ERROR; } if (yyHaveDay > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one weekday in string", -1)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", NULL); return TCL_ERROR; } if (yyHaveOrdinalMonth > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one ordinal month in string", -1)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", NULL); return TCL_ERROR; } @@ -2531,4 +2918,3 @@ TclClockOldscanObjCmd( * End: */ - |
