2 /* A Bison parser, made by GNU Bison 2.4.1. */
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
38 /* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
45 /* Identify Bison output. */
49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
63 /* Using locations. */
64 #define YYLSP_NEEDED 0
66 /* Substitute the variable and function names. */
67 #define yyparse __ktrfmt_parse
68 #define yylex __ktrfmt_lex
69 #define yyerror __ktrfmt_error
70 #define yylval __ktrfmt_lval
71 #define yychar __ktrfmt_char
72 #define yydebug __ktrfmt_debug
73 #define yynerrs __ktrfmt_nerrs
76 /* Copy the first part of user declarations. */
78 /* Line 189 of yacc.c */
90 #include "ktrfmt.tab.h"
93 struct ktrfmt_parse_ctx {
94 struct symtab *symtab;
95 struct evtr_variable *var;
96 struct evtr_variable_value *val;
103 int __ktrfmtlex(YYSTYPE *);
104 #define __ktrfmt_lex __ktrfmtlex
106 void __ktrfmt_error (struct ktrfmt_parse_ctx *, const char *);
110 do_parse_err(struct ktrfmt_parse_ctx *ctx, const char *fmt, ...)
115 vsnprintf(ctx->errbuf, ctx->errbufsz, fmt, ap);
120 #define parse_err(fmt, ...) \
122 do_parse_err(ctx, fmt, ##__VA_ARGS__); \
127 struct evtr_variable *
128 evtr_var_new(const char *name)
130 struct evtr_variable *var;
132 var = calloc(1, sizeof(*var));
134 if (!(var->name = strdup(name))) {
138 var->val.type = EVTR_VAL_NIL;
144 * XXX: should be reentrant
151 static char buf[100];
154 snprintf(buf, sizeof(buf), "@%ld", serno);
160 index_hash(struct ktrfmt_parse_ctx *ctx, const char *hashname,
161 evtr_variable_value_t val, evtr_var_t *_var)
165 hsh = symtab_find(ctx->symtab, hashname);
166 if (hsh->val.type == EVTR_VAL_NIL) {
167 /* it's probably the first time we see this "variable" */
168 printd(PARSE, "creating hash for %s\n", hsh->name);
169 hsh->val.type = EVTR_VAL_HASH;
170 hsh->val.hashtab = hash_new();
171 } else if (hsh->val.type != EVTR_VAL_HASH) {
172 printd(PARSE, "trying to use type %d as hash\n", hsh->val.type);
175 if (val->type == EVTR_VAL_INT) {
177 printd(PARSE, "looking up %s[%jd] in %p\n", hsh->name,
178 val->num, hsh->val.hashtab);
179 } else if (val->type == EVTR_VAL_STR) {
180 key = (uintptr_t)val->str;
181 printd(PARSE, "looking up %s[\"%s\"] in %p\n", hsh->name,
182 val->str, hsh->val.hashtab);
184 do_parse_err(ctx, "trying to index hash '%s' with "
185 "non-supported value", hashname);
189 if (hash_find(hsh->val.hashtab, key, &ret)) {
190 printd(PARSE, "didn't find it\n");
191 var = evtr_var_new(uniq_varname());
193 printd(PARSE, "inserting it as %s\n", var->name);
194 if (!hash_insert(hsh->val.hashtab, key,
196 do_parse_err(ctx, "can't insert temporary "
197 "variable into hash\n");
200 symtab_insert(ctx->symtab, var->name, var);
202 do_parse_err(ctx, "out of memory");
205 var = (struct evtr_variable *)ret;
208 fprintf(stderr, "no var!\n");
218 /* Line 189 of yacc.c */
219 #line 220 "ktrfmt.tab.c"
221 /* Enabling traces. */
226 /* Enabling verbose error messages. */
227 #ifdef YYERROR_VERBOSE
228 # undef YYERROR_VERBOSE
229 # define YYERROR_VERBOSE 1
231 # define YYERROR_VERBOSE 1
234 /* Enabling the token table. */
235 #ifndef YYTOKEN_TABLE
236 # define YYTOKEN_TABLE 0
243 /* Put the tokens into the symbol table, so that GDB and other debuggers
250 TOK_LEFT_BRACK = 262,
251 TOK_RIGHT_BRACK = 263,
258 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
259 typedef union YYSTYPE
262 /* Line 214 of yacc.c */
266 struct evtr_variable *var;
267 struct evtr_variable_value *val;
272 /* Line 214 of yacc.c */
273 #line 274 "ktrfmt.tab.c"
275 # define YYSTYPE_IS_TRIVIAL 1
276 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
277 # define YYSTYPE_IS_DECLARED 1
281 /* Copy the second part of user declarations. */
284 /* Line 264 of yacc.c */
285 #line 286 "ktrfmt.tab.c"
292 typedef YYTYPE_UINT8 yytype_uint8;
294 typedef unsigned char yytype_uint8;
298 typedef YYTYPE_INT8 yytype_int8;
299 #elif (defined __STDC__ || defined __C99__FUNC__ \
300 || defined __cplusplus || defined _MSC_VER)
301 typedef signed char yytype_int8;
303 typedef short int yytype_int8;
307 typedef YYTYPE_UINT16 yytype_uint16;
309 typedef unsigned short int yytype_uint16;
313 typedef YYTYPE_INT16 yytype_int16;
315 typedef short int yytype_int16;
319 # ifdef __SIZE_TYPE__
320 # define YYSIZE_T __SIZE_TYPE__
321 # elif defined size_t
322 # define YYSIZE_T size_t
323 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
324 || defined __cplusplus || defined _MSC_VER)
325 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
326 # define YYSIZE_T size_t
328 # define YYSIZE_T unsigned int
332 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
337 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
338 # define YY_(msgid) dgettext ("bison-runtime", msgid)
342 # define YY_(msgid) msgid
346 /* Suppress unused-variable warnings by "using" E. */
347 #if ! defined lint || defined __GNUC__
348 # define YYUSE(e) ((void) (e))
350 # define YYUSE(e) /* empty */
353 /* Identity function, used to suppress warnings about constant conditions. */
357 #if (defined __STDC__ || defined __C99__FUNC__ \
358 || defined __cplusplus || defined _MSC_VER)
371 #if ! defined yyoverflow || YYERROR_VERBOSE
373 /* The parser invokes alloca or malloc; define the necessary symbols. */
375 # ifdef YYSTACK_USE_ALLOCA
376 # if YYSTACK_USE_ALLOCA
378 # define YYSTACK_ALLOC __builtin_alloca
379 # elif defined __BUILTIN_VA_ARG_INCR
380 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
382 # define YYSTACK_ALLOC __alloca
383 # elif defined _MSC_VER
384 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
385 # define alloca _alloca
387 # define YYSTACK_ALLOC alloca
388 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
389 || defined __cplusplus || defined _MSC_VER)
390 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
399 # ifdef YYSTACK_ALLOC
400 /* Pacify GCC's `empty if-body' warning. */
401 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
402 # ifndef YYSTACK_ALLOC_MAXIMUM
403 /* The OS might guarantee only one guard page at the bottom of the stack,
404 and a page size can be as small as 4096 bytes. So we cannot safely
405 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
406 to allow for a few compiler-allocated temporary stack slots. */
407 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
410 # define YYSTACK_ALLOC YYMALLOC
411 # define YYSTACK_FREE YYFREE
412 # ifndef YYSTACK_ALLOC_MAXIMUM
413 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
415 # if (defined __cplusplus && ! defined _STDLIB_H \
416 && ! ((defined YYMALLOC || defined malloc) \
417 && (defined YYFREE || defined free)))
418 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
424 # define YYMALLOC malloc
425 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
426 || defined __cplusplus || defined _MSC_VER)
427 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
432 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
433 || defined __cplusplus || defined _MSC_VER)
434 void free (void *); /* INFRINGES ON USER NAME SPACE */
438 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
441 #if (! defined yyoverflow \
442 && (! defined __cplusplus \
443 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
445 /* A type that is properly aligned for any stack member. */
448 yytype_int16 yyss_alloc;
452 /* The size of the maximum gap between one aligned stack and the next. */
453 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
455 /* The size of an array large to enough to hold all stacks, each with
457 # define YYSTACK_BYTES(N) \
458 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
459 + YYSTACK_GAP_MAXIMUM)
461 /* Copy COUNT objects from FROM to TO. The source and destination do
464 # if defined __GNUC__ && 1 < __GNUC__
465 # define YYCOPY(To, From, Count) \
466 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
468 # define YYCOPY(To, From, Count) \
472 for (yyi = 0; yyi < (Count); yyi++) \
473 (To)[yyi] = (From)[yyi]; \
479 /* Relocate STACK from its old location to the new one. The
480 local variables YYSIZE and YYSTACKSIZE give the old and new number of
481 elements in the stack, and YYPTR gives the new location of the
482 stack. Advance YYPTR to a properly aligned location for the next
484 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
487 YYSIZE_T yynewbytes; \
488 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
489 Stack = &yyptr->Stack_alloc; \
490 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
491 yyptr += yynewbytes / sizeof (*yyptr); \
497 /* YYFINAL -- State number of the termination state. */
499 /* YYLAST -- Last index in YYTABLE. */
502 /* YYNTOKENS -- Number of terminals. */
504 /* YYNNTS -- Number of nonterminals. */
506 /* YYNRULES -- Number of rules. */
508 /* YYNRULES -- Number of states. */
511 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
513 #define YYMAXUTOK 264
515 #define YYTRANSLATE(YYX) \
516 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
518 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
519 static const yytype_uint8 yytranslate[] =
521 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
551 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
553 static const yytype_uint8 yyprhs[] =
555 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
559 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
560 static const yytype_int8 yyrhs[] =
562 11, 0, -1, 12, -1, 16, -1, 18, -1, 4,
563 -1, 5, -1, 3, -1, 13, -1, 15, 7, 15,
564 8, -1, 15, 9, 3, -1, 14, -1, 15, -1,
565 16, 6, 13, -1, 17, -1
568 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
569 static const yytype_uint16 yyrline[] =
571 0, 171, 171, 173, 176, 178, 192, 207, 225, 229,
572 236, 249, 253, 257, 265
576 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
577 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
578 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
579 static const char *const yytname[] =
581 "$end", "error", "$undefined", "TOK_ID", "TOK_INT", "TOK_STR", "TOK_EQ",
582 "TOK_LEFT_BRACK", "TOK_RIGHT_BRACK", "TOK_DOT", "$accept", "input",
583 "stmt", "constant", "primary_expr", "postfix_expr", "unary_expr",
584 "assign_expr", "expr", 0
589 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
591 static const yytype_uint16 yytoknum[] =
593 0, 256, 257, 258, 259, 260, 261, 262, 263, 264
597 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
598 static const yytype_uint8 yyr1[] =
600 0, 10, 11, 12, 12, 13, 13, 14, 14, 15,
604 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
605 static const yytype_uint8 yyr2[] =
607 0, 2, 1, 1, 1, 1, 1, 1, 1, 4,
611 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
612 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
613 means the default is an error. */
614 static const yytype_uint8 yydefact[] =
616 0, 7, 5, 6, 0, 2, 8, 11, 12, 3,
617 14, 4, 1, 0, 0, 0, 0, 10, 13, 9
620 /* YYDEFGOTO[NTERM-NUM]. */
621 static const yytype_int8 yydefgoto[] =
623 -1, 4, 5, 6, 7, 8, 9, 10, 11
626 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
628 #define YYPACT_NINF -5
629 static const yytype_int8 yypact[] =
631 -3, -5, -5, -5, 7, -5, -5, -5, -1, 6,
632 -5, -5, -5, -3, 8, 5, -4, -5, -5, -5
635 /* YYPGOTO[NTERM-NUM]. */
636 static const yytype_int8 yypgoto[] =
638 -5, -5, -5, -2, -5, 1, -5, -5, -5
641 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
642 positive, shift that token. If negative, reduce the rule which
643 number is the opposite. If zero, do what YYDEFACT says.
644 If YYTABLE_NINF, syntax error. */
645 #define YYTABLE_NINF -1
646 static const yytype_uint8 yytable[] =
648 1, 2, 3, 13, 19, 14, 13, 12, 14, 2,
652 static const yytype_uint8 yycheck[] =
654 3, 4, 5, 7, 8, 9, 7, 0, 9, 4,
658 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
659 symbol of state STATE-NUM. */
660 static const yytype_uint8 yystos[] =
662 0, 3, 4, 5, 11, 12, 13, 14, 15, 16,
663 17, 18, 0, 7, 9, 6, 15, 3, 13, 8
666 #define yyerrok (yyerrstatus = 0)
667 #define yyclearin (yychar = YYEMPTY)
671 #define YYACCEPT goto yyacceptlab
672 #define YYABORT goto yyabortlab
673 #define YYERROR goto yyerrorlab
676 /* Like YYERROR except do call yyerror. This remains here temporarily
677 to ease the transition to the new meaning of YYERROR, for GCC.
678 Once GCC version 2 has supplanted version 1, this can go. */
680 #define YYFAIL goto yyerrlab
682 #define YYRECOVERING() (!!yyerrstatus)
684 #define YYBACKUP(Token, Value) \
686 if (yychar == YYEMPTY && yylen == 1) \
690 yytoken = YYTRANSLATE (yychar); \
696 yyerror (ctx, YY_("syntax error: cannot back up")); \
703 #define YYERRCODE 256
706 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
707 If N is 0, then set CURRENT to the empty location which ends
708 the previous symbol: RHS[0] (always defined). */
710 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
711 #ifndef YYLLOC_DEFAULT
712 # define YYLLOC_DEFAULT(Current, Rhs, N) \
716 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
717 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
718 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
719 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
723 (Current).first_line = (Current).last_line = \
724 YYRHSLOC (Rhs, 0).last_line; \
725 (Current).first_column = (Current).last_column = \
726 YYRHSLOC (Rhs, 0).last_column; \
732 /* YY_LOCATION_PRINT -- Print the location on the stream.
733 This macro was not mandated originally: define only if we know
734 we won't break user code: when these are the locations we know. */
736 #ifndef YY_LOCATION_PRINT
737 # if YYLTYPE_IS_TRIVIAL
738 # define YY_LOCATION_PRINT(File, Loc) \
739 fprintf (File, "%d.%d-%d.%d", \
740 (Loc).first_line, (Loc).first_column, \
741 (Loc).last_line, (Loc).last_column)
743 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
748 /* YYLEX -- calling `yylex' with the right arguments. */
751 # define YYLEX yylex (&yylval, YYLEX_PARAM)
753 # define YYLEX yylex (&yylval)
756 /* Enable debugging if requested. */
760 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
761 # define YYFPRINTF fprintf
764 # define YYDPRINTF(Args) \
770 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
774 YYFPRINTF (stderr, "%s ", Title); \
775 yy_symbol_print (stderr, \
777 YYFPRINTF (stderr, "\n"); \
782 /*--------------------------------.
783 | Print this symbol on YYOUTPUT. |
784 `--------------------------------*/
787 #if (defined __STDC__ || defined __C99__FUNC__ \
788 || defined __cplusplus || defined _MSC_VER)
790 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct ktrfmt_parse_ctx *ctx)
793 yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx)
796 YYSTYPE const * const yyvaluep;
797 struct ktrfmt_parse_ctx *ctx;
804 if (yytype < YYNTOKENS)
805 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
817 /*--------------------------------.
818 | Print this symbol on YYOUTPUT. |
819 `--------------------------------*/
821 #if (defined __STDC__ || defined __C99__FUNC__ \
822 || defined __cplusplus || defined _MSC_VER)
824 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct ktrfmt_parse_ctx *ctx)
827 yy_symbol_print (yyoutput, yytype, yyvaluep, ctx)
830 YYSTYPE const * const yyvaluep;
831 struct ktrfmt_parse_ctx *ctx;
834 if (yytype < YYNTOKENS)
835 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
837 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
839 yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx);
840 YYFPRINTF (yyoutput, ")");
843 /*------------------------------------------------------------------.
844 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
846 `------------------------------------------------------------------*/
848 #if (defined __STDC__ || defined __C99__FUNC__ \
849 || defined __cplusplus || defined _MSC_VER)
851 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
854 yy_stack_print (yybottom, yytop)
855 yytype_int16 *yybottom;
859 YYFPRINTF (stderr, "Stack now");
860 for (; yybottom <= yytop; yybottom++)
862 int yybot = *yybottom;
863 YYFPRINTF (stderr, " %d", yybot);
865 YYFPRINTF (stderr, "\n");
868 # define YY_STACK_PRINT(Bottom, Top) \
871 yy_stack_print ((Bottom), (Top)); \
875 /*------------------------------------------------.
876 | Report that the YYRULE is going to be reduced. |
877 `------------------------------------------------*/
879 #if (defined __STDC__ || defined __C99__FUNC__ \
880 || defined __cplusplus || defined _MSC_VER)
882 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct ktrfmt_parse_ctx *ctx)
885 yy_reduce_print (yyvsp, yyrule, ctx)
888 struct ktrfmt_parse_ctx *ctx;
891 int yynrhs = yyr2[yyrule];
893 unsigned long int yylno = yyrline[yyrule];
894 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
896 /* The symbols being reduced. */
897 for (yyi = 0; yyi < yynrhs; yyi++)
899 YYFPRINTF (stderr, " $%d = ", yyi + 1);
900 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
901 &(yyvsp[(yyi + 1) - (yynrhs)])
903 YYFPRINTF (stderr, "\n");
907 # define YY_REDUCE_PRINT(Rule) \
910 yy_reduce_print (yyvsp, Rule, ctx); \
913 /* Nonzero means print parse trace. It is left uninitialized so that
914 multiple parsers can coexist. */
917 # define YYDPRINTF(Args)
918 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
919 # define YY_STACK_PRINT(Bottom, Top)
920 # define YY_REDUCE_PRINT(Rule)
921 #endif /* !YYDEBUG */
924 /* YYINITDEPTH -- initial size of the parser's stacks. */
926 # define YYINITDEPTH 200
929 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
930 if the built-in stack extension method is used).
932 Do not make this value too large; the results are undefined if
933 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
934 evaluated with infinite-precision integer arithmetic. */
937 # define YYMAXDEPTH 10000
945 # if defined __GLIBC__ && defined _STRING_H
946 # define yystrlen strlen
948 /* Return the length of YYSTR. */
949 #if (defined __STDC__ || defined __C99__FUNC__ \
950 || defined __cplusplus || defined _MSC_VER)
952 yystrlen (const char *yystr)
960 for (yylen = 0; yystr[yylen]; yylen++)
968 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
969 # define yystpcpy stpcpy
971 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
973 #if (defined __STDC__ || defined __C99__FUNC__ \
974 || defined __cplusplus || defined _MSC_VER)
976 yystpcpy (char *yydest, const char *yysrc)
979 yystpcpy (yydest, yysrc)
985 const char *yys = yysrc;
987 while ((*yyd++ = *yys++) != '\0')
996 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
997 quotes and backslashes, so that it's suitable for yyerror. The
998 heuristic is that double-quoting is unnecessary unless the string
999 contains an apostrophe, a comma, or backslash (other than
1000 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1001 null, do not copy; instead, return the length of what the result
1004 yytnamerr (char *yyres, const char *yystr)
1009 char const *yyp = yystr;
1016 goto do_not_strip_quotes;
1020 goto do_not_strip_quotes;
1033 do_not_strip_quotes: ;
1037 return yystrlen (yystr);
1039 return yystpcpy (yyres, yystr) - yyres;
1043 /* Copy into YYRESULT an error message about the unexpected token
1044 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1045 including the terminating null byte. If YYRESULT is null, do not
1046 copy anything; just return the number of bytes that would be
1047 copied. As a special case, return 0 if an ordinary "syntax error"
1048 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1049 size calculation. */
1051 yysyntax_error (char *yyresult, int yystate, int yychar)
1053 int yyn = yypact[yystate];
1055 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1059 int yytype = YYTRANSLATE (yychar);
1060 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1061 YYSIZE_T yysize = yysize0;
1063 int yysize_overflow = 0;
1064 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1065 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1069 /* This is so xgettext sees the translatable formats that are
1070 constructed on the fly. */
1071 YY_("syntax error, unexpected %s");
1072 YY_("syntax error, unexpected %s, expecting %s");
1073 YY_("syntax error, unexpected %s, expecting %s or %s");
1074 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1075 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1079 static char const yyunexpected[] = "syntax error, unexpected %s";
1080 static char const yyexpecting[] = ", expecting %s";
1081 static char const yyor[] = " or %s";
1082 char yyformat[sizeof yyunexpected
1083 + sizeof yyexpecting - 1
1084 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1085 * (sizeof yyor - 1))];
1086 char const *yyprefix = yyexpecting;
1088 /* Start YYX at -YYN if negative to avoid negative indexes in
1090 int yyxbegin = yyn < 0 ? -yyn : 0;
1092 /* Stay within bounds of both yycheck and yytname. */
1093 int yychecklim = YYLAST - yyn + 1;
1094 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1097 yyarg[0] = yytname[yytype];
1098 yyfmt = yystpcpy (yyformat, yyunexpected);
1100 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1101 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1103 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1107 yyformat[sizeof yyunexpected - 1] = '\0';
1110 yyarg[yycount++] = yytname[yyx];
1111 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1112 yysize_overflow |= (yysize1 < yysize);
1114 yyfmt = yystpcpy (yyfmt, yyprefix);
1118 yyf = YY_(yyformat);
1119 yysize1 = yysize + yystrlen (yyf);
1120 yysize_overflow |= (yysize1 < yysize);
1123 if (yysize_overflow)
1124 return YYSIZE_MAXIMUM;
1128 /* Avoid sprintf, as that infringes on the user's name space.
1129 Don't have undefined behavior even if the translation
1130 produced a string with the wrong number of "%s"s. */
1131 char *yyp = yyresult;
1133 while ((*yyp = *yyf) != '\0')
1135 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1137 yyp += yytnamerr (yyp, yyarg[yyi++]);
1150 #endif /* YYERROR_VERBOSE */
1153 /*-----------------------------------------------.
1154 | Release the memory associated to this symbol. |
1155 `-----------------------------------------------*/
1158 #if (defined __STDC__ || defined __C99__FUNC__ \
1159 || defined __cplusplus || defined _MSC_VER)
1161 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct ktrfmt_parse_ctx *ctx)
1164 yydestruct (yymsg, yytype, yyvaluep, ctx)
1168 struct ktrfmt_parse_ctx *ctx;
1176 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1186 /* Prevent warnings from -Wmissing-prototypes. */
1187 #ifdef YYPARSE_PARAM
1188 #if defined __STDC__ || defined __cplusplus
1189 int yyparse (void *YYPARSE_PARAM);
1193 #else /* ! YYPARSE_PARAM */
1194 #if defined __STDC__ || defined __cplusplus
1195 int yyparse (struct ktrfmt_parse_ctx *ctx);
1199 #endif /* ! YYPARSE_PARAM */
1205 /*-------------------------.
1206 | yyparse or yypush_parse. |
1207 `-------------------------*/
1209 #ifdef YYPARSE_PARAM
1210 #if (defined __STDC__ || defined __C99__FUNC__ \
1211 || defined __cplusplus || defined _MSC_VER)
1213 yyparse (void *YYPARSE_PARAM)
1216 yyparse (YYPARSE_PARAM)
1217 void *YYPARSE_PARAM;
1219 #else /* ! YYPARSE_PARAM */
1220 #if (defined __STDC__ || defined __C99__FUNC__ \
1221 || defined __cplusplus || defined _MSC_VER)
1223 yyparse (struct ktrfmt_parse_ctx *ctx)
1227 struct ktrfmt_parse_ctx *ctx;
1231 /* The lookahead symbol. */
1234 /* The semantic value of the lookahead symbol. */
1237 /* Number of syntax errors so far. */
1241 /* Number of tokens to shift before error messages enabled. */
1244 /* The stacks and their tools:
1245 `yyss': related to states.
1246 `yyvs': related to semantic values.
1248 Refer to the stacks thru separate pointers, to allow yyoverflow
1249 to reallocate them elsewhere. */
1251 /* The state stack. */
1252 yytype_int16 yyssa[YYINITDEPTH];
1254 yytype_int16 *yyssp;
1256 /* The semantic value stack. */
1257 YYSTYPE yyvsa[YYINITDEPTH];
1261 YYSIZE_T yystacksize;
1265 /* Lookahead token as an internal (translated) token number. */
1267 /* The variables used to return semantic value and location from the
1272 /* Buffer for error messages, and its allocated size. */
1274 char *yymsg = yymsgbuf;
1275 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1278 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1280 /* The number of symbols on the RHS of the reduced rule.
1281 Keep to zero when no symbol should be popped. */
1287 yystacksize = YYINITDEPTH;
1289 YYDPRINTF ((stderr, "Starting parse\n"));
1294 yychar = YYEMPTY; /* Cause a token to be read. */
1296 /* Initialize stack pointers.
1297 Waste one element of value and location stack
1298 so that they stay on the same level as the state stack.
1299 The wasted elements are never initialized. */
1305 /*------------------------------------------------------------.
1306 | yynewstate -- Push a new state, which is found in yystate. |
1307 `------------------------------------------------------------*/
1309 /* In all cases, when you get here, the value and location stacks
1310 have just been pushed. So pushing a state here evens the stacks. */
1316 if (yyss + yystacksize - 1 <= yyssp)
1318 /* Get the current used size of the three stacks, in elements. */
1319 YYSIZE_T yysize = yyssp - yyss + 1;
1323 /* Give user a chance to reallocate the stack. Use copies of
1324 these so that the &'s don't force the real ones into
1326 YYSTYPE *yyvs1 = yyvs;
1327 yytype_int16 *yyss1 = yyss;
1329 /* Each stack pointer address is followed by the size of the
1330 data in use in that stack, in bytes. This used to be a
1331 conditional around just the two extra args, but that might
1332 be undefined if yyoverflow is a macro. */
1333 yyoverflow (YY_("memory exhausted"),
1334 &yyss1, yysize * sizeof (*yyssp),
1335 &yyvs1, yysize * sizeof (*yyvsp),
1341 #else /* no yyoverflow */
1342 # ifndef YYSTACK_RELOCATE
1343 goto yyexhaustedlab;
1345 /* Extend the stack our own way. */
1346 if (YYMAXDEPTH <= yystacksize)
1347 goto yyexhaustedlab;
1349 if (YYMAXDEPTH < yystacksize)
1350 yystacksize = YYMAXDEPTH;
1353 yytype_int16 *yyss1 = yyss;
1354 union yyalloc *yyptr =
1355 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1357 goto yyexhaustedlab;
1358 YYSTACK_RELOCATE (yyss_alloc, yyss);
1359 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1360 # undef YYSTACK_RELOCATE
1362 YYSTACK_FREE (yyss1);
1365 #endif /* no yyoverflow */
1367 yyssp = yyss + yysize - 1;
1368 yyvsp = yyvs + yysize - 1;
1370 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1371 (unsigned long int) yystacksize));
1373 if (yyss + yystacksize - 1 <= yyssp)
1377 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1379 if (yystate == YYFINAL)
1389 /* Do appropriate processing given the current state. Read a
1390 lookahead token if we need one and don't already have one. */
1392 /* First try to decide what to do without reference to lookahead token. */
1393 yyn = yypact[yystate];
1394 if (yyn == YYPACT_NINF)
1397 /* Not known => get a lookahead token if don't already have one. */
1399 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1400 if (yychar == YYEMPTY)
1402 YYDPRINTF ((stderr, "Reading a token: "));
1406 if (yychar <= YYEOF)
1408 yychar = yytoken = YYEOF;
1409 YYDPRINTF ((stderr, "Now at end of input.\n"));
1413 yytoken = YYTRANSLATE (yychar);
1414 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1417 /* If the proper action on seeing token YYTOKEN is to reduce or to
1418 detect an error, take that action. */
1420 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1425 if (yyn == 0 || yyn == YYTABLE_NINF)
1431 /* Count tokens shifted since error; after three, turn off error
1436 /* Shift the lookahead token. */
1437 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1439 /* Discard the shifted token. */
1448 /*-----------------------------------------------------------.
1449 | yydefault -- do the default action for the current state. |
1450 `-----------------------------------------------------------*/
1452 yyn = yydefact[yystate];
1458 /*-----------------------------.
1459 | yyreduce -- Do a reduction. |
1460 `-----------------------------*/
1462 /* yyn is the number of a rule to reduce with. */
1465 /* If YYLEN is nonzero, implement the default value of the action:
1468 Otherwise, the following line sets YYVAL to garbage.
1469 This behavior is undocumented and Bison
1470 users should not rely upon it. Assigning to YYVAL
1471 unconditionally makes the parser a bit smaller, and it avoids a
1472 GCC warning that YYVAL may be used uninitialized. */
1473 yyval = yyvsp[1-yylen];
1476 YY_REDUCE_PRINT (yyn);
1481 /* Line 1455 of yacc.c */
1482 #line 173 "ktrfmt.y"
1484 ctx->var = (yyvsp[(1) - (1)].var);
1490 /* Line 1455 of yacc.c */
1491 #line 178 "ktrfmt.y"
1494 if (!(yyvsp[(1) - (1)].tok)->str)
1495 parse_err("out of memory");
1496 var = evtr_var_new(uniq_varname());
1497 var->val.type = EVTR_VAL_INT;
1499 var->val.num = strtoll((yyvsp[(1) - (1)].tok)->str, NULL, 0);
1501 parse_err("Can't parse numeric constant '%s'", (yyvsp[(1) - (1)].tok)->str);
1504 tok_free((yyvsp[(1) - (1)].tok));
1510 /* Line 1455 of yacc.c */
1511 #line 192 "ktrfmt.y"
1514 if (!(yyvsp[(1) - (1)].tok)->str)
1515 parse_err("out of memory");
1516 var = evtr_var_new(uniq_varname());
1517 var->val.type = EVTR_VAL_STR;
1518 var->val.str = (yyvsp[(1) - (1)].tok)->str;
1519 if (!var->val.str) {
1520 parse_err("out of memory");
1523 tok_free((yyvsp[(1) - (1)].tok));
1529 /* Line 1455 of yacc.c */
1530 #line 207 "ktrfmt.y"
1533 if (!(yyvsp[(1) - (1)].tok)->str)
1534 parse_err("out of memory");
1535 printd(PARSE, "TOK_ID\n");
1536 printd(PARSE, "tok: %p, str = %p\n", (yyvsp[(1) - (1)].tok), (yyvsp[(1) - (1)].tok)->str);
1537 var = symtab_find(ctx->symtab, (yyvsp[(1) - (1)].tok)->str);
1539 if (!(var = evtr_var_new((yyvsp[(1) - (1)].tok)->str))) {
1540 tok_free((yyvsp[(1) - (1)].tok));
1541 parse_err("out of memory");
1543 printd(PARSE, "creating var %s\n", (yyvsp[(1) - (1)].tok)->str);
1544 symtab_insert(ctx->symtab, (yyvsp[(1) - (1)].tok)->str, var);
1547 tok_free((yyvsp[(1) - (1)].tok));
1553 /* Line 1455 of yacc.c */
1554 #line 225 "ktrfmt.y"
1556 (yyval.var) = (yyvsp[(1) - (1)].var);
1562 /* Line 1455 of yacc.c */
1563 #line 229 "ktrfmt.y"
1567 if (index_hash(ctx, (yyvsp[(1) - (4)].var)->name, &(yyvsp[(3) - (4)].var)->val, &var))
1575 /* Line 1455 of yacc.c */
1576 #line 236 "ktrfmt.y"
1578 evtr_var_t var, tmp;
1579 if (!(yyvsp[(3) - (3)].tok)->str)
1580 parse_err("out of memory");
1581 tmp = evtr_var_new(uniq_varname());
1582 tmp->val.type = EVTR_VAL_STR;
1583 tmp->val.str = (yyvsp[(3) - (3)].tok)->str;
1585 if (index_hash(ctx, (yyvsp[(1) - (3)].var)->name, &tmp->val, &var))
1587 tok_free((yyvsp[(3) - (3)].tok));
1594 /* Line 1455 of yacc.c */
1595 #line 249 "ktrfmt.y"
1597 (yyval.var) = (yyvsp[(1) - (1)].var);
1603 /* Line 1455 of yacc.c */
1604 #line 253 "ktrfmt.y"
1606 (yyval.var) = (yyvsp[(1) - (1)].var);
1612 /* Line 1455 of yacc.c */
1613 #line 257 "ktrfmt.y"
1615 (yyvsp[(1) - (3)].var)->val = (yyvsp[(3) - (3)].var)->val;
1616 ctx->ev->type = EVTR_TYPE_STMT;
1617 ctx->ev->stmt.var = (yyvsp[(1) - (3)].var);
1618 ctx->ev->stmt.val = &(yyvsp[(3) - (3)].var)->val;
1619 ctx->ev->stmt.op = EVTR_OP_SET;
1625 /* Line 1455 of yacc.c */
1626 #line 265 "ktrfmt.y"
1628 (yyval.na) = (yyvsp[(1) - (1)].na);
1634 /* Line 1455 of yacc.c */
1635 #line 1636 "ktrfmt.tab.c"
1638 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1642 YY_STACK_PRINT (yyss, yyssp);
1646 /* Now `shift' the result of the reduction. Determine what state
1647 that goes to, based on the state we popped back to and the rule
1648 number reduced by. */
1652 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1653 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1654 yystate = yytable[yystate];
1656 yystate = yydefgoto[yyn - YYNTOKENS];
1661 /*------------------------------------.
1662 | yyerrlab -- here on detecting error |
1663 `------------------------------------*/
1665 /* If not already recovering from an error, report this error. */
1669 #if ! YYERROR_VERBOSE
1670 yyerror (ctx, YY_("syntax error"));
1673 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1674 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1676 YYSIZE_T yyalloc = 2 * yysize;
1677 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1678 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1679 if (yymsg != yymsgbuf)
1680 YYSTACK_FREE (yymsg);
1681 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1683 yymsg_alloc = yyalloc;
1687 yymsg_alloc = sizeof yymsgbuf;
1691 if (0 < yysize && yysize <= yymsg_alloc)
1693 (void) yysyntax_error (yymsg, yystate, yychar);
1694 yyerror (ctx, yymsg);
1698 yyerror (ctx, YY_("syntax error"));
1700 goto yyexhaustedlab;
1708 if (yyerrstatus == 3)
1710 /* If just tried and failed to reuse lookahead token after an
1711 error, discard it. */
1713 if (yychar <= YYEOF)
1715 /* Return failure if at end of input. */
1716 if (yychar == YYEOF)
1721 yydestruct ("Error: discarding",
1722 yytoken, &yylval, ctx);
1727 /* Else will try to reuse lookahead token after shifting the error
1732 /*---------------------------------------------------.
1733 | yyerrorlab -- error raised explicitly by YYERROR. |
1734 `---------------------------------------------------*/
1737 /* Pacify compilers like GCC when the user code never invokes
1738 YYERROR and the label yyerrorlab therefore never appears in user
1740 if (/*CONSTCOND*/ 0)
1743 /* Do not reclaim the symbols of the rule which action triggered
1747 YY_STACK_PRINT (yyss, yyssp);
1752 /*-------------------------------------------------------------.
1753 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1754 `-------------------------------------------------------------*/
1756 yyerrstatus = 3; /* Each real token shifted decrements this. */
1760 yyn = yypact[yystate];
1761 if (yyn != YYPACT_NINF)
1764 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1772 /* Pop the current state because it cannot handle the error token. */
1777 yydestruct ("Error: popping",
1778 yystos[yystate], yyvsp, ctx);
1781 YY_STACK_PRINT (yyss, yyssp);
1787 /* Shift the error token. */
1788 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1794 /*-------------------------------------.
1795 | yyacceptlab -- YYACCEPT comes here. |
1796 `-------------------------------------*/
1801 /*-----------------------------------.
1802 | yyabortlab -- YYABORT comes here. |
1803 `-----------------------------------*/
1808 #if !defined(yyoverflow) || YYERROR_VERBOSE
1809 /*-------------------------------------------------.
1810 | yyexhaustedlab -- memory exhaustion comes here. |
1811 `-------------------------------------------------*/
1813 yyerror (ctx, YY_("memory exhausted"));
1819 if (yychar != YYEMPTY)
1820 yydestruct ("Cleanup: discarding lookahead",
1821 yytoken, &yylval, ctx);
1822 /* Do not reclaim the symbols of the rule which action triggered
1823 this YYABORT or YYACCEPT. */
1825 YY_STACK_PRINT (yyss, yyssp);
1826 while (yyssp != yyss)
1828 yydestruct ("Cleanup: popping",
1829 yystos[*yyssp], yyvsp, ctx);
1834 YYSTACK_FREE (yyss);
1837 if (yymsg != yymsgbuf)
1838 YYSTACK_FREE (yymsg);
1840 /* Make sure YYID is used. */
1841 return YYID (yyresult);
1846 /* Line 1675 of yacc.c */
1847 #line 270 "ktrfmt.y"
1850 void * __ktrfmt_scan_string(const char *);
1851 void __ktrfmt_delete_buffer(void *);
1854 __ktrfmt_error (struct ktrfmt_parse_ctx *ctx, const char *s)
1856 do_parse_err(ctx, s);
1860 parse_string(evtr_event_t ev, struct symtab *symtab, const char *str,
1861 char *errbuf, size_t errbufsz)
1865 struct ktrfmt_parse_ctx ctx;
1867 printd(PARSE, "parsing \"%s\"\n", str);
1869 ctx.symtab = symtab;
1870 ctx.errbuf = errbuf;
1871 ctx.errbuf[0] = '\0';
1872 ctx.errbufsz = errbufsz;
1874 bufstate = __ktrfmt_scan_string(str);
1875 ret = __ktrfmt_parse(&ctx);
1876 __ktrfmt_delete_buffer(bufstate);
1882 parse_var(const char *str, struct symtab *symtab, struct evtr_variable **var,
1883 char *errbuf, size_t errbufsz)
1887 struct ktrfmt_parse_ctx ctx;
1889 printd(PARSE, "parsing \"%s\"\n", str);
1891 ctx.symtab = symtab;
1893 ctx.errbuf = errbuf;
1894 ctx.errbuf[0] = '\0';
1895 ctx.errbufsz = errbufsz;
1897 bufstate = __ktrfmt_scan_string(str);
1898 ret = __ktrfmt_parse(&ctx);
1899 __ktrfmt_delete_buffer(bufstate);