#include <alloca.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "getdate.h"
Go to the source code of this file.
Data Structures | |
struct | textint |
struct | table |
struct | parser_control |
union | YYSTYPE |
union | yyalloc |
Defines | |
#define | YYBISON 1 |
#define | YYSKELETON_NAME "yacc.c" |
#define | YYPURE 1 |
#define | YYLSP_NEEDED 0 |
#define | tAGO 258 |
#define | tDST 259 |
#define | tDAY 260 |
#define | tDAY_UNIT 261 |
#define | tDAYZONE 262 |
#define | tHOUR_UNIT 263 |
#define | tLOCAL_ZONE 264 |
#define | tMERIDIAN 265 |
#define | tMINUTE_UNIT 266 |
#define | tMONTH 267 |
#define | tMONTH_UNIT 268 |
#define | tSEC_UNIT 269 |
#define | tYEAR_UNIT 270 |
#define | tZONE 271 |
#define | tSNUMBER 272 |
#define | tUNUMBER 273 |
#define | IN_CTYPE_DOMAIN(c) 1 |
#define | ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) |
#define | ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c)) |
#define | ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c)) |
#define | ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c)) |
#define | ISDIGIT(c) ((unsigned) (c) - '0' <= 9) |
#define | __attribute__(x) |
#define | ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
#define | EPOCH_YEAR 1970 |
#define | TM_YEAR_BASE 1900 |
#define | HOUR(x) ((x) * 60) |
#define | PC (* (parser_control *) parm) |
#define | YYLEX_PARAM parm |
#define | YYPARSE_PARAM parm |
#define | YYDEBUG 0 |
#define | YYERROR_VERBOSE 0 |
#define | yystype YYSTYPE |
#define | YYSTYPE_IS_DECLARED 1 |
#define | YYSTYPE_IS_TRIVIAL 1 |
#define | YYSTACK_ALLOC malloc |
#define | YYSTACK_FREE free |
#define | YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
#define | YYSTACK_BYTES(N) |
#define | YYCOPY(To, From, Count) |
#define | YYSTACK_RELOCATE(Stack) |
#define | YYFINAL 2 |
#define | YYLAST 55 |
#define | YYNTOKENS 22 |
#define | YYNNTS 12 |
#define | YYNRULES 55 |
#define | YYNSTATES 66 |
#define | YYUNDEFTOK 2 |
#define | YYMAXUTOK 273 |
#define | YYTRANSLATE(YYX) ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
#define | YYPACT_NINF -17 |
#define | YYTABLE_NINF -1 |
#define | YYSIZE_T unsigned int |
#define | yyerrok (yyerrstatus = 0) |
#define | yyclearin (yychar = YYEMPTY) |
#define | YYEMPTY (-2) |
#define | YYEOF 0 |
#define | YYACCEPT goto yyacceptlab |
#define | YYABORT goto yyabortlab |
#define | YYERROR goto yyerrlab1 |
#define | YYFAIL goto yyerrlab |
#define | YYRECOVERING() (!!yyerrstatus) |
#define | YYBACKUP(Token, Value) |
#define | YYTERROR 1 |
#define | YYERRCODE 256 |
#define | YYLLOC_DEFAULT(Current, Rhs, N) |
#define | YYLEX yylex (&yylval, YYLEX_PARAM) |
#define | YYDPRINTF(Args) |
#define | YYDSYMPRINT(Args) |
#define | YYDSYMPRINTF(Title, Token, Value, Location) |
#define | YY_STACK_PRINT(Bottom, Top) |
#define | YY_REDUCE_PRINT(Rule) |
#define | YYINITDEPTH 200 |
#define | YYMAXDEPTH 10000 |
#define | YYPOPSTACK (yyvsp--, yyssp--) |
Typedefs | |
typedef short | yysigned_char |
Enumerations | |
enum | yytokentype { tAGO = 258, tDST = 259, tDAY = 260, tDAY_UNIT = 261, tDAYZONE = 262, tHOUR_UNIT = 263, tLOCAL_ZONE = 264, tMERIDIAN = 265, tMINUTE_UNIT = 266, tMONTH = 267, tMONTH_UNIT = 268, tSEC_UNIT = 269, tYEAR_UNIT = 270, tZONE = 271, tSNUMBER = 272, tUNUMBER = 273 } |
enum | { MERam, MERpm, MER24 } |
Functions | |
static int | yyerror () |
static int | yylex () |
static void | yydestruct (int yytype, YYSTYPE *yyvaluep) |
int | yyparse () |
int | yyparse (void *YYPARSE_PARAM) |
struct tm * | gmtime () |
struct tm * | localtime () |
time_t | mktime () |
static int | to_hour (int hours, int meridian) |
static int | to_year (textint textyear) |
static table const * | lookup_zone (parser_control const *pc, char const *name) |
static int | tm_diff (struct tm const *a, struct tm const *b) |
static table const * | lookup_word (parser_control const *pc, char *word) |
static int | yylex (YYSTYPE *lvalp, parser_control *pc) |
static int | yyerror (char *s ATTRIBUTE_UNUSED) |
time_t | get_date (const char *p, const time_t *now) |
Variables | |
static const unsigned char | yytranslate [] |
static const unsigned char | yyr1 [] |
static const unsigned char | yyr2 [] |
static const unsigned char | yydefact [] |
static const yysigned_char | yydefgoto [] |
static const yysigned_char | yypact [] |
static const yysigned_char | yypgoto [] |
static const unsigned char | yytable [] |
static const yysigned_char | yycheck [] |
static const unsigned char | yystos [] |
static table const | meridian_table [] |
static table const | dst_table [] |
static table const | month_and_day_table [] |
static table const | time_units_table [] |
static table const | relative_time_table [] |
static table const | time_zone_table [] |
static table const | military_table [] |
#define EPOCH_YEAR 1970 |
#define ISALPHA | ( | c | ) | (IN_CTYPE_DOMAIN (c) && isalpha (c)) |
#define ISDIGIT | ( | c | ) | ((unsigned) (c) - '0' <= 9) |
#define ISDIGIT_LOCALE | ( | c | ) | (IN_CTYPE_DOMAIN (c) && isdigit (c)) |
#define ISLOWER | ( | c | ) | (IN_CTYPE_DOMAIN (c) && islower (c)) |
#define ISSPACE | ( | c | ) | (IN_CTYPE_DOMAIN (c) && isspace (c)) |
#define PC (* (parser_control *) parm) |
#define tLOCAL_ZONE 264 |
#define TM_YEAR_BASE 1900 |
#define YYACCEPT goto yyacceptlab |
#define YYBACKUP | ( | Token, | |||
Value | ) |
Value:
do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ yyerror ("syntax error: cannot back up");\ YYERROR; \ } \ while (0)
#define YYCOPY | ( | To, | |||
From, | |||||
Count | ) |
#define YYDSYMPRINTF | ( | Title, | |||
Token, | |||||
Value, | |||||
Location | ) |
#define YYLEX yylex (&yylval, YYLEX_PARAM) |
#define YYLLOC_DEFAULT | ( | Current, | |||
Rhs, | |||||
N | ) |
#define YYPOPSTACK (yyvsp--, yyssp--) |
#define YYSTACK_BYTES | ( | N | ) |
Value:
((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM)
Definition at line 336 of file getdate.c.
Referenced by yyparse().
#define YYSTACK_RELOCATE | ( | Stack | ) |
#define YYTRANSLATE | ( | YYX | ) | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
typedef short yysigned_char |
enum yytokentype |
time_t get_date | ( | const char * | p, | |
const time_t * | now | |||
) |
Definition at line 2238 of file getdate.c.
References EPOCH_YEAR, gmtime(), localtime(), MER24, mktime(), tLOCAL_ZONE, tm_diff(), TM_YEAR_BASE, to_hour(), to_year(), and yyparse().
Referenced by check_rss().
struct tm* gmtime | ( | ) | [read] |
Referenced by get_date().
struct tm* localtime | ( | ) | [read] |
Referenced by get_date().
static table const* lookup_word | ( | parser_control const * | pc, | |
char * | word | |||
) | [static] |
Definition at line 2079 of file getdate.c.
References ISLOWER, lookup_zone(), and table::name.
Referenced by yylex().
static table const* lookup_zone | ( | parser_control const * | pc, | |
char const * | name | |||
) | [static] |
Definition at line 2035 of file getdate.c.
References parser_control::local_time_zone_table, and table::name.
Referenced by lookup_word().
time_t mktime | ( | ) |
Referenced by get_date().
static int tm_diff | ( | struct tm const * | a, | |
struct tm const * | b | |||
) | [static] |
static int to_hour | ( | int | hours, | |
int | meridian | |||
) | [static] |
static int to_year | ( | textint | textyear | ) | [static] |
Definition at line 2019 of file getdate.c.
References textint::digits, and textint::value.
Referenced by get_date().
static void yydestruct | ( | int | yytype, | |
YYSTYPE * | yyvaluep | |||
) | [static] |
static int yyerror | ( | ) | [static] |
static int yylex | ( | YYSTYPE * | lvalp, | |
parser_control * | pc | |||
) | [static] |
Definition at line 2148 of file getdate.c.
References textint::digits, parser_control::input, YYSTYPE::intval, ISALPHA, ISDIGIT, ISSPACE, lookup_word(), YYSTYPE::textintval, tSNUMBER, tUNUMBER, table::type, table::value, and textint::value.
static int yylex | ( | ) | [static] |
int yyparse | ( | void * | YYPARSE_PARAM | ) |
Definition at line 940 of file getdate.c.
References textint::digits, YYSTYPE::intval, MER24, PC, YYSTYPE::textintval, textint::value, YY_REDUCE_PRINT, YYABORT, YYACCEPT, yycheck, yydefact, YYDPRINTF, YYDSYMPRINTF, YYEMPTY, YYEOF, YYFINAL, YYINITDEPTH, YYLAST, YYLEX, YYMAXDEPTH, yypact, YYPACT_NINF, yyr2, YYSIZE_T, YYSTACK_ALLOC, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, yytable, YYTABLE_NINF, and YYTRANSLATE.
int yyparse | ( | ) |
Referenced by get_date().
table const meridian_table[] [static] |
table const military_table[] [static] |
Initial value:
{ { "A", tZONE, -HOUR ( 1) }, { "B", tZONE, -HOUR ( 2) }, { "C", tZONE, -HOUR ( 3) }, { "D", tZONE, -HOUR ( 4) }, { "E", tZONE, -HOUR ( 5) }, { "F", tZONE, -HOUR ( 6) }, { "G", tZONE, -HOUR ( 7) }, { "H", tZONE, -HOUR ( 8) }, { "I", tZONE, -HOUR ( 9) }, { "K", tZONE, -HOUR (10) }, { "L", tZONE, -HOUR (11) }, { "M", tZONE, -HOUR (12) }, { "N", tZONE, HOUR ( 1) }, { "O", tZONE, HOUR ( 2) }, { "P", tZONE, HOUR ( 3) }, { "Q", tZONE, HOUR ( 4) }, { "R", tZONE, HOUR ( 5) }, { "S", tZONE, HOUR ( 6) }, { "T", tZONE, HOUR ( 7) }, { "U", tZONE, HOUR ( 8) }, { "V", tZONE, HOUR ( 9) }, { "W", tZONE, HOUR (10) }, { "X", tZONE, HOUR (11) }, { "Y", tZONE, HOUR (12) }, { "Z", tZONE, HOUR ( 0) }, { 0, 0, 0 } }
table const month_and_day_table[] [static] |
Initial value:
{ { "JANUARY", tMONTH, 1 }, { "FEBRUARY", tMONTH, 2 }, { "MARCH", tMONTH, 3 }, { "APRIL", tMONTH, 4 }, { "MAY", tMONTH, 5 }, { "JUNE", tMONTH, 6 }, { "JULY", tMONTH, 7 }, { "AUGUST", tMONTH, 8 }, { "SEPTEMBER",tMONTH, 9 }, { "SEPT", tMONTH, 9 }, { "OCTOBER", tMONTH, 10 }, { "NOVEMBER", tMONTH, 11 }, { "DECEMBER", tMONTH, 12 }, { "SUNDAY", tDAY, 0 }, { "MONDAY", tDAY, 1 }, { "TUESDAY", tDAY, 2 }, { "TUES", tDAY, 2 }, { "WEDNESDAY",tDAY, 3 }, { "WEDNES", tDAY, 3 }, { "THURSDAY", tDAY, 4 }, { "THUR", tDAY, 4 }, { "THURS", tDAY, 4 }, { "FRIDAY", tDAY, 5 }, { "SATURDAY", tDAY, 6 }, { 0, 0, 0 } }
table const relative_time_table[] [static] |
Initial value:
{ { "TOMORROW", tDAY_UNIT, 1 }, { "YESTERDAY",tDAY_UNIT, -1 }, { "TODAY", tDAY_UNIT, 0 }, { "NOW", tDAY_UNIT, 0 }, { "LAST", tUNUMBER, -1 }, { "THIS", tUNUMBER, 0 }, { "NEXT", tUNUMBER, 1 }, { "FIRST", tUNUMBER, 1 }, { "THIRD", tUNUMBER, 3 }, { "FOURTH", tUNUMBER, 4 }, { "FIFTH", tUNUMBER, 5 }, { "SIXTH", tUNUMBER, 6 }, { "SEVENTH", tUNUMBER, 7 }, { "EIGHTH", tUNUMBER, 8 }, { "NINTH", tUNUMBER, 9 }, { "TENTH", tUNUMBER, 10 }, { "ELEVENTH", tUNUMBER, 11 }, { "TWELFTH", tUNUMBER, 12 }, { "AGO", tAGO, 1 }, { 0, 0, 0 } }
table const time_units_table[] [static] |
Initial value:
{ { "YEAR", tYEAR_UNIT, 1 }, { "MONTH", tMONTH_UNIT, 1 }, { "FORTNIGHT",tDAY_UNIT, 14 }, { "WEEK", tDAY_UNIT, 7 }, { "DAY", tDAY_UNIT, 1 }, { "HOUR", tHOUR_UNIT, 1 }, { "MINUTE", tMINUTE_UNIT, 1 }, { "MIN", tMINUTE_UNIT, 1 }, { "SECOND", tSEC_UNIT, 1 }, { "SEC", tSEC_UNIT, 1 }, { 0, 0, 0 } }
table const time_zone_table[] [static] |
const yysigned_char yycheck[] [static] |
const unsigned char yydefact[] [static] |
Initial value:
{ 2, 0, 1, 21, 43, 19, 46, 16, 49, 0, 40, 52, 37, 18, 0, 53, 3, 4, 5, 6, 8, 7, 9, 34, 10, 22, 17, 0, 29, 20, 42, 45, 48, 39, 51, 36, 23, 41, 44, 11, 47, 31, 38, 50, 35, 0, 0, 0, 33, 28, 0, 27, 32, 26, 54, 24, 30, 55, 13, 0, 12, 0, 54, 25, 15, 14 }
Definition at line 528 of file getdate.c.
Referenced by yyparse().
const yysigned_char yydefgoto[] [static] |
const yysigned_char yypact[] [static] |
Initial value:
{ -17, 0, -17, 1, -17, -17, -17, 19, -17, -16, -17, -17, -17, 32, 26, 14, -17, -17, -17, -17, -17, -17, -17, 27, -17, -17, -17, -13, 24, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, 25, -17, -17, -17, 29, 30, 31, -17, -17, 33, -17, -17, -17, 28, 34, -17, -17, -17, 35, -17, 36, -7, -17, -17, -17 }
Definition at line 549 of file getdate.c.
Referenced by yyparse().
const yysigned_char yypgoto[] [static] |
const unsigned char yyr1[] [static] |
const unsigned char yyr2[] [static] |
const unsigned char yystos[] [static] |
Initial value:
{ 0, 23, 0, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 24, 25, 26, 27, 28, 29, 30, 31, 32, 20, 4, 17, 18, 4, 6, 8, 11, 13, 14, 15, 5, 6, 8, 10, 11, 12, 13, 14, 15, 17, 19, 21, 3, 17, 20, 17, 18, 17, 18, 18, 18, 10, 17, 19, 33, 21, 18, 18, 17, 33 }
const unsigned char yytable[] [static] |
const unsigned char yytranslate[] [static] |