📄 getdate_tab.cpp
字号:
#include <stdlibx.h>
/* A Bison parser, made from ..\..\common\getdate.y with Bison version GNU Bison version 1.24
*/
#define YYBISON 1 /* Identify Bison output. */
#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 tSEC_UNIT 266
#define tSNUMBER 267
#define tUNUMBER 268
#define tZONE 269
#define tDST 270
#ifdef _MSC_VER
#pragma warning(disable:4131 4701 4129 4146 4307 4018)
#define STDAPICALLTYPE __stdcall
#define MSDOS
#else
#define STDAPICALLTYPE
#endif
#line 3 "..\..\common\getdate.y"
/*
** Originally written by Steven M. Bellovin <smb@research.att.com> while
** at the University of North Carolina at Chapel Hill. Later tweaked by
** a couple of people on Usenet. Completely overhauled by Rich $alz
** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
**
** Major hack to coerce it into use with the Equivalence Portable
** Windows Library.
**
** This grammar has 10 shift/reduce conflicts.
**
** This code is in the public domain and has no copyright.
*/
/* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */
/* SUPPRESS 288 on yyerrlab *//* Label unused */
#include <time.h>
#include <string.h>
#include <ctype.h>
extern "C" {
extern int STDAPICALLTYPE PTimeGetChar(void * stream);
extern void STDAPICALLTYPE PTimeUngetChar(void * stream, int c);
int STDAPICALLTYPE PTimeGetDateOrder();
int STDAPICALLTYPE PTimeIsMonthName(const char *, int, int);
int STDAPICALLTYPE PTimeIsDayName(const char *, int, int);
};
#define EPOCH 1970
#define HOUR(x) ((time_t)(x) * 60)
#define SECSPERDAY (24L * 60L * 60L)
/*
** An entry in the lexical lookup table.
*/
typedef struct _TABLE {
char *name;
int type;
time_t value;
} TABLE;
/*
** Daylight-savings mode: on, off, or not yet known.
*/
typedef enum _DSTMODE {
DSTon, DSToff, DSTmaybe
} DSTMODE;
/*
** Meridian: am, pm, or 24-hour style.
*/
typedef enum _MERIDIAN {
MERam, MERpm, MER24
} MERIDIAN;
/*
** Global variables. We could get rid of most of these by using a good
** union as the yacc stack. (This routine was originally written before
** yacc had the %union construct.) Maybe someday; right now we only use
** the %union very rarely.
*/
struct Variables {
void *yyInput;
DSTMODE yyDSTmode;
time_t yyDayOrdinal;
time_t yyDayNumber;
int yyHaveDate;
int yyHaveDay;
int yyHaveRel;
int yyHaveTime;
int yyHaveZone;
time_t yyTimezone;
time_t yyDay;
time_t yyHour;
time_t yyMinutes;
time_t yyMonth;
time_t yySeconds;
time_t yyYear;
MERIDIAN yyMeridian;
time_t yyRelMonth;
time_t yyRelSeconds;
};
#define VARIABLE ((struct Variables*)parseParam)
#define YYPURE
#define YYLEX_PARAM VARIABLE->yyInput
#define YYPARSE_PARAM parseParam
#define yyparse PTime_yyparse
#define yylex PTime_yylex
#define yyerror PTime_yyerror
static int yyparse(void *);
#ifdef __GNUC__
static int yyerror();
static int yylex();
#endif
static void SetPossibleDate(struct Variables*, time_t, time_t, time_t);
#line 119 "..\..\common\getdate.y"
typedef union {
time_t Number;
enum _MERIDIAN Meridian;
} YYSTYPE;
#ifndef YYLTYPE
typedef
struct yyltype
{
int timestamp;
int first_line;
int first_column;
int last_line;
int last_column;
char *text;
}
yyltype;
#define YYLTYPE yyltype
#endif
#include <stdio.h>
#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif
#define YYFINAL 52
#define YYFLAG -32768
#define YYNTBASE 19
#define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 29)
static const char 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, 2, 17, 2, 2, 18, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 16, 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,
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, 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, 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, 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, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15
};
#if YYDEBUG != 0
static const short yyprhs[] = { 0,
0, 1, 4, 6, 8, 10, 12, 14, 16, 19,
24, 29, 36, 43, 45, 47, 50, 52, 55, 58,
62, 68, 72, 76, 79, 84, 87, 91, 94, 96,
99, 102, 104, 107, 110, 112, 115, 118, 120, 122,
123
};
static const short yyrhs[] = { -1,
19, 20, 0, 21, 0, 22, 0, 24, 0, 23,
0, 25, 0, 27, 0, 13, 7, 0, 13, 16,
13, 28, 0, 13, 16, 13, 12, 0, 13, 16,
13, 16, 13, 28, 0, 13, 16, 13, 16, 13,
12, 0, 14, 0, 5, 0, 14, 15, 0, 4,
0, 4, 17, 0, 13, 4, 0, 13, 18, 13,
0, 13, 18, 13, 18, 13, 0, 13, 12, 12,
0, 13, 9, 12, 0, 9, 13, 0, 9, 13,
17, 13, 0, 13, 9, 0, 13, 9, 13, 0,
26, 3, 0, 26, 0, 13, 8, 0, 12, 8,
0, 8, 0, 12, 11, 0, 13, 11, 0, 11,
0, 12, 10, 0, 13, 10, 0, 10, 0, 13,
0, 0, 7, 0
};
#endif
#if YYDEBUG != 0
static const short yyrline[] = { 0,
133, 134, 137, 140, 143, 146, 149, 152, 155, 161,
167, 174, 180, 190, 194, 198, 205, 209, 213, 219,
222, 225, 235, 241, 245, 250, 254, 261, 265, 268,
271, 274, 277, 280, 283, 286, 289, 292, 297, 324,
327
};
static const char * const yytname[] = { "$","error","$undefined.","tAGO","tDAY",
"tDAYZONE","tID","tMERIDIAN","tMINUTE_UNIT","tMONTH","tMONTH_UNIT","tSEC_UNIT",
"tSNUMBER","tUNUMBER","tZONE","tDST","':'","','","'/'","spec","item","time",
"zone","day","date","rel","relunit","number","o_merid",""
};
#endif
static const short yyr1[] = { 0,
19, 19, 20, 20, 20, 20, 20, 20, 21, 21,
21, 21, 21, 22, 22, 22, 23, 23, 23, 24,
24, 24, 24, 24, 24, 24, 24, 25, 25, 26,
26, 26, 26, 26, 26, 26, 26, 26, 27, 28,
28
};
static const short yyr2[] = { 0,
0, 2, 1, 1, 1, 1, 1, 1, 2, 4,
4, 6, 6, 1, 1, 2, 1, 2, 2, 3,
5, 3, 3, 2, 4, 2, 3, 2, 1, 2,
2, 1, 2, 2, 1, 2, 2, 1, 1, 0,
1
};
static const short yydefact[] = { 1,
0, 17, 15, 32, 0, 38, 35, 0, 39, 14,
2, 3, 4, 6, 5, 7, 29, 8, 18, 24,
31, 36, 33, 19, 9, 30, 26, 37, 34, 0,
0, 0, 16, 28, 0, 23, 27, 22, 40, 20,
25, 41, 11, 0, 10, 0, 40, 21, 13, 12,
0, 0
};
static const short yydefgoto[] = { 1,
11, 12, 13, 14, 15, 16, 17, 18, 45
};
static const short yypact[] = {-32768,
0, -1,-32768,-32768, 4,-32768,-32768, 25, 11, -8,
-32768,-32768,-32768,-32768,-32768,-32768, 21,-32768,-32768, 9,
-32768,-32768,-32768,-32768,-32768,-32768, -10,-32768,-32768, 16,
19, 24,-32768,-32768, 26,-32768,-32768,-32768, 18, 13,
-32768,-32768,-32768, 27,-32768, 28, -6,-32768,-32768,-32768,
38,-32768
};
static const short yypgoto[] = {-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -5
};
#define YYLAST 42
static const short yytable[] = { 51,
42, 36, 37, 2, 3, 49, 33, 4, 5, 6,
7, 8, 9, 10, 24, 19, 20, 25, 26, 27,
28, 29, 30, 34, 42, 35, 31, 38, 32, 43,
46, 39, 21, 44, 22, 23, 40, 52, 41, 47,
48, 50
};
static const short yycheck[] = { 0,
7, 12, 13, 4, 5, 12, 15, 8, 9, 10,
11, 12, 13, 14, 4, 17, 13, 7, 8, 9,
10, 11, 12, 3, 7, 17, 16, 12, 18, 12,
18, 13, 8, 16, 10, 11, 13, 0, 13, 13,
13, 47
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 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 2, 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* 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. */
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not __GNUC__ */
#if HAVE_ALLOCA_H
#include <alloca.h>
#else /* not HAVE_ALLOCA_H */
#ifdef _AIX
#pragma alloca
#else /* not _AIX */
char *alloca ();
#endif /* not _AIX */
#endif /* not HAVE_ALLOCA_H */
#endif /* not __GNUC__ */
extern int yylex(YYSTYPE *, void *);
extern void yyerror(const char*);
#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
#pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc. */
#endif /* not GNU C. */
#endif /* alloca not defined. */
/* This is the parser code that is written into each bison parser
when the %semantic_parser declaration is not specified in the grammar.
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
/* Note: there must be only one dollar sign in this file.
It is replaced by the list of actions, each action
as one case of the switch. */
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT return(0)
#define YYABORT return(1)
#define YYERROR goto yyerrlab1
/* 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 YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(token, value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ yychar = (token), yylval = (value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#ifndef YYPURE
#define YYLEX yylex()
#endif
#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, YYLEX_PARAM)
#else
#define YYLEX yylex(&yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif
/* If nonreentrant, generate the variables here */
#ifndef YYPURE
int yychar; /* the lookahead symbol */
YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
#ifdef YYLSP_NEEDED
YYLTYPE yylloc; /* location data for the lookahead */
/* symbol */
#endif
int yynerrs; /* number of parse errors so far */
#endif /* not YYPURE */
#if YYDEBUG != 0
int yydebug; /* nonzero means print parse trace */
/* Since this is uninitialized, it does not stop multiple parsers
from coexisting. */
#endif
/* YYINITDEPTH indicates the initial size of the parser's stacks */
#ifndef YYINITDEPTH
#define YYINITDEPTH 200
#endif
/* YYMAXDEPTH is the maximum size the stacks can grow to
(effective only if the built-in stack extension method is used). */
#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -