47 #define YYBISON_VERSION "3.0.4" 50 #define YYSKELETON_NAME "yacc.c" 63 #define yyparse expr__parse 64 #define yylex expr__lex 65 #define yyerror expr__error 66 #define yydebug expr__debug 67 #define yynerrs expr__nerrs 81 #line 82 "util/expr-bison.c" 84 # if defined __cplusplus && 201103L <= __cplusplus 85 # define YY_NULLPTR nullptr 92 #ifdef YYERROR_VERBOSE 93 # undef YYERROR_VERBOSE 94 # define YYERROR_VERBOSE 1 96 # define YYERROR_VERBOSE 0 101 #ifndef YY_EXPR_UTIL_EXPR_BISON_H_INCLUDED 102 # define YY_EXPR_UTIL_EXPR_BISON_H_INCLUDED 108 extern int expr__debug;
124 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 128 #line 18 "util/expr.y" 133 #line 134 "util/expr-bison.c" 137 # define YYSTYPE_IS_TRIVIAL 1 138 # define YYSTYPE_IS_DECLARED 1 148 #line 33 "util/expr.y" 154 const char **pp __maybe_unused,
164 for (i = 0; i < ctx->
num_ids; i++) {
165 if (!strcasecmp(ctx->
ids[i].
name,
id)) {
174 #line 175 "util/expr-bison.c" 205 # ifdef __SIZE_TYPE__ 206 # define YYSIZE_T __SIZE_TYPE__ 207 # elif defined size_t 208 # define YYSIZE_T size_t 209 # elif ! defined YYSIZE_T 211 # define YYSIZE_T size_t 213 # define YYSIZE_T unsigned int 217 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 220 # if defined YYENABLE_NLS && YYENABLE_NLS 222 # include <libintl.h> 223 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 227 # define YY_(Msgid) Msgid 232 # if (defined __GNUC__ \ 233 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 234 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 235 # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 237 # define YY_ATTRIBUTE(Spec) 241 #ifndef YY_ATTRIBUTE_PURE 242 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 245 #ifndef YY_ATTRIBUTE_UNUSED 246 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 249 #if !defined _Noreturn \ 250 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) 251 # if defined _MSC_VER && 1200 <= _MSC_VER 252 # define _Noreturn __declspec (noreturn) 254 # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) 259 #if ! defined lint || defined __GNUC__ 260 # define YYUSE(E) ((void) (E)) 265 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 267 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 268 _Pragma ("GCC diagnostic push") \ 269 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 270 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 271 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 272 _Pragma ("GCC diagnostic pop") 274 # define YY_INITIAL_VALUE(Value) Value 276 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 277 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 278 # define YY_IGNORE_MAYBE_UNINITIALIZED_END 280 #ifndef YY_INITIAL_VALUE 281 # define YY_INITIAL_VALUE(Value) 285 #if ! defined yyoverflow || YYERROR_VERBOSE 289 # ifdef YYSTACK_USE_ALLOCA 290 # if YYSTACK_USE_ALLOCA 292 # define YYSTACK_ALLOC __builtin_alloca 293 # elif defined __BUILTIN_VA_ARG_INCR 296 # define YYSTACK_ALLOC __alloca 297 # elif defined _MSC_VER 299 # define alloca _alloca 301 # define YYSTACK_ALLOC alloca 302 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 305 # ifndef EXIT_SUCCESS 306 # define EXIT_SUCCESS 0 313 # ifdef YYSTACK_ALLOC 315 # define YYSTACK_FREE(Ptr) do { ; } while (0) 316 # ifndef YYSTACK_ALLOC_MAXIMUM 321 # define YYSTACK_ALLOC_MAXIMUM 4032 324 # define YYSTACK_ALLOC YYMALLOC 325 # define YYSTACK_FREE YYFREE 326 # ifndef YYSTACK_ALLOC_MAXIMUM 327 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 329 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 330 && ! ((defined YYMALLOC || defined malloc) \ 331 && (defined YYFREE || defined free))) 333 # ifndef EXIT_SUCCESS 334 # define EXIT_SUCCESS 0 338 # define YYMALLOC malloc 339 # if ! defined malloc && ! defined EXIT_SUCCESS 345 # if ! defined free && ! defined EXIT_SUCCESS 353 #if (! defined yyoverflow \ 354 && (! defined __cplusplus \ 355 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 365 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 369 # define YYSTACK_BYTES(N) \ 370 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 371 + YYSTACK_GAP_MAXIMUM) 373 # define YYCOPY_NEEDED 1 380 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 383 YYSIZE_T yynewbytes; \ 384 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 385 Stack = &yyptr->Stack_alloc; \ 386 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 387 yyptr += yynewbytes / sizeof (*yyptr); \ 393 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 397 # if defined __GNUC__ && 1 < __GNUC__ 398 # define YYCOPY(Dst, Src, Count) \ 399 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 401 # define YYCOPY(Dst, Src, Count) \ 405 for (yyi = 0; yyi < (Count); yyi++) \ 406 (Dst)[yyi] = (Src)[yyi]; \ 430 #define YYMAXUTOK 261 432 #define YYTRANSLATE(YYX) \ 433 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 439 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 12, 7, 2,
443 15, 16, 10, 9, 2, 8, 2, 11, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 6, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 5, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
472 0, 60, 60, 63, 64, 69, 70, 71, 72, 73,
477 #if YYDEBUG || YYERROR_VERBOSE || 0 480 static const char *
const yytname[] =
482 "$end",
"error",
"$undefined",
"NUMBER",
"ID",
"'|'",
"'^'",
"'&'",
483 "'-'",
"'+'",
"'*'",
"'/'",
"'%'",
"NEG",
"NOT",
"'('",
"')'",
"$accept",
493 0, 256, 257, 258, 259, 124, 94, 38, 45, 43,
494 42, 47, 37, 260, 261, 40, 41
498 #define YYPACT_NINF -9 500 #define yypact_value_is_default(Yystate) \ 501 (!!((Yystate) == (-9))) 503 #define YYTABLE_NINF -1 505 #define yytable_value_is_error(Yytable_value) \ 512 -3, -9, -9, -3, -3, 8, 19, -9, 10, -9,
513 -3, -3, -3, -3, -3, -9, -8, -8, -9, -9,
522 0, 3, 4, 0, 0, 0, 2, 10, 0, 1,
523 0, 0, 0, 0, 0, 11, 6, 5, 7, 8,
544 1, 2, 12, 13, 14, 3, 7, 8, 9, 0,
545 0, 0, 4, 16, 17, 18, 19, 20, 10, 11,
546 12, 13, 14, 0, 0, 0, 15, 10, 11, 12,
552 3, 4, 10, 11, 12, 8, 3, 4, 0, -1,
553 -1, -1, 15, 10, 11, 12, 13, 14, 8, 9,
554 10, 11, 12, -1, -1, -1, 16, 8, 9, 10,
562 0, 3, 4, 8, 15, 18, 19, 19, 19, 0,
563 8, 9, 10, 11, 12, 16, 19, 19, 19, 19,
570 0, 17, 18, 19, 19, 19, 19, 19, 19, 19,
577 0, 2, 1, 1, 1, 3, 3, 3, 3, 3,
582 #define yyerrok (yyerrstatus = 0) 583 #define yyclearin (yychar = YYEMPTY) 587 #define YYACCEPT goto yyacceptlab 588 #define YYABORT goto yyabortlab 589 #define YYERROR goto yyerrorlab 592 #define YYRECOVERING() (!!yyerrstatus) 594 #define YYBACKUP(Token, Value) \ 596 if (yychar == YYEMPTY) \ 600 YYPOPSTACK (yylen); \ 606 yyerror (final_val, ctx, pp, YY_("syntax error: cannot back up")); \ 613 #define YYERRCODE 256 622 # define YYFPRINTF fprintf 625 # define YYDPRINTF(Args) \ 632 #ifndef YY_LOCATION_PRINT 633 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 637 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 641 YYFPRINTF (stderr, "%s ", Title); \ 642 yy_symbol_print (stderr, \ 643 Type, Value, final_val, ctx, pp); \ 644 YYFPRINTF (stderr, "\n"); \ 656 FILE *yyo = yyoutput;
665 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
694 for (; yybottom <= yytop; yybottom++)
696 int yybot = *yybottom;
702 # define YY_STACK_PRINT(Bottom, Top) \ 705 yy_stack_print ((Bottom), (Top)); \ 716 unsigned long int yylno =
yyrline[yyrule];
717 int yynrhs =
yyr2[yyrule];
719 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
722 for (yyi = 0; yyi < yynrhs; yyi++)
726 yystos[yyssp[yyi + 1 - yynrhs]],
727 &(yyvsp[(yyi + 1) - (yynrhs)])
728 , final_val, ctx, pp);
733 # define YY_REDUCE_PRINT(Rule) \ 736 yy_reduce_print (yyssp, yyvsp, Rule, final_val, ctx, pp); \ 743 # define YYDPRINTF(Args) 744 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 745 # define YY_STACK_PRINT(Bottom, Top) 746 # define YY_REDUCE_PRINT(Rule) 752 # define YYINITDEPTH 200 763 # define YYMAXDEPTH 10000 770 # if defined __GLIBC__ && defined _STRING_H 771 # define yystrlen strlen 775 yystrlen (
const char *yystr)
778 for (yylen = 0; yystr[yylen]; yylen++)
786 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 787 # define yystpcpy stpcpy 792 yystpcpy (
char *yydest,
const char *yysrc)
795 const char *yys = yysrc;
797 while ((*yyd++ = *yys++) !=
'\0')
814 yytnamerr (
char *yyres,
const char *yystr)
819 char const *yyp = yystr;
826 goto do_not_strip_quotes;
830 goto do_not_strip_quotes;
843 do_not_strip_quotes: ;
847 return yystrlen (yystr);
849 return yystpcpy (yyres, yystr) - yyres;
862 yysyntax_error (
YYSIZE_T *yymsg_alloc,
char **yymsg,
867 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
871 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
902 yyarg[yycount++] =
yytname[yytoken];
908 int yyxbegin = yyn < 0 ? -yyn : 0;
910 int yychecklim =
YYLAST - yyn + 1;
914 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
918 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
924 yyarg[yycount++] =
yytname[yyx];
927 if (! (yysize <= yysize1
938 # define YYCASE_(N, S) \ 942 YYCASE_(0,
YY_(
"syntax error"));
943 YYCASE_(1,
YY_(
"syntax error, unexpected %s"));
944 YYCASE_(2,
YY_(
"syntax error, unexpected %s, expecting %s"));
945 YYCASE_(3,
YY_(
"syntax error, unexpected %s, expecting %s or %s"));
946 YYCASE_(4,
YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
947 YYCASE_(5,
YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
952 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
958 if (*yymsg_alloc < yysize)
960 *yymsg_alloc = 2 * yysize;
961 if (! (yysize <= *yymsg_alloc
973 while ((*yyp = *yyformat) !=
'\0')
974 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
976 yyp += yytnamerr (yyp, yyarg[yyi++]);
1066 char *yymsg = yymsgbuf;
1067 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1070 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1076 yyssp = yyss = yyssa;
1077 yyvsp = yyvs = yyvsa;
1080 YYDPRINTF ((stderr,
"Starting parse\n"));
1099 if (yyss + yystacksize - 1 <= yyssp)
1102 YYSIZE_T yysize = yyssp - yyss + 1;
1116 yyoverflow (
YY_(
"memory exhausted"),
1117 &yyss1, yysize *
sizeof (*yyssp),
1118 &yyvs1, yysize *
sizeof (*yyvsp),
1125 # ifndef YYSTACK_RELOCATE 1126 goto yyexhaustedlab;
1130 goto yyexhaustedlab;
1140 goto yyexhaustedlab;
1143 # undef YYSTACK_RELOCATE 1150 yyssp = yyss + yysize - 1;
1151 yyvsp = yyvs + yysize - 1;
1153 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1154 (
unsigned long int) yystacksize));
1156 if (yyss + yystacksize - 1 <= yyssp)
1160 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1185 YYDPRINTF ((stderr,
"Reading a token: "));
1189 if (yychar <=
YYEOF)
1191 yychar = yytoken =
YYEOF;
1192 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1258 yyval = yyvsp[1-yylen];
1265 #line 60 "util/expr.y" 1266 { *final_val = (yyvsp[0].num); }
1267 #line 1268 "util/expr-bison.c" 1271 #line 64 "util/expr.y" 1272 {
if (
lookup_id(ctx, (yyvsp[0].
id), &(yyval.
num)) < 0) {
1273 pr_debug(
"%s not found", (yyvsp[0].
id));
1277 #line 1278 "util/expr-bison.c" 1281 #line 69 "util/expr.y" 1282 { (yyval.
num) = (yyvsp[-2].
num) + (yyvsp[0].num); }
1283 #line 1284 "util/expr-bison.c" 1287 #line 70 "util/expr.y" 1288 { (yyval.
num) = (yyvsp[-2].
num) - (yyvsp[0].num); }
1289 #line 1290 "util/expr-bison.c" 1293 #line 71 "util/expr.y" 1294 { (yyval.
num) = (yyvsp[-2].
num) * (yyvsp[0].num); }
1295 #line 1296 "util/expr-bison.c" 1299 #line 72 "util/expr.y" 1300 {
if ((yyvsp[0].
num) == 0)
YYABORT; (yyval.
num) = (yyvsp[-2].num) / (yyvsp[0].num); }
1301 #line 1302 "util/expr-bison.c" 1305 #line 73 "util/expr.y" 1306 {
if ((
long)(yyvsp[0].num) == 0)
YYABORT; (yyval.
num) = (
long)(yyvsp[-2].num) % (
long)(yyvsp[0].num); }
1307 #line 1308 "util/expr-bison.c" 1311 #line 74 "util/expr.y" 1312 { (yyval.
num) = -(yyvsp[0].
num); }
1313 #line 1314 "util/expr-bison.c" 1317 #line 75 "util/expr.y" 1318 { (yyval.
num) = (yyvsp[-1].
num); }
1319 #line 1320 "util/expr-bison.c" 1323 #line 1324 "util/expr-bison.c" 1352 if (0 <= yystate && yystate <=
YYLAST &&
yycheck[yystate] == *yyssp)
1372 #if ! YYERROR_VERBOSE 1373 yyerror (final_val, ctx, pp,
YY_(
"syntax error"));
1375 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1378 char const *yymsgp =
YY_(
"syntax error");
1379 int yysyntax_error_status;
1380 yysyntax_error_status = YYSYNTAX_ERROR;
1381 if (yysyntax_error_status == 0)
1383 else if (yysyntax_error_status == 1)
1385 if (yymsg != yymsgbuf)
1391 yymsg_alloc =
sizeof yymsgbuf;
1392 yysyntax_error_status = 2;
1396 yysyntax_error_status = YYSYNTAX_ERROR;
1400 yyerror (final_val, ctx, pp, yymsgp);
1401 if (yysyntax_error_status == 2)
1402 goto yyexhaustedlab;
1404 # undef YYSYNTAX_ERROR 1410 if (yyerrstatus == 3)
1415 if (yychar <=
YYEOF)
1418 if (yychar ==
YYEOF)
1424 yytoken, &
yylval, final_val, ctx, pp);
1480 yystos[yystate], yyvsp, final_val, ctx, pp);
1512 #if !defined yyoverflow || YYERROR_VERBOSE 1517 yyerror (final_val, ctx, pp,
YY_(
"memory exhausted"));
1529 yytoken, &
yylval, final_val, ctx, pp);
1535 while (yyssp != yyss)
1538 yystos[*yyssp], yyvsp, final_val, ctx, pp);
1546 if (yymsg != yymsgbuf)
1551 #line 78 "util/expr.y" 1556 char *dst = res->
id;
1559 while (
isalnum(*p) || *p ==
'_' || *p ==
'.') {
1573 const char *p = *pp;
1582 case '0' ...
'9':
case '.':
1583 res->
num = strtod(s, (
char **)&p);
1612 const char *orig = p;
1628 if (tok ==
ID && strcasecmp(one, val.
id)) {
1630 pr_debug(
"Too many extra events in %s\n", orig);
1633 (*other)[num_other] = strdup(val.
id);
1634 if (!(*other)[num_other])
1639 (*other)[num_other] = NULL;
1640 *num_otherp = num_other;
static const yytype_uint8 yytranslate[]
struct parse_id ids[MAX_PARSE_ID]
static const yytype_uint8 yystos[]
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
unsigned short int yytype_uint16
static void yy_reduce_print(yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, void *_data, void *scanner)
static void yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep, YYLTYPE const *const yylocationp, void *_data, void *scanner)
static const yytype_int8 yypgoto[]
static void yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep, double *final_val, struct parse_ctx *ctx, const char **pp)
void expr__ctx_init(struct parse_ctx *ctx)
static const yytype_uint8 yydefact[]
unsigned char yytype_uint8
static int lookup_id(struct parse_ctx *ctx, char *id, double *val)
static const yytype_int8 yycheck[]
#define pr_debug(fmt,...)
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
static const yytype_uint8 yytable[]
static const yytype_int8 yypact[]
static const yytype_uint8 yyr2[]
static void yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep, YYLTYPE const *const yylocationp, void *_data, void *scanner)
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
static int expr__lex(YYSTYPE *res, const char **pp)
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
#define yypact_value_is_default(Yystate)
#define yytable_value_is_error(Yytable_value)
static int expr__symbol(YYSTYPE *res, const char *p, const char **pp)
#define YY_REDUCE_PRINT(Rule)
#define YY_STACK_PRINT(Bottom, Top)
#define YY_INITIAL_VALUE(Value)
static const char *const yytname[]
static const yytype_uint16 yyrline[]
static const yytype_int8 yydefgoto[]
static void expr__error(double *final_val __maybe_unused, struct parse_ctx *ctx __maybe_unused, const char **pp __maybe_unused, const char *s)
int expr__parse(double *final_val, struct parse_ctx *ctx, const char **pp)
#define YYSTACK_ALLOC_MAXIMUM
void expr__add_id(struct parse_ctx *ctx, const char *name, double val)
int expr__find_other(const char *p, const char *one, const char ***other, int *num_otherp)
static void yy_stack_print(yytype_int16 *yybottom, yytype_int16 *yytop)
static const yytype_uint8 yyr1[]