1 /* A Bison parser, made by GNU Bison 2.4.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
6 2009, 2010 Free Software Foundation, Inc.
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
37 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
44 /* Identify Bison output. */
48 #define YYBISON_VERSION "2.4.3"
51 #define YYSKELETON_NAME "yacc.c"
62 /* Using locations. */
63 #define YYLSP_NEEDED 0
65 /* Substitute the variable and function names. */
66 #define yyparse parse_events_parse
67 #define yylex parse_events_lex
68 #define yyerror parse_events_error
69 #define yylval parse_events_lval
70 #define yychar parse_events_char
71 #define yydebug parse_events_debug
72 #define yynerrs parse_events_nerrs
75 /* Copy the first part of user declarations. */
77 /* Line 189 of yacc.c */
78 #line 6 "util/parse-events.y"
83 #include <linux/compiler.h>
84 #include <linux/list.h>
87 #include "parse-events.h"
89 extern int parse_events_lex (void);
91 #define ABORT_ON(val) \
99 /* Line 189 of yacc.c */
100 #line 101 "util/parse-events-bison.c"
102 /* Enabling traces. */
107 /* Enabling verbose error messages. */
108 #ifdef YYERROR_VERBOSE
109 # undef YYERROR_VERBOSE
110 # define YYERROR_VERBOSE 1
112 # define YYERROR_VERBOSE 0
115 /* Enabling the token table. */
116 #ifndef YYTOKEN_TABLE
117 # define YYTOKEN_TABLE 0
124 /* Put the tokens into the symbol table, so that GDB and other debuggers
131 PE_MODIFIER_EVENT = 262,
132 PE_MODIFIER_BP = 263,
133 PE_NAME_CACHE_TYPE = 264,
134 PE_NAME_CACHE_OP_RESULT = 265,
143 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
144 typedef union YYSTYPE
147 /* Line 214 of yacc.c */
148 #line 42 "util/parse-events.y"
155 /* Line 214 of yacc.c */
156 #line 157 "util/parse-events-bison.c"
158 # define YYSTYPE_IS_TRIVIAL 1
159 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
160 # define YYSTYPE_IS_DECLARED 1
164 /* Copy the second part of user declarations. */
167 /* Line 264 of yacc.c */
168 #line 169 "util/parse-events-bison.c"
175 typedef YYTYPE_UINT8 yytype_uint8;
177 typedef unsigned char yytype_uint8;
181 typedef YYTYPE_INT8 yytype_int8;
182 #elif (defined __STDC__ || defined __C99__FUNC__ \
183 || defined __cplusplus || defined _MSC_VER)
184 typedef signed char yytype_int8;
186 typedef short int yytype_int8;
190 typedef YYTYPE_UINT16 yytype_uint16;
192 typedef unsigned short int yytype_uint16;
196 typedef YYTYPE_INT16 yytype_int16;
198 typedef short int yytype_int16;
202 # ifdef __SIZE_TYPE__
203 # define YYSIZE_T __SIZE_TYPE__
204 # elif defined size_t
205 # define YYSIZE_T size_t
206 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
207 || defined __cplusplus || defined _MSC_VER)
208 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
209 # define YYSIZE_T size_t
211 # define YYSIZE_T unsigned int
215 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
218 # if defined YYENABLE_NLS && YYENABLE_NLS
220 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
221 # define YY_(msgid) dgettext ("bison-runtime", msgid)
225 # define YY_(msgid) msgid
229 /* Suppress unused-variable warnings by "using" E. */
230 #if ! defined lint || defined __GNUC__
231 # define YYUSE(e) ((void) (e))
233 # define YYUSE(e) /* empty */
236 /* Identity function, used to suppress warnings about constant conditions. */
240 #if (defined __STDC__ || defined __C99__FUNC__ \
241 || defined __cplusplus || defined _MSC_VER)
254 #if ! defined yyoverflow || YYERROR_VERBOSE
256 /* The parser invokes alloca or malloc; define the necessary symbols. */
258 # ifdef YYSTACK_USE_ALLOCA
259 # if YYSTACK_USE_ALLOCA
261 # define YYSTACK_ALLOC __builtin_alloca
262 # elif defined __BUILTIN_VA_ARG_INCR
263 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
265 # define YYSTACK_ALLOC __alloca
266 # elif defined _MSC_VER
267 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
268 # define alloca _alloca
270 # define YYSTACK_ALLOC alloca
271 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
272 || defined __cplusplus || defined _MSC_VER)
273 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
282 # ifdef YYSTACK_ALLOC
283 /* Pacify GCC's `empty if-body' warning. */
284 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
285 # ifndef YYSTACK_ALLOC_MAXIMUM
286 /* The OS might guarantee only one guard page at the bottom of the stack,
287 and a page size can be as small as 4096 bytes. So we cannot safely
288 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
289 to allow for a few compiler-allocated temporary stack slots. */
290 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
293 # define YYSTACK_ALLOC YYMALLOC
294 # define YYSTACK_FREE YYFREE
295 # ifndef YYSTACK_ALLOC_MAXIMUM
296 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
298 # if (defined __cplusplus && ! defined _STDLIB_H \
299 && ! ((defined YYMALLOC || defined malloc) \
300 && (defined YYFREE || defined free)))
301 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
307 # define YYMALLOC malloc
308 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
309 || defined __cplusplus || defined _MSC_VER)
310 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
315 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
316 || defined __cplusplus || defined _MSC_VER)
317 void free (void *); /* INFRINGES ON USER NAME SPACE */
321 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
324 #if (! defined yyoverflow \
325 && (! defined __cplusplus \
326 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
328 /* A type that is properly aligned for any stack member. */
331 yytype_int16 yyss_alloc;
335 /* The size of the maximum gap between one aligned stack and the next. */
336 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
338 /* The size of an array large to enough to hold all stacks, each with
340 # define YYSTACK_BYTES(N) \
341 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
342 + YYSTACK_GAP_MAXIMUM)
344 /* Copy COUNT objects from FROM to TO. The source and destination do
347 # if defined __GNUC__ && 1 < __GNUC__
348 # define YYCOPY(To, From, Count) \
349 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
351 # define YYCOPY(To, From, Count) \
355 for (yyi = 0; yyi < (Count); yyi++) \
356 (To)[yyi] = (From)[yyi]; \
362 /* Relocate STACK from its old location to the new one. The
363 local variables YYSIZE and YYSTACKSIZE give the old and new number of
364 elements in the stack, and YYPTR gives the new location of the
365 stack. Advance YYPTR to a properly aligned location for the next
367 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
370 YYSIZE_T yynewbytes; \
371 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
372 Stack = &yyptr->Stack_alloc; \
373 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
374 yyptr += yynewbytes / sizeof (*yyptr); \
380 /* YYFINAL -- State number of the termination state. */
382 /* YYLAST -- Last index in YYTABLE. */
385 /* YYNTOKENS -- Number of terminals. */
387 /* YYNNTS -- Number of nonterminals. */
389 /* YYNRULES -- Number of rules. */
391 /* YYNRULES -- Number of states. */
394 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
396 #define YYMAXUTOK 268
398 #define YYTRANSLATE(YYX) \
399 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
401 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
402 static const yytype_uint8 yytranslate[] =
404 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 14, 15, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 16, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
430 5, 6, 7, 8, 9, 10, 11, 12, 13
434 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
436 static const yytype_uint8 yyprhs[] =
438 0, 0, 3, 7, 9, 12, 14, 17, 20, 22,
439 25, 28, 31, 33, 39, 43, 45, 51, 55, 59,
443 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
444 static const yytype_int8 yyrhs[] =
446 18, 0, -1, 18, 14, 19, -1, 19, -1, 20,
447 7, -1, 20, -1, 21, 27, -1, 22, 27, -1,
448 23, -1, 24, 27, -1, 25, 27, -1, 26, 27,
449 -1, 4, -1, 9, 15, 10, 15, 10, -1, 9,
450 15, 10, -1, 9, -1, 11, 3, 16, 8, 27,
451 -1, 11, 3, 27, -1, 6, 16, 6, -1, 3,
452 16, 3, -1, 5, -1, 16, -1, -1
455 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
456 static const yytype_uint8 yyrline[] =
458 0, 49, 49, 49, 52, 57, 59, 60, 61, 62,
459 63, 64, 67, 76, 81, 86, 92, 97, 103, 109,
464 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
465 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
466 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
467 static const char *const yytname[] =
469 "$end", "error", "$undefined", "PE_VALUE", "PE_VALUE_SYM", "PE_RAW",
470 "PE_NAME", "PE_MODIFIER_EVENT", "PE_MODIFIER_BP", "PE_NAME_CACHE_TYPE",
471 "PE_NAME_CACHE_OP_RESULT", "PE_PREFIX_MEM", "PE_PREFIX_RAW", "PE_ERROR",
472 "','", "'-'", "':'", "$accept", "events", "event", "event_def",
473 "event_legacy_symbol", "event_legacy_cache", "event_legacy_mem",
474 "event_legacy_tracepoint", "event_legacy_numeric", "event_legacy_raw",
480 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
482 static const yytype_uint16 yytoknum[] =
484 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
485 265, 266, 267, 268, 44, 45, 58
489 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
490 static const yytype_uint8 yyr1[] =
492 0, 17, 18, 18, 19, 19, 20, 20, 20, 20,
493 20, 20, 21, 22, 22, 22, 23, 23, 24, 25,
497 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
498 static const yytype_uint8 yyr2[] =
500 0, 2, 3, 1, 2, 1, 2, 2, 1, 2,
501 2, 2, 1, 5, 3, 1, 5, 3, 3, 3,
505 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
506 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
507 means the default is an error. */
508 static const yytype_uint8 yydefact[] =
510 0, 0, 12, 20, 0, 15, 0, 0, 3, 5,
511 22, 22, 8, 22, 22, 22, 0, 0, 0, 22,
512 1, 0, 4, 21, 6, 7, 9, 10, 11, 19,
513 18, 14, 21, 17, 2, 0, 22, 13, 16
516 /* YYDEFGOTO[NTERM-NUM]. */
517 static const yytype_int8 yydefgoto[] =
519 -1, 7, 8, 9, 10, 11, 12, 13, 14, 15,
523 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
525 #define YYPACT_NINF -12
526 static const yytype_int8 yypact[] =
528 7, -10, -12, -12, -9, -6, 2, 1, -12, 10,
529 -2, -2, -12, -2, -2, -2, 16, 14, 11, 6,
530 -12, 7, -12, -12, -12, -12, -12, -12, -12, -12,
531 -12, 8, 18, -12, -12, 17, -2, -12, -12
534 /* YYPGOTO[NTERM-NUM]. */
535 static const yytype_int8 yypgoto[] =
537 -12, -12, 3, -12, -12, -12, -12, -12, -12, -12,
541 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
542 positive, shift that token. If negative, reduce the rule which
543 number is the opposite. If zero, do what YYDEFACT says.
544 If YYTABLE_NINF, syntax error. */
545 #define YYTABLE_NINF -1
546 static const yytype_uint8 yytable[] =
548 25, 20, 26, 27, 28, 19, 16, 17, 33, 18,
549 1, 2, 3, 4, 23, 21, 5, 22, 6, 29,
550 30, 31, 32, 35, 34, 38, 36, 37
553 static const yytype_uint8 yycheck[] =
555 11, 0, 13, 14, 15, 3, 16, 16, 19, 15,
556 3, 4, 5, 6, 16, 14, 9, 7, 11, 3,
557 6, 10, 16, 15, 21, 36, 8, 10
560 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
561 symbol of state STATE-NUM. */
562 static const yytype_uint8 yystos[] =
564 0, 3, 4, 5, 6, 9, 11, 18, 19, 20,
565 21, 22, 23, 24, 25, 26, 16, 16, 15, 3,
566 0, 14, 7, 16, 27, 27, 27, 27, 27, 3,
567 6, 10, 16, 27, 19, 15, 8, 10, 27
570 #define yyerrok (yyerrstatus = 0)
571 #define yyclearin (yychar = YYEMPTY)
575 #define YYACCEPT goto yyacceptlab
576 #define YYABORT goto yyabortlab
577 #define YYERROR goto yyerrorlab
580 /* Like YYERROR except do call yyerror. This remains here temporarily
581 to ease the transition to the new meaning of YYERROR, for GCC.
582 Once GCC version 2 has supplanted version 1, this can go. However,
583 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
584 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
587 #define YYFAIL goto yyerrlab
589 /* This is here to suppress warnings from the GCC cpp's
590 -Wunused-macros. Normally we don't worry about that warning, but
591 some users do, and we want to make it easy for users to remove
592 YYFAIL uses, which will produce warnings from Bison 2.5. */
595 #define YYRECOVERING() (!!yyerrstatus)
597 #define YYBACKUP(Token, Value) \
599 if (yychar == YYEMPTY && yylen == 1) \
603 yytoken = YYTRANSLATE (yychar); \
609 yyerror (list, idx, YY_("syntax error: cannot back up")); \
616 #define YYERRCODE 256
619 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
620 If N is 0, then set CURRENT to the empty location which ends
621 the previous symbol: RHS[0] (always defined). */
623 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
624 #ifndef YYLLOC_DEFAULT
625 # define YYLLOC_DEFAULT(Current, Rhs, N) \
629 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
630 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
631 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
632 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
636 (Current).first_line = (Current).last_line = \
637 YYRHSLOC (Rhs, 0).last_line; \
638 (Current).first_column = (Current).last_column = \
639 YYRHSLOC (Rhs, 0).last_column; \
645 /* YY_LOCATION_PRINT -- Print the location on the stream.
646 This macro was not mandated originally: define only if we know
647 we won't break user code: when these are the locations we know. */
649 #ifndef YY_LOCATION_PRINT
650 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
651 # define YY_LOCATION_PRINT(File, Loc) \
652 fprintf (File, "%d.%d-%d.%d", \
653 (Loc).first_line, (Loc).first_column, \
654 (Loc).last_line, (Loc).last_column)
656 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
661 /* YYLEX -- calling `yylex' with the right arguments. */
664 # define YYLEX yylex (YYLEX_PARAM)
666 # define YYLEX yylex ()
669 /* Enable debugging if requested. */
673 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
674 # define YYFPRINTF fprintf
677 # define YYDPRINTF(Args) \
683 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
687 YYFPRINTF (stderr, "%s ", Title); \
688 yy_symbol_print (stderr, \
689 Type, Value, list, idx); \
690 YYFPRINTF (stderr, "\n"); \
695 /*--------------------------------.
696 | Print this symbol on YYOUTPUT. |
697 `--------------------------------*/
700 #if (defined __STDC__ || defined __C99__FUNC__ \
701 || defined __cplusplus || defined _MSC_VER)
703 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list, int *idx)
706 yy_symbol_value_print (yyoutput, yytype, yyvaluep, list, idx)
709 YYSTYPE const * const yyvaluep;
710 struct list_head *list;
719 if (yytype < YYNTOKENS)
720 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
732 /*--------------------------------.
733 | Print this symbol on YYOUTPUT. |
734 `--------------------------------*/
736 #if (defined __STDC__ || defined __C99__FUNC__ \
737 || defined __cplusplus || defined _MSC_VER)
739 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list, int *idx)
742 yy_symbol_print (yyoutput, yytype, yyvaluep, list, idx)
745 YYSTYPE const * const yyvaluep;
746 struct list_head *list;
750 if (yytype < YYNTOKENS)
751 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
753 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
755 yy_symbol_value_print (yyoutput, yytype, yyvaluep, list, idx);
756 YYFPRINTF (yyoutput, ")");
759 /*------------------------------------------------------------------.
760 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
762 `------------------------------------------------------------------*/
764 #if (defined __STDC__ || defined __C99__FUNC__ \
765 || defined __cplusplus || defined _MSC_VER)
767 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
770 yy_stack_print (yybottom, yytop)
771 yytype_int16 *yybottom;
775 YYFPRINTF (stderr, "Stack now");
776 for (; yybottom <= yytop; yybottom++)
778 int yybot = *yybottom;
779 YYFPRINTF (stderr, " %d", yybot);
781 YYFPRINTF (stderr, "\n");
784 # define YY_STACK_PRINT(Bottom, Top) \
787 yy_stack_print ((Bottom), (Top)); \
791 /*------------------------------------------------.
792 | Report that the YYRULE is going to be reduced. |
793 `------------------------------------------------*/
795 #if (defined __STDC__ || defined __C99__FUNC__ \
796 || defined __cplusplus || defined _MSC_VER)
798 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct list_head *list, int *idx)
801 yy_reduce_print (yyvsp, yyrule, list, idx)
804 struct list_head *list;
808 int yynrhs = yyr2[yyrule];
810 unsigned long int yylno = yyrline[yyrule];
811 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
813 /* The symbols being reduced. */
814 for (yyi = 0; yyi < yynrhs; yyi++)
816 YYFPRINTF (stderr, " $%d = ", yyi + 1);
817 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
818 &(yyvsp[(yyi + 1) - (yynrhs)])
820 YYFPRINTF (stderr, "\n");
824 # define YY_REDUCE_PRINT(Rule) \
827 yy_reduce_print (yyvsp, Rule, list, idx); \
830 /* Nonzero means print parse trace. It is left uninitialized so that
831 multiple parsers can coexist. */
834 # define YYDPRINTF(Args)
835 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
836 # define YY_STACK_PRINT(Bottom, Top)
837 # define YY_REDUCE_PRINT(Rule)
838 #endif /* !YYDEBUG */
841 /* YYINITDEPTH -- initial size of the parser's stacks. */
843 # define YYINITDEPTH 200
846 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
847 if the built-in stack extension method is used).
849 Do not make this value too large; the results are undefined if
850 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
851 evaluated with infinite-precision integer arithmetic. */
854 # define YYMAXDEPTH 10000
862 # if defined __GLIBC__ && defined _STRING_H
863 # define yystrlen strlen
865 /* Return the length of YYSTR. */
866 #if (defined __STDC__ || defined __C99__FUNC__ \
867 || defined __cplusplus || defined _MSC_VER)
869 yystrlen (const char *yystr)
877 for (yylen = 0; yystr[yylen]; yylen++)
885 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
886 # define yystpcpy stpcpy
888 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
890 #if (defined __STDC__ || defined __C99__FUNC__ \
891 || defined __cplusplus || defined _MSC_VER)
893 yystpcpy (char *yydest, const char *yysrc)
896 yystpcpy (yydest, yysrc)
902 const char *yys = yysrc;
904 while ((*yyd++ = *yys++) != '\0')
913 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
914 quotes and backslashes, so that it's suitable for yyerror. The
915 heuristic is that double-quoting is unnecessary unless the string
916 contains an apostrophe, a comma, or backslash (other than
917 backslash-backslash). YYSTR is taken from yytname. If YYRES is
918 null, do not copy; instead, return the length of what the result
921 yytnamerr (char *yyres, const char *yystr)
926 char const *yyp = yystr;
933 goto do_not_strip_quotes;
937 goto do_not_strip_quotes;
950 do_not_strip_quotes: ;
954 return yystrlen (yystr);
956 return yystpcpy (yyres, yystr) - yyres;
960 /* Copy into YYRESULT an error message about the unexpected token
961 YYCHAR while in state YYSTATE. Return the number of bytes copied,
962 including the terminating null byte. If YYRESULT is null, do not
963 copy anything; just return the number of bytes that would be
964 copied. As a special case, return 0 if an ordinary "syntax error"
965 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
968 yysyntax_error (char *yyresult, int yystate, int yychar)
970 int yyn = yypact[yystate];
972 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
976 int yytype = YYTRANSLATE (yychar);
977 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
978 YYSIZE_T yysize = yysize0;
980 int yysize_overflow = 0;
981 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
982 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
986 /* This is so xgettext sees the translatable formats that are
987 constructed on the fly. */
988 YY_("syntax error, unexpected %s");
989 YY_("syntax error, unexpected %s, expecting %s");
990 YY_("syntax error, unexpected %s, expecting %s or %s");
991 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
992 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
996 static char const yyunexpected[] = "syntax error, unexpected %s";
997 static char const yyexpecting[] = ", expecting %s";
998 static char const yyor[] = " or %s";
999 char yyformat[sizeof yyunexpected
1000 + sizeof yyexpecting - 1
1001 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1002 * (sizeof yyor - 1))];
1003 char const *yyprefix = yyexpecting;
1005 /* Start YYX at -YYN if negative to avoid negative indexes in
1007 int yyxbegin = yyn < 0 ? -yyn : 0;
1009 /* Stay within bounds of both yycheck and yytname. */
1010 int yychecklim = YYLAST - yyn + 1;
1011 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1014 yyarg[0] = yytname[yytype];
1015 yyfmt = yystpcpy (yyformat, yyunexpected);
1017 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1018 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1020 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1024 yyformat[sizeof yyunexpected - 1] = '\0';
1027 yyarg[yycount++] = yytname[yyx];
1028 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1029 yysize_overflow |= (yysize1 < yysize);
1031 yyfmt = yystpcpy (yyfmt, yyprefix);
1035 yyf = YY_(yyformat);
1036 yysize1 = yysize + yystrlen (yyf);
1037 yysize_overflow |= (yysize1 < yysize);
1040 if (yysize_overflow)
1041 return YYSIZE_MAXIMUM;
1045 /* Avoid sprintf, as that infringes on the user's name space.
1046 Don't have undefined behavior even if the translation
1047 produced a string with the wrong number of "%s"s. */
1048 char *yyp = yyresult;
1050 while ((*yyp = *yyf) != '\0')
1052 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1054 yyp += yytnamerr (yyp, yyarg[yyi++]);
1067 #endif /* YYERROR_VERBOSE */
1070 /*-----------------------------------------------.
1071 | Release the memory associated to this symbol. |
1072 `-----------------------------------------------*/
1075 #if (defined __STDC__ || defined __C99__FUNC__ \
1076 || defined __cplusplus || defined _MSC_VER)
1078 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct list_head *list, int *idx)
1081 yydestruct (yymsg, yytype, yyvaluep, list, idx)
1085 struct list_head *list;
1095 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1105 /* Prevent warnings from -Wmissing-prototypes. */
1106 #ifdef YYPARSE_PARAM
1107 #if defined __STDC__ || defined __cplusplus
1108 int yyparse (void *YYPARSE_PARAM);
1112 #else /* ! YYPARSE_PARAM */
1113 #if defined __STDC__ || defined __cplusplus
1114 int yyparse (struct list_head *list, int *idx);
1118 #endif /* ! YYPARSE_PARAM */
1121 /* The lookahead symbol. */
1124 /* The semantic value of the lookahead symbol. */
1127 /* Number of syntax errors so far. */
1132 /*-------------------------.
1133 | yyparse or yypush_parse. |
1134 `-------------------------*/
1136 #ifdef YYPARSE_PARAM
1137 #if (defined __STDC__ || defined __C99__FUNC__ \
1138 || defined __cplusplus || defined _MSC_VER)
1140 yyparse (void *YYPARSE_PARAM)
1143 yyparse (YYPARSE_PARAM)
1144 void *YYPARSE_PARAM;
1146 #else /* ! YYPARSE_PARAM */
1147 #if (defined __STDC__ || defined __C99__FUNC__ \
1148 || defined __cplusplus || defined _MSC_VER)
1150 yyparse (struct list_head *list, int *idx)
1154 struct list_head *list;
1162 /* Number of tokens to shift before error messages enabled. */
1165 /* The stacks and their tools:
1166 `yyss': related to states.
1167 `yyvs': related to semantic values.
1169 Refer to the stacks thru separate pointers, to allow yyoverflow
1170 to reallocate them elsewhere. */
1172 /* The state stack. */
1173 yytype_int16 yyssa[YYINITDEPTH];
1175 yytype_int16 *yyssp;
1177 /* The semantic value stack. */
1178 YYSTYPE yyvsa[YYINITDEPTH];
1182 YYSIZE_T yystacksize;
1186 /* Lookahead token as an internal (translated) token number. */
1188 /* The variables used to return semantic value and location from the
1193 /* Buffer for error messages, and its allocated size. */
1195 char *yymsg = yymsgbuf;
1196 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1199 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1201 /* The number of symbols on the RHS of the reduced rule.
1202 Keep to zero when no symbol should be popped. */
1208 yystacksize = YYINITDEPTH;
1210 YYDPRINTF ((stderr, "Starting parse\n"));
1215 yychar = YYEMPTY; /* Cause a token to be read. */
1217 /* Initialize stack pointers.
1218 Waste one element of value and location stack
1219 so that they stay on the same level as the state stack.
1220 The wasted elements are never initialized. */
1226 /*------------------------------------------------------------.
1227 | yynewstate -- Push a new state, which is found in yystate. |
1228 `------------------------------------------------------------*/
1230 /* In all cases, when you get here, the value and location stacks
1231 have just been pushed. So pushing a state here evens the stacks. */
1237 if (yyss + yystacksize - 1 <= yyssp)
1239 /* Get the current used size of the three stacks, in elements. */
1240 YYSIZE_T yysize = yyssp - yyss + 1;
1244 /* Give user a chance to reallocate the stack. Use copies of
1245 these so that the &'s don't force the real ones into
1247 YYSTYPE *yyvs1 = yyvs;
1248 yytype_int16 *yyss1 = yyss;
1250 /* Each stack pointer address is followed by the size of the
1251 data in use in that stack, in bytes. This used to be a
1252 conditional around just the two extra args, but that might
1253 be undefined if yyoverflow is a macro. */
1254 yyoverflow (YY_("memory exhausted"),
1255 &yyss1, yysize * sizeof (*yyssp),
1256 &yyvs1, yysize * sizeof (*yyvsp),
1262 #else /* no yyoverflow */
1263 # ifndef YYSTACK_RELOCATE
1264 goto yyexhaustedlab;
1266 /* Extend the stack our own way. */
1267 if (YYMAXDEPTH <= yystacksize)
1268 goto yyexhaustedlab;
1270 if (YYMAXDEPTH < yystacksize)
1271 yystacksize = YYMAXDEPTH;
1274 yytype_int16 *yyss1 = yyss;
1275 union yyalloc *yyptr =
1276 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1278 goto yyexhaustedlab;
1279 YYSTACK_RELOCATE (yyss_alloc, yyss);
1280 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1281 # undef YYSTACK_RELOCATE
1283 YYSTACK_FREE (yyss1);
1286 #endif /* no yyoverflow */
1288 yyssp = yyss + yysize - 1;
1289 yyvsp = yyvs + yysize - 1;
1291 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1292 (unsigned long int) yystacksize));
1294 if (yyss + yystacksize - 1 <= yyssp)
1298 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1300 if (yystate == YYFINAL)
1310 /* Do appropriate processing given the current state. Read a
1311 lookahead token if we need one and don't already have one. */
1313 /* First try to decide what to do without reference to lookahead token. */
1314 yyn = yypact[yystate];
1315 if (yyn == YYPACT_NINF)
1318 /* Not known => get a lookahead token if don't already have one. */
1320 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1321 if (yychar == YYEMPTY)
1323 YYDPRINTF ((stderr, "Reading a token: "));
1327 if (yychar <= YYEOF)
1329 yychar = yytoken = YYEOF;
1330 YYDPRINTF ((stderr, "Now at end of input.\n"));
1334 yytoken = YYTRANSLATE (yychar);
1335 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1338 /* If the proper action on seeing token YYTOKEN is to reduce or to
1339 detect an error, take that action. */
1341 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1346 if (yyn == 0 || yyn == YYTABLE_NINF)
1352 /* Count tokens shifted since error; after three, turn off error
1357 /* Shift the lookahead token. */
1358 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1360 /* Discard the shifted token. */
1369 /*-----------------------------------------------------------.
1370 | yydefault -- do the default action for the current state. |
1371 `-----------------------------------------------------------*/
1373 yyn = yydefact[yystate];
1379 /*-----------------------------.
1380 | yyreduce -- Do a reduction. |
1381 `-----------------------------*/
1383 /* yyn is the number of a rule to reduce with. */
1386 /* If YYLEN is nonzero, implement the default value of the action:
1389 Otherwise, the following line sets YYVAL to garbage.
1390 This behavior is undocumented and Bison
1391 users should not rely upon it. Assigning to YYVAL
1392 unconditionally makes the parser a bit smaller, and it avoids a
1393 GCC warning that YYVAL may be used uninitialized. */
1394 yyval = yyvsp[1-yylen];
1397 YY_REDUCE_PRINT (yyn);
1402 /* Line 1464 of yacc.c */
1403 #line 53 "util/parse-events.y"
1405 ABORT_ON(parse_events_modifier(list, (yyvsp[(2) - (2)].str)));
1411 /* Line 1464 of yacc.c */
1412 #line 68 "util/parse-events.y"
1414 int type = (yyvsp[(1) - (1)].num) >> 16;
1415 int config = (yyvsp[(1) - (1)].num) & 255;
1417 ABORT_ON(parse_events_add_numeric(list, idx, type, config));
1423 /* Line 1464 of yacc.c */
1424 #line 77 "util/parse-events.y"
1426 ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), (yyvsp[(5) - (5)].str)));
1432 /* Line 1464 of yacc.c */
1433 #line 82 "util/parse-events.y"
1435 ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), NULL));
1441 /* Line 1464 of yacc.c */
1442 #line 87 "util/parse-events.y"
1444 ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (1)].str), NULL, NULL));
1450 /* Line 1464 of yacc.c */
1451 #line 93 "util/parse-events.y"
1453 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) (yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].str)));
1459 /* Line 1464 of yacc.c */
1460 #line 98 "util/parse-events.y"
1462 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) (yyvsp[(2) - (3)].num), NULL));
1468 /* Line 1464 of yacc.c */
1469 #line 104 "util/parse-events.y"
1471 ABORT_ON(parse_events_add_tracepoint(list, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)));
1477 /* Line 1464 of yacc.c */
1478 #line 110 "util/parse-events.y"
1480 ABORT_ON(parse_events_add_numeric(list, idx, (yyvsp[(1) - (3)].num), (yyvsp[(3) - (3)].num)));
1486 /* Line 1464 of yacc.c */
1487 #line 116 "util/parse-events.y"
1489 ABORT_ON(parse_events_add_numeric(list, idx, PERF_TYPE_RAW, (yyvsp[(1) - (1)].num)));
1495 /* Line 1464 of yacc.c */
1496 #line 1497 "util/parse-events-bison.c"
1499 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1503 YY_STACK_PRINT (yyss, yyssp);
1507 /* Now `shift' the result of the reduction. Determine what state
1508 that goes to, based on the state we popped back to and the rule
1509 number reduced by. */
1513 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1514 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1515 yystate = yytable[yystate];
1517 yystate = yydefgoto[yyn - YYNTOKENS];
1522 /*------------------------------------.
1523 | yyerrlab -- here on detecting error |
1524 `------------------------------------*/
1526 /* If not already recovering from an error, report this error. */
1530 #if ! YYERROR_VERBOSE
1531 yyerror (list, idx, YY_("syntax error"));
1534 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1535 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1537 YYSIZE_T yyalloc = 2 * yysize;
1538 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1539 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1540 if (yymsg != yymsgbuf)
1541 YYSTACK_FREE (yymsg);
1542 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1544 yymsg_alloc = yyalloc;
1548 yymsg_alloc = sizeof yymsgbuf;
1552 if (0 < yysize && yysize <= yymsg_alloc)
1554 (void) yysyntax_error (yymsg, yystate, yychar);
1555 yyerror (list, idx, yymsg);
1559 yyerror (list, idx, YY_("syntax error"));
1561 goto yyexhaustedlab;
1569 if (yyerrstatus == 3)
1571 /* If just tried and failed to reuse lookahead token after an
1572 error, discard it. */
1574 if (yychar <= YYEOF)
1576 /* Return failure if at end of input. */
1577 if (yychar == YYEOF)
1582 yydestruct ("Error: discarding",
1583 yytoken, &yylval, list, idx);
1588 /* Else will try to reuse lookahead token after shifting the error
1593 /*---------------------------------------------------.
1594 | yyerrorlab -- error raised explicitly by YYERROR. |
1595 `---------------------------------------------------*/
1598 /* Pacify compilers like GCC when the user code never invokes
1599 YYERROR and the label yyerrorlab therefore never appears in user
1601 if (/*CONSTCOND*/ 0)
1604 /* Do not reclaim the symbols of the rule which action triggered
1608 YY_STACK_PRINT (yyss, yyssp);
1613 /*-------------------------------------------------------------.
1614 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1615 `-------------------------------------------------------------*/
1617 yyerrstatus = 3; /* Each real token shifted decrements this. */
1621 yyn = yypact[yystate];
1622 if (yyn != YYPACT_NINF)
1625 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1633 /* Pop the current state because it cannot handle the error token. */
1638 yydestruct ("Error: popping",
1639 yystos[yystate], yyvsp, list, idx);
1642 YY_STACK_PRINT (yyss, yyssp);
1648 /* Shift the error token. */
1649 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1655 /*-------------------------------------.
1656 | yyacceptlab -- YYACCEPT comes here. |
1657 `-------------------------------------*/
1662 /*-----------------------------------.
1663 | yyabortlab -- YYABORT comes here. |
1664 `-----------------------------------*/
1669 #if !defined(yyoverflow) || YYERROR_VERBOSE
1670 /*-------------------------------------------------.
1671 | yyexhaustedlab -- memory exhaustion comes here. |
1672 `-------------------------------------------------*/
1674 yyerror (list, idx, YY_("memory exhausted"));
1680 if (yychar != YYEMPTY)
1681 yydestruct ("Cleanup: discarding lookahead",
1682 yytoken, &yylval, list, idx);
1683 /* Do not reclaim the symbols of the rule which action triggered
1684 this YYABORT or YYACCEPT. */
1686 YY_STACK_PRINT (yyss, yyssp);
1687 while (yyssp != yyss)
1689 yydestruct ("Cleanup: popping",
1690 yystos[*yyssp], yyvsp, list, idx);
1695 YYSTACK_FREE (yyss);
1698 if (yymsg != yymsgbuf)
1699 YYSTACK_FREE (yymsg);
1701 /* Make sure YYID is used. */
1702 return YYID (yyresult);
1707 /* Line 1684 of yacc.c */
1708 #line 122 "util/parse-events.y"
1711 void parse_events_error(struct list_head *list __used, int *idx __used,
1712 char const *msg __used)