Blame


1 bff58270 2022-09-19 op /* A Bison parser, made by GNU Bison 3.7.6. */
2 bff58270 2022-09-19 op
3 bff58270 2022-09-19 op /* Bison implementation for Yacc-like parsers in C
4 bff58270 2022-09-19 op
5 bff58270 2022-09-19 op Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6 bff58270 2022-09-19 op Inc.
7 bff58270 2022-09-19 op
8 bff58270 2022-09-19 op This program is free software: you can redistribute it and/or modify
9 bff58270 2022-09-19 op it under the terms of the GNU General Public License as published by
10 bff58270 2022-09-19 op the Free Software Foundation, either version 3 of the License, or
11 bff58270 2022-09-19 op (at your option) any later version.
12 bff58270 2022-09-19 op
13 bff58270 2022-09-19 op This program is distributed in the hope that it will be useful,
14 bff58270 2022-09-19 op but WITHOUT ANY WARRANTY; without even the implied warranty of
15 bff58270 2022-09-19 op MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 bff58270 2022-09-19 op GNU General Public License for more details.
17 bff58270 2022-09-19 op
18 bff58270 2022-09-19 op You should have received a copy of the GNU General Public License
19 bff58270 2022-09-19 op along with this program. If not, see <https://www.gnu.org/licenses/>. */
20 bff58270 2022-09-19 op
21 bff58270 2022-09-19 op /* As a special exception, you may create a larger work that contains
22 bff58270 2022-09-19 op part or all of the Bison parser skeleton and distribute that work
23 bff58270 2022-09-19 op under terms of your choice, so long as that work isn't itself a
24 bff58270 2022-09-19 op parser generator using the skeleton or a modified version thereof
25 bff58270 2022-09-19 op as a parser skeleton. Alternatively, if you modify or redistribute
26 bff58270 2022-09-19 op the parser skeleton itself, you may (at your option) remove this
27 bff58270 2022-09-19 op special exception, which will cause the skeleton and the resulting
28 bff58270 2022-09-19 op Bison output files to be licensed under the GNU General Public
29 bff58270 2022-09-19 op License without this special exception.
30 bff58270 2022-09-19 op
31 bff58270 2022-09-19 op This special exception was added by the Free Software Foundation in
32 bff58270 2022-09-19 op version 2.2 of Bison. */
33 bff58270 2022-09-19 op
34 bff58270 2022-09-19 op /* C LALR(1) parser skeleton written by Richard Stallman, by
35 bff58270 2022-09-19 op simplifying the original so-called "semantic" parser. */
36 bff58270 2022-09-19 op
37 bff58270 2022-09-19 op /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 bff58270 2022-09-19 op especially those whose name start with YY_ or yy_. They are
39 bff58270 2022-09-19 op private implementation details that can be changed or removed. */
40 bff58270 2022-09-19 op
41 bff58270 2022-09-19 op /* All symbols defined below should begin with yy or YY, to avoid
42 bff58270 2022-09-19 op infringing on user name space. This should be done even for local
43 bff58270 2022-09-19 op variables, as they might otherwise be expanded by user macros.
44 bff58270 2022-09-19 op There are some unavoidable exceptions within include files to
45 bff58270 2022-09-19 op define necessary library symbols; they are noted "INFRINGES ON
46 bff58270 2022-09-19 op USER NAME SPACE" below. */
47 bff58270 2022-09-19 op
48 bff58270 2022-09-19 op /* Identify Bison output, and Bison version. */
49 bff58270 2022-09-19 op #define YYBISON 30706
50 bff58270 2022-09-19 op
51 bff58270 2022-09-19 op /* Bison version string. */
52 bff58270 2022-09-19 op #define YYBISON_VERSION "3.7.6"
53 bff58270 2022-09-19 op
54 bff58270 2022-09-19 op /* Skeleton name. */
55 bff58270 2022-09-19 op #define YYSKELETON_NAME "yacc.c"
56 bff58270 2022-09-19 op
57 bff58270 2022-09-19 op /* Pure parsers. */
58 bff58270 2022-09-19 op #define YYPURE 0
59 bff58270 2022-09-19 op
60 bff58270 2022-09-19 op /* Push parsers. */
61 bff58270 2022-09-19 op #define YYPUSH 0
62 bff58270 2022-09-19 op
63 bff58270 2022-09-19 op /* Pull parsers. */
64 bff58270 2022-09-19 op #define YYPULL 1
65 bff58270 2022-09-19 op
66 bff58270 2022-09-19 op
67 bff58270 2022-09-19 op
68 bff58270 2022-09-19 op
69 bff58270 2022-09-19 op /* First part of user prologue. */
70 bff58270 2022-09-19 op #line 24 "parse.y"
71 bff58270 2022-09-19 op
72 bff58270 2022-09-19 op
73 bff58270 2022-09-19 op #include <sys/queue.h>
74 bff58270 2022-09-19 op
75 bff58270 2022-09-19 op #include <ctype.h>
76 bff58270 2022-09-19 op #include <err.h>
77 bff58270 2022-09-19 op #include <stdio.h>
78 bff58270 2022-09-19 op #include <stdlib.h>
79 bff58270 2022-09-19 op #include <stdarg.h>
80 bff58270 2022-09-19 op #include <stdint.h>
81 bff58270 2022-09-19 op #include <string.h>
82 bff58270 2022-09-19 op #include <unistd.h>
83 bff58270 2022-09-19 op
84 bff58270 2022-09-19 op #ifndef nitems
85 bff58270 2022-09-19 op #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
86 bff58270 2022-09-19 op #endif
87 bff58270 2022-09-19 op
88 bff58270 2022-09-19 op TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files);
89 bff58270 2022-09-19 op static struct file {
90 bff58270 2022-09-19 op TAILQ_ENTRY(file) entry;
91 bff58270 2022-09-19 op FILE *stream;
92 bff58270 2022-09-19 op char *name;
93 bff58270 2022-09-19 op size_t ungetpos;
94 bff58270 2022-09-19 op size_t ungetsize;
95 bff58270 2022-09-19 op u_char *ungetbuf;
96 bff58270 2022-09-19 op int eof_reached;
97 bff58270 2022-09-19 op int lineno;
98 bff58270 2022-09-19 op int errors;
99 bff58270 2022-09-19 op } *file, *topfile;
100 bff58270 2022-09-19 op int parse(const char *);
101 bff58270 2022-09-19 op struct file *pushfile(const char *, int);
102 bff58270 2022-09-19 op int popfile(void);
103 bff58270 2022-09-19 op int yyparse(void);
104 bff58270 2022-09-19 op int yylex(void);
105 bff58270 2022-09-19 op int yyerror(const char *, ...)
106 bff58270 2022-09-19 op __attribute__((__format__ (printf, 1, 2)))
107 bff58270 2022-09-19 op __attribute__((__nonnull__ (1)));
108 bff58270 2022-09-19 op int kw_cmp(const void *, const void *);
109 bff58270 2022-09-19 op int lookup(char *);
110 bff58270 2022-09-19 op int igetc(void);
111 bff58270 2022-09-19 op int lgetc(int);
112 bff58270 2022-09-19 op void lungetc(int);
113 bff58270 2022-09-19 op int findeol(void);
114 bff58270 2022-09-19 op
115 bff58270 2022-09-19 op void dbg(void);
116 bff58270 2022-09-19 op void printq(const char *);
117 bff58270 2022-09-19 op
118 bff58270 2022-09-19 op extern int nodebug;
119 bff58270 2022-09-19 op
120 bff58270 2022-09-19 op static int block;
121 bff58270 2022-09-19 op static int in_define;
122 bff58270 2022-09-19 op static int errors;
123 bff58270 2022-09-19 op static char lerr[32];
124 bff58270 2022-09-19 op
125 bff58270 2022-09-19 op typedef struct {
126 bff58270 2022-09-19 op union {
127 bff58270 2022-09-19 op char *string;
128 bff58270 2022-09-19 op } v;
129 bff58270 2022-09-19 op int lineno;
130 bff58270 2022-09-19 op } YYSTYPE;
131 bff58270 2022-09-19 op
132 bff58270 2022-09-19 op
133 bff58270 2022-09-19 op #line 134 "y.tab.c"
134 bff58270 2022-09-19 op
135 bff58270 2022-09-19 op # ifndef YY_CAST
136 bff58270 2022-09-19 op # ifdef __cplusplus
137 bff58270 2022-09-19 op # define YY_CAST(Type, Val) static_cast<Type> (Val)
138 bff58270 2022-09-19 op # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
139 bff58270 2022-09-19 op # else
140 bff58270 2022-09-19 op # define YY_CAST(Type, Val) ((Type) (Val))
141 bff58270 2022-09-19 op # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
142 bff58270 2022-09-19 op # endif
143 bff58270 2022-09-19 op # endif
144 bff58270 2022-09-19 op # ifndef YY_NULLPTR
145 bff58270 2022-09-19 op # if defined __cplusplus
146 bff58270 2022-09-19 op # if 201103L <= __cplusplus
147 bff58270 2022-09-19 op # define YY_NULLPTR nullptr
148 bff58270 2022-09-19 op # else
149 bff58270 2022-09-19 op # define YY_NULLPTR 0
150 bff58270 2022-09-19 op # endif
151 bff58270 2022-09-19 op # else
152 bff58270 2022-09-19 op # define YY_NULLPTR ((void*)0)
153 bff58270 2022-09-19 op # endif
154 bff58270 2022-09-19 op # endif
155 bff58270 2022-09-19 op
156 bff58270 2022-09-19 op
157 bff58270 2022-09-19 op /* Debug traces. */
158 bff58270 2022-09-19 op #ifndef YYDEBUG
159 bff58270 2022-09-19 op # define YYDEBUG 0
160 bff58270 2022-09-19 op #endif
161 bff58270 2022-09-19 op #if YYDEBUG
162 bff58270 2022-09-19 op extern int yydebug;
163 bff58270 2022-09-19 op #endif
164 bff58270 2022-09-19 op
165 bff58270 2022-09-19 op /* Token kinds. */
166 bff58270 2022-09-19 op #ifndef YYTOKENTYPE
167 bff58270 2022-09-19 op # define YYTOKENTYPE
168 bff58270 2022-09-19 op enum yytokentype
169 bff58270 2022-09-19 op {
170 bff58270 2022-09-19 op YYEMPTY = -2,
171 bff58270 2022-09-19 op YYEOF = 0, /* "end of file" */
172 bff58270 2022-09-19 op YYerror = 256, /* error */
173 bff58270 2022-09-19 op YYUNDEF = 257, /* "invalid token" */
174 bff58270 2022-09-19 op DEFINE = 258, /* DEFINE */
175 bff58270 2022-09-19 op ELSE = 259, /* ELSE */
176 bff58270 2022-09-19 op END = 260, /* END */
177 bff58270 2022-09-19 op ERROR = 261, /* ERROR */
178 bff58270 2022-09-19 op FINALLY = 262, /* FINALLY */
179 bff58270 2022-09-19 op IF = 263, /* IF */
180 bff58270 2022-09-19 op INCLUDE = 264, /* INCLUDE */
181 bff58270 2022-09-19 op RENDER = 265, /* RENDER */
182 bff58270 2022-09-19 op TQFOREACH = 266, /* TQFOREACH */
183 bff58270 2022-09-19 op STRING = 267 /* STRING */
184 bff58270 2022-09-19 op };
185 bff58270 2022-09-19 op typedef enum yytokentype yytoken_kind_t;
186 bff58270 2022-09-19 op #endif
187 bff58270 2022-09-19 op /* Token kinds. */
188 bff58270 2022-09-19 op #define YYEMPTY -2
189 bff58270 2022-09-19 op #define YYEOF 0
190 bff58270 2022-09-19 op #define YYerror 256
191 bff58270 2022-09-19 op #define YYUNDEF 257
192 bff58270 2022-09-19 op #define DEFINE 258
193 bff58270 2022-09-19 op #define ELSE 259
194 bff58270 2022-09-19 op #define END 260
195 bff58270 2022-09-19 op #define ERROR 261
196 bff58270 2022-09-19 op #define FINALLY 262
197 bff58270 2022-09-19 op #define IF 263
198 bff58270 2022-09-19 op #define INCLUDE 264
199 bff58270 2022-09-19 op #define RENDER 265
200 bff58270 2022-09-19 op #define TQFOREACH 266
201 bff58270 2022-09-19 op #define STRING 267
202 bff58270 2022-09-19 op
203 bff58270 2022-09-19 op /* Value type. */
204 bff58270 2022-09-19 op
205 bff58270 2022-09-19 op
206 bff58270 2022-09-19 op extern YYSTYPE yylval;
207 bff58270 2022-09-19 op
208 bff58270 2022-09-19 op int yyparse (void);
209 bff58270 2022-09-19 op
210 bff58270 2022-09-19 op
211 bff58270 2022-09-19 op /* Symbol kind. */
212 bff58270 2022-09-19 op enum yysymbol_kind_t
213 bff58270 2022-09-19 op {
214 bff58270 2022-09-19 op YYSYMBOL_YYEMPTY = -2,
215 bff58270 2022-09-19 op YYSYMBOL_YYEOF = 0, /* "end of file" */
216 bff58270 2022-09-19 op YYSYMBOL_YYerror = 1, /* error */
217 bff58270 2022-09-19 op YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
218 bff58270 2022-09-19 op YYSYMBOL_DEFINE = 3, /* DEFINE */
219 bff58270 2022-09-19 op YYSYMBOL_ELSE = 4, /* ELSE */
220 bff58270 2022-09-19 op YYSYMBOL_END = 5, /* END */
221 bff58270 2022-09-19 op YYSYMBOL_ERROR = 6, /* ERROR */
222 bff58270 2022-09-19 op YYSYMBOL_FINALLY = 7, /* FINALLY */
223 bff58270 2022-09-19 op YYSYMBOL_IF = 8, /* IF */
224 bff58270 2022-09-19 op YYSYMBOL_INCLUDE = 9, /* INCLUDE */
225 bff58270 2022-09-19 op YYSYMBOL_RENDER = 10, /* RENDER */
226 bff58270 2022-09-19 op YYSYMBOL_TQFOREACH = 11, /* TQFOREACH */
227 bff58270 2022-09-19 op YYSYMBOL_STRING = 12, /* STRING */
228 bff58270 2022-09-19 op YYSYMBOL_13_ = 13, /* '!' */
229 bff58270 2022-09-19 op YYSYMBOL_14_ = 14, /* '{' */
230 bff58270 2022-09-19 op YYSYMBOL_15_ = 15, /* '}' */
231 bff58270 2022-09-19 op YYSYMBOL_YYACCEPT = 16, /* $accept */
232 bff58270 2022-09-19 op YYSYMBOL_grammar = 17, /* grammar */
233 bff58270 2022-09-19 op YYSYMBOL_include = 18, /* include */
234 bff58270 2022-09-19 op YYSYMBOL_verbatim = 19, /* verbatim */
235 bff58270 2022-09-19 op YYSYMBOL_verbatim1 = 20, /* verbatim1 */
236 bff58270 2022-09-19 op YYSYMBOL_verbatims = 21, /* verbatims */
237 bff58270 2022-09-19 op YYSYMBOL_raw = 22, /* raw */
238 bff58270 2022-09-19 op YYSYMBOL_block = 23, /* block */
239 bff58270 2022-09-19 op YYSYMBOL_define = 24, /* define */
240 bff58270 2022-09-19 op YYSYMBOL_body = 25, /* body */
241 bff58270 2022-09-19 op YYSYMBOL_special = 26, /* special */
242 bff58270 2022-09-19 op YYSYMBOL_if = 27, /* if */
243 bff58270 2022-09-19 op YYSYMBOL_endif = 28, /* endif */
244 bff58270 2022-09-19 op YYSYMBOL_elsif = 29, /* elsif */
245 bff58270 2022-09-19 op YYSYMBOL_else = 30, /* else */
246 bff58270 2022-09-19 op YYSYMBOL_loop = 31, /* loop */
247 bff58270 2022-09-19 op YYSYMBOL_32_1 = 32, /* $@1 */
248 bff58270 2022-09-19 op YYSYMBOL_end = 33, /* end */
249 bff58270 2022-09-19 op YYSYMBOL_finally = 34, /* finally */
250 bff58270 2022-09-19 op YYSYMBOL_35_2 = 35, /* $@2 */
251 bff58270 2022-09-19 op YYSYMBOL_string = 36 /* string */
252 bff58270 2022-09-19 op };
253 bff58270 2022-09-19 op typedef enum yysymbol_kind_t yysymbol_kind_t;
254 bff58270 2022-09-19 op
255 bff58270 2022-09-19 op
256 bff58270 2022-09-19 op
257 bff58270 2022-09-19 op
258 bff58270 2022-09-19 op #ifdef short
259 bff58270 2022-09-19 op # undef short
260 bff58270 2022-09-19 op #endif
261 bff58270 2022-09-19 op
262 bff58270 2022-09-19 op /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
263 bff58270 2022-09-19 op <limits.h> and (if available) <stdint.h> are included
264 bff58270 2022-09-19 op so that the code can choose integer types of a good width. */
265 bff58270 2022-09-19 op
266 bff58270 2022-09-19 op #ifndef __PTRDIFF_MAX__
267 bff58270 2022-09-19 op # include <limits.h> /* INFRINGES ON USER NAME SPACE */
268 bff58270 2022-09-19 op # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
269 bff58270 2022-09-19 op # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
270 bff58270 2022-09-19 op # define YY_STDINT_H
271 bff58270 2022-09-19 op # endif
272 bff58270 2022-09-19 op #endif
273 bff58270 2022-09-19 op
274 bff58270 2022-09-19 op /* Narrow types that promote to a signed type and that can represent a
275 bff58270 2022-09-19 op signed or unsigned integer of at least N bits. In tables they can
276 bff58270 2022-09-19 op save space and decrease cache pressure. Promoting to a signed type
277 bff58270 2022-09-19 op helps avoid bugs in integer arithmetic. */
278 bff58270 2022-09-19 op
279 bff58270 2022-09-19 op #ifdef __INT_LEAST8_MAX__
280 bff58270 2022-09-19 op typedef __INT_LEAST8_TYPE__ yytype_int8;
281 bff58270 2022-09-19 op #elif defined YY_STDINT_H
282 bff58270 2022-09-19 op typedef int_least8_t yytype_int8;
283 bff58270 2022-09-19 op #else
284 bff58270 2022-09-19 op typedef signed char yytype_int8;
285 bff58270 2022-09-19 op #endif
286 bff58270 2022-09-19 op
287 bff58270 2022-09-19 op #ifdef __INT_LEAST16_MAX__
288 bff58270 2022-09-19 op typedef __INT_LEAST16_TYPE__ yytype_int16;
289 bff58270 2022-09-19 op #elif defined YY_STDINT_H
290 bff58270 2022-09-19 op typedef int_least16_t yytype_int16;
291 bff58270 2022-09-19 op #else
292 bff58270 2022-09-19 op typedef short yytype_int16;
293 bff58270 2022-09-19 op #endif
294 bff58270 2022-09-19 op
295 bff58270 2022-09-19 op /* Work around bug in HP-UX 11.23, which defines these macros
296 bff58270 2022-09-19 op incorrectly for preprocessor constants. This workaround can likely
297 bff58270 2022-09-19 op be removed in 2023, as HPE has promised support for HP-UX 11.23
298 bff58270 2022-09-19 op (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
299 bff58270 2022-09-19 op <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
300 bff58270 2022-09-19 op #ifdef __hpux
301 bff58270 2022-09-19 op # undef UINT_LEAST8_MAX
302 bff58270 2022-09-19 op # undef UINT_LEAST16_MAX
303 bff58270 2022-09-19 op # define UINT_LEAST8_MAX 255
304 bff58270 2022-09-19 op # define UINT_LEAST16_MAX 65535
305 bff58270 2022-09-19 op #endif
306 bff58270 2022-09-19 op
307 bff58270 2022-09-19 op #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
308 bff58270 2022-09-19 op typedef __UINT_LEAST8_TYPE__ yytype_uint8;
309 bff58270 2022-09-19 op #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
310 bff58270 2022-09-19 op && UINT_LEAST8_MAX <= INT_MAX)
311 bff58270 2022-09-19 op typedef uint_least8_t yytype_uint8;
312 bff58270 2022-09-19 op #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
313 bff58270 2022-09-19 op typedef unsigned char yytype_uint8;
314 bff58270 2022-09-19 op #else
315 bff58270 2022-09-19 op typedef short yytype_uint8;
316 bff58270 2022-09-19 op #endif
317 bff58270 2022-09-19 op
318 bff58270 2022-09-19 op #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
319 bff58270 2022-09-19 op typedef __UINT_LEAST16_TYPE__ yytype_uint16;
320 bff58270 2022-09-19 op #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
321 bff58270 2022-09-19 op && UINT_LEAST16_MAX <= INT_MAX)
322 bff58270 2022-09-19 op typedef uint_least16_t yytype_uint16;
323 bff58270 2022-09-19 op #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
324 bff58270 2022-09-19 op typedef unsigned short yytype_uint16;
325 bff58270 2022-09-19 op #else
326 bff58270 2022-09-19 op typedef int yytype_uint16;
327 bff58270 2022-09-19 op #endif
328 bff58270 2022-09-19 op
329 bff58270 2022-09-19 op #ifndef YYPTRDIFF_T
330 bff58270 2022-09-19 op # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
331 bff58270 2022-09-19 op # define YYPTRDIFF_T __PTRDIFF_TYPE__
332 bff58270 2022-09-19 op # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
333 bff58270 2022-09-19 op # elif defined PTRDIFF_MAX
334 bff58270 2022-09-19 op # ifndef ptrdiff_t
335 bff58270 2022-09-19 op # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
336 bff58270 2022-09-19 op # endif
337 bff58270 2022-09-19 op # define YYPTRDIFF_T ptrdiff_t
338 bff58270 2022-09-19 op # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
339 bff58270 2022-09-19 op # else
340 bff58270 2022-09-19 op # define YYPTRDIFF_T long
341 bff58270 2022-09-19 op # define YYPTRDIFF_MAXIMUM LONG_MAX
342 bff58270 2022-09-19 op # endif
343 bff58270 2022-09-19 op #endif
344 bff58270 2022-09-19 op
345 bff58270 2022-09-19 op #ifndef YYSIZE_T
346 bff58270 2022-09-19 op # ifdef __SIZE_TYPE__
347 bff58270 2022-09-19 op # define YYSIZE_T __SIZE_TYPE__
348 bff58270 2022-09-19 op # elif defined size_t
349 bff58270 2022-09-19 op # define YYSIZE_T size_t
350 bff58270 2022-09-19 op # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
351 bff58270 2022-09-19 op # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
352 bff58270 2022-09-19 op # define YYSIZE_T size_t
353 bff58270 2022-09-19 op # else
354 bff58270 2022-09-19 op # define YYSIZE_T unsigned
355 bff58270 2022-09-19 op # endif
356 bff58270 2022-09-19 op #endif
357 bff58270 2022-09-19 op
358 bff58270 2022-09-19 op #define YYSIZE_MAXIMUM \
359 bff58270 2022-09-19 op YY_CAST (YYPTRDIFF_T, \
360 bff58270 2022-09-19 op (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
361 bff58270 2022-09-19 op ? YYPTRDIFF_MAXIMUM \
362 bff58270 2022-09-19 op : YY_CAST (YYSIZE_T, -1)))
363 bff58270 2022-09-19 op
364 bff58270 2022-09-19 op #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
365 bff58270 2022-09-19 op
366 bff58270 2022-09-19 op
367 bff58270 2022-09-19 op /* Stored state numbers (used for stacks). */
368 bff58270 2022-09-19 op typedef yytype_int8 yy_state_t;
369 bff58270 2022-09-19 op
370 bff58270 2022-09-19 op /* State numbers in computations. */
371 bff58270 2022-09-19 op typedef int yy_state_fast_t;
372 bff58270 2022-09-19 op
373 bff58270 2022-09-19 op #ifndef YY_
374 bff58270 2022-09-19 op # if defined YYENABLE_NLS && YYENABLE_NLS
375 bff58270 2022-09-19 op # if ENABLE_NLS
376 bff58270 2022-09-19 op # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
377 bff58270 2022-09-19 op # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
378 bff58270 2022-09-19 op # endif
379 bff58270 2022-09-19 op # endif
380 bff58270 2022-09-19 op # ifndef YY_
381 bff58270 2022-09-19 op # define YY_(Msgid) Msgid
382 bff58270 2022-09-19 op # endif
383 bff58270 2022-09-19 op #endif
384 bff58270 2022-09-19 op
385 bff58270 2022-09-19 op
386 bff58270 2022-09-19 op #ifndef YY_ATTRIBUTE_PURE
387 bff58270 2022-09-19 op # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
388 bff58270 2022-09-19 op # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
389 bff58270 2022-09-19 op # else
390 bff58270 2022-09-19 op # define YY_ATTRIBUTE_PURE
391 bff58270 2022-09-19 op # endif
392 bff58270 2022-09-19 op #endif
393 bff58270 2022-09-19 op
394 bff58270 2022-09-19 op #ifndef YY_ATTRIBUTE_UNUSED
395 bff58270 2022-09-19 op # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
396 bff58270 2022-09-19 op # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
397 bff58270 2022-09-19 op # else
398 bff58270 2022-09-19 op # define YY_ATTRIBUTE_UNUSED
399 bff58270 2022-09-19 op # endif
400 bff58270 2022-09-19 op #endif
401 bff58270 2022-09-19 op
402 bff58270 2022-09-19 op /* Suppress unused-variable warnings by "using" E. */
403 bff58270 2022-09-19 op #if ! defined lint || defined __GNUC__
404 bff58270 2022-09-19 op # define YY_USE(E) ((void) (E))
405 bff58270 2022-09-19 op #else
406 bff58270 2022-09-19 op # define YY_USE(E) /* empty */
407 bff58270 2022-09-19 op #endif
408 bff58270 2022-09-19 op
409 bff58270 2022-09-19 op #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
410 bff58270 2022-09-19 op /* Suppress an incorrect diagnostic about yylval being uninitialized. */
411 bff58270 2022-09-19 op # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
412 bff58270 2022-09-19 op _Pragma ("GCC diagnostic push") \
413 bff58270 2022-09-19 op _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
414 bff58270 2022-09-19 op _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
415 bff58270 2022-09-19 op # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
416 bff58270 2022-09-19 op _Pragma ("GCC diagnostic pop")
417 bff58270 2022-09-19 op #else
418 bff58270 2022-09-19 op # define YY_INITIAL_VALUE(Value) Value
419 bff58270 2022-09-19 op #endif
420 bff58270 2022-09-19 op #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
421 bff58270 2022-09-19 op # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
422 bff58270 2022-09-19 op # define YY_IGNORE_MAYBE_UNINITIALIZED_END
423 bff58270 2022-09-19 op #endif
424 bff58270 2022-09-19 op #ifndef YY_INITIAL_VALUE
425 bff58270 2022-09-19 op # define YY_INITIAL_VALUE(Value) /* Nothing. */
426 bff58270 2022-09-19 op #endif
427 bff58270 2022-09-19 op
428 bff58270 2022-09-19 op #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
429 bff58270 2022-09-19 op # define YY_IGNORE_USELESS_CAST_BEGIN \
430 bff58270 2022-09-19 op _Pragma ("GCC diagnostic push") \
431 bff58270 2022-09-19 op _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
432 bff58270 2022-09-19 op # define YY_IGNORE_USELESS_CAST_END \
433 bff58270 2022-09-19 op _Pragma ("GCC diagnostic pop")
434 bff58270 2022-09-19 op #endif
435 bff58270 2022-09-19 op #ifndef YY_IGNORE_USELESS_CAST_BEGIN
436 bff58270 2022-09-19 op # define YY_IGNORE_USELESS_CAST_BEGIN
437 bff58270 2022-09-19 op # define YY_IGNORE_USELESS_CAST_END
438 bff58270 2022-09-19 op #endif
439 bff58270 2022-09-19 op
440 bff58270 2022-09-19 op
441 bff58270 2022-09-19 op #define YY_ASSERT(E) ((void) (0 && (E)))
442 bff58270 2022-09-19 op
443 bff58270 2022-09-19 op #if !defined yyoverflow
444 bff58270 2022-09-19 op
445 bff58270 2022-09-19 op /* The parser invokes alloca or malloc; define the necessary symbols. */
446 bff58270 2022-09-19 op
447 bff58270 2022-09-19 op # ifdef YYSTACK_USE_ALLOCA
448 bff58270 2022-09-19 op # if YYSTACK_USE_ALLOCA
449 bff58270 2022-09-19 op # ifdef __GNUC__
450 bff58270 2022-09-19 op # define YYSTACK_ALLOC __builtin_alloca
451 bff58270 2022-09-19 op # elif defined __BUILTIN_VA_ARG_INCR
452 bff58270 2022-09-19 op # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
453 bff58270 2022-09-19 op # elif defined _AIX
454 bff58270 2022-09-19 op # define YYSTACK_ALLOC __alloca
455 bff58270 2022-09-19 op # elif defined _MSC_VER
456 bff58270 2022-09-19 op # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
457 bff58270 2022-09-19 op # define alloca _alloca
458 bff58270 2022-09-19 op # else
459 bff58270 2022-09-19 op # define YYSTACK_ALLOC alloca
460 bff58270 2022-09-19 op # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
461 bff58270 2022-09-19 op # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
462 bff58270 2022-09-19 op /* Use EXIT_SUCCESS as a witness for stdlib.h. */
463 bff58270 2022-09-19 op # ifndef EXIT_SUCCESS
464 bff58270 2022-09-19 op # define EXIT_SUCCESS 0
465 bff58270 2022-09-19 op # endif
466 bff58270 2022-09-19 op # endif
467 bff58270 2022-09-19 op # endif
468 bff58270 2022-09-19 op # endif
469 bff58270 2022-09-19 op # endif
470 bff58270 2022-09-19 op
471 bff58270 2022-09-19 op # ifdef YYSTACK_ALLOC
472 bff58270 2022-09-19 op /* Pacify GCC's 'empty if-body' warning. */
473 bff58270 2022-09-19 op # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
474 bff58270 2022-09-19 op # ifndef YYSTACK_ALLOC_MAXIMUM
475 bff58270 2022-09-19 op /* The OS might guarantee only one guard page at the bottom of the stack,
476 bff58270 2022-09-19 op and a page size can be as small as 4096 bytes. So we cannot safely
477 bff58270 2022-09-19 op invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
478 bff58270 2022-09-19 op to allow for a few compiler-allocated temporary stack slots. */
479 bff58270 2022-09-19 op # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
480 bff58270 2022-09-19 op # endif
481 bff58270 2022-09-19 op # else
482 bff58270 2022-09-19 op # define YYSTACK_ALLOC YYMALLOC
483 bff58270 2022-09-19 op # define YYSTACK_FREE YYFREE
484 bff58270 2022-09-19 op # ifndef YYSTACK_ALLOC_MAXIMUM
485 bff58270 2022-09-19 op # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
486 bff58270 2022-09-19 op # endif
487 bff58270 2022-09-19 op # if (defined __cplusplus && ! defined EXIT_SUCCESS \
488 bff58270 2022-09-19 op && ! ((defined YYMALLOC || defined malloc) \
489 bff58270 2022-09-19 op && (defined YYFREE || defined free)))
490 bff58270 2022-09-19 op # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
491 bff58270 2022-09-19 op # ifndef EXIT_SUCCESS
492 bff58270 2022-09-19 op # define EXIT_SUCCESS 0
493 bff58270 2022-09-19 op # endif
494 bff58270 2022-09-19 op # endif
495 bff58270 2022-09-19 op # ifndef YYMALLOC
496 bff58270 2022-09-19 op # define YYMALLOC malloc
497 bff58270 2022-09-19 op # if ! defined malloc && ! defined EXIT_SUCCESS
498 bff58270 2022-09-19 op void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
499 bff58270 2022-09-19 op # endif
500 bff58270 2022-09-19 op # endif
501 bff58270 2022-09-19 op # ifndef YYFREE
502 bff58270 2022-09-19 op # define YYFREE free
503 bff58270 2022-09-19 op # if ! defined free && ! defined EXIT_SUCCESS
504 bff58270 2022-09-19 op void free (void *); /* INFRINGES ON USER NAME SPACE */
505 bff58270 2022-09-19 op # endif
506 bff58270 2022-09-19 op # endif
507 bff58270 2022-09-19 op # endif
508 bff58270 2022-09-19 op #endif /* !defined yyoverflow */
509 bff58270 2022-09-19 op
510 bff58270 2022-09-19 op #if (! defined yyoverflow \
511 bff58270 2022-09-19 op && (! defined __cplusplus \
512 bff58270 2022-09-19 op || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
513 bff58270 2022-09-19 op
514 bff58270 2022-09-19 op /* A type that is properly aligned for any stack member. */
515 bff58270 2022-09-19 op union yyalloc
516 bff58270 2022-09-19 op {
517 bff58270 2022-09-19 op yy_state_t yyss_alloc;
518 bff58270 2022-09-19 op YYSTYPE yyvs_alloc;
519 bff58270 2022-09-19 op };
520 bff58270 2022-09-19 op
521 bff58270 2022-09-19 op /* The size of the maximum gap between one aligned stack and the next. */
522 bff58270 2022-09-19 op # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
523 bff58270 2022-09-19 op
524 bff58270 2022-09-19 op /* The size of an array large to enough to hold all stacks, each with
525 bff58270 2022-09-19 op N elements. */
526 bff58270 2022-09-19 op # define YYSTACK_BYTES(N) \
527 bff58270 2022-09-19 op ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
528 bff58270 2022-09-19 op + YYSTACK_GAP_MAXIMUM)
529 bff58270 2022-09-19 op
530 bff58270 2022-09-19 op # define YYCOPY_NEEDED 1
531 bff58270 2022-09-19 op
532 bff58270 2022-09-19 op /* Relocate STACK from its old location to the new one. The
533 bff58270 2022-09-19 op local variables YYSIZE and YYSTACKSIZE give the old and new number of
534 bff58270 2022-09-19 op elements in the stack, and YYPTR gives the new location of the
535 bff58270 2022-09-19 op stack. Advance YYPTR to a properly aligned location for the next
536 bff58270 2022-09-19 op stack. */
537 bff58270 2022-09-19 op # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
538 bff58270 2022-09-19 op do \
539 bff58270 2022-09-19 op { \
540 bff58270 2022-09-19 op YYPTRDIFF_T yynewbytes; \
541 bff58270 2022-09-19 op YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
542 bff58270 2022-09-19 op Stack = &yyptr->Stack_alloc; \
543 bff58270 2022-09-19 op yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
544 bff58270 2022-09-19 op yyptr += yynewbytes / YYSIZEOF (*yyptr); \
545 bff58270 2022-09-19 op } \
546 bff58270 2022-09-19 op while (0)
547 bff58270 2022-09-19 op
548 bff58270 2022-09-19 op #endif
549 bff58270 2022-09-19 op
550 bff58270 2022-09-19 op #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
551 bff58270 2022-09-19 op /* Copy COUNT objects from SRC to DST. The source and destination do
552 bff58270 2022-09-19 op not overlap. */
553 bff58270 2022-09-19 op # ifndef YYCOPY
554 bff58270 2022-09-19 op # if defined __GNUC__ && 1 < __GNUC__
555 bff58270 2022-09-19 op # define YYCOPY(Dst, Src, Count) \
556 bff58270 2022-09-19 op __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
557 bff58270 2022-09-19 op # else
558 bff58270 2022-09-19 op # define YYCOPY(Dst, Src, Count) \
559 bff58270 2022-09-19 op do \
560 bff58270 2022-09-19 op { \
561 bff58270 2022-09-19 op YYPTRDIFF_T yyi; \
562 bff58270 2022-09-19 op for (yyi = 0; yyi < (Count); yyi++) \
563 bff58270 2022-09-19 op (Dst)[yyi] = (Src)[yyi]; \
564 bff58270 2022-09-19 op } \
565 bff58270 2022-09-19 op while (0)
566 bff58270 2022-09-19 op # endif
567 bff58270 2022-09-19 op # endif
568 bff58270 2022-09-19 op #endif /* !YYCOPY_NEEDED */
569 bff58270 2022-09-19 op
570 bff58270 2022-09-19 op /* YYFINAL -- State number of the termination state. */
571 bff58270 2022-09-19 op #define YYFINAL 2
572 bff58270 2022-09-19 op /* YYLAST -- Last index in YYTABLE. */
573 bff58270 2022-09-19 op #define YYLAST 69
574 bff58270 2022-09-19 op
575 bff58270 2022-09-19 op /* YYNTOKENS -- Number of terminals. */
576 bff58270 2022-09-19 op #define YYNTOKENS 16
577 bff58270 2022-09-19 op /* YYNNTS -- Number of nonterminals. */
578 bff58270 2022-09-19 op #define YYNNTS 21
579 bff58270 2022-09-19 op /* YYNRULES -- Number of rules. */
580 bff58270 2022-09-19 op #define YYNRULES 37
581 bff58270 2022-09-19 op /* YYNSTATES -- Number of states. */
582 bff58270 2022-09-19 op #define YYNSTATES 71
583 bff58270 2022-09-19 op
584 bff58270 2022-09-19 op /* YYMAXUTOK -- Last valid token kind. */
585 bff58270 2022-09-19 op #define YYMAXUTOK 267
586 bff58270 2022-09-19 op
587 bff58270 2022-09-19 op
588 bff58270 2022-09-19 op /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
589 bff58270 2022-09-19 op as returned by yylex, with out-of-bounds checking. */
590 bff58270 2022-09-19 op #define YYTRANSLATE(YYX) \
591 bff58270 2022-09-19 op (0 <= (YYX) && (YYX) <= YYMAXUTOK \
592 bff58270 2022-09-19 op ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
593 bff58270 2022-09-19 op : YYSYMBOL_YYUNDEF)
594 bff58270 2022-09-19 op
595 bff58270 2022-09-19 op /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
596 bff58270 2022-09-19 op as returned by yylex. */
597 bff58270 2022-09-19 op static const yytype_int8 yytranslate[] =
598 bff58270 2022-09-19 op {
599 bff58270 2022-09-19 op 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
602 bff58270 2022-09-19 op 2, 2, 2, 13, 2, 2, 2, 2, 2, 2,
603 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
604 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
605 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
606 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
607 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
608 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
609 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
610 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
611 bff58270 2022-09-19 op 2, 2, 2, 14, 2, 15, 2, 2, 2, 2,
612 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
613 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
614 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
615 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
616 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
617 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
618 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
621 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
622 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
624 bff58270 2022-09-19 op 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
625 bff58270 2022-09-19 op 5, 6, 7, 8, 9, 10, 11, 12
626 bff58270 2022-09-19 op };
627 bff58270 2022-09-19 op
628 bff58270 2022-09-19 op #if YYDEBUG
629 bff58270 2022-09-19 op /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
630 bff58270 2022-09-19 op static const yytype_uint8 yyrline[] =
631 bff58270 2022-09-19 op {
632 bff58270 2022-09-19 op 0, 93, 93, 94, 95, 96, 97, 100, 115, 122,
633 bff58270 2022-09-19 op 123, 132, 133, 136, 146, 152, 159, 171, 172, 173,
634 bff58270 2022-09-19 op 174, 177, 187, 188, 189, 196, 203, 204, 205, 208,
635 bff58270 2022-09-19 op 215, 221, 221, 232, 235, 235, 241, 247
636 bff58270 2022-09-19 op };
637 bff58270 2022-09-19 op #endif
638 bff58270 2022-09-19 op
639 bff58270 2022-09-19 op /** Accessing symbol of state STATE. */
640 bff58270 2022-09-19 op #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
641 bff58270 2022-09-19 op
642 bff58270 2022-09-19 op #if YYDEBUG || 0
643 bff58270 2022-09-19 op /* The user-facing name of the symbol whose (internal) number is
644 bff58270 2022-09-19 op YYSYMBOL. No bounds checking. */
645 bff58270 2022-09-19 op static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
646 bff58270 2022-09-19 op
647 bff58270 2022-09-19 op /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
648 bff58270 2022-09-19 op First, the terminals, then, starting at YYNTOKENS, nonterminals. */
649 bff58270 2022-09-19 op static const char *const yytname[] =
650 bff58270 2022-09-19 op {
651 bff58270 2022-09-19 op "\"end of file\"", "error", "\"invalid token\"", "DEFINE", "ELSE",
652 bff58270 2022-09-19 op "END", "ERROR", "FINALLY", "IF", "INCLUDE", "RENDER", "TQFOREACH",
653 bff58270 2022-09-19 op "STRING", "'!'", "'{'", "'}'", "$accept", "grammar", "include",
654 bff58270 2022-09-19 op "verbatim", "verbatim1", "verbatims", "raw", "block", "define", "body",
655 bff58270 2022-09-19 op "special", "if", "endif", "elsif", "else", "loop", "$@1", "end",
656 bff58270 2022-09-19 op "finally", "$@2", "string", YY_NULLPTR
657 bff58270 2022-09-19 op };
658 bff58270 2022-09-19 op
659 bff58270 2022-09-19 op static const char *
660 bff58270 2022-09-19 op yysymbol_name (yysymbol_kind_t yysymbol)
661 bff58270 2022-09-19 op {
662 bff58270 2022-09-19 op return yytname[yysymbol];
663 bff58270 2022-09-19 op }
664 bff58270 2022-09-19 op #endif
665 bff58270 2022-09-19 op
666 bff58270 2022-09-19 op #ifdef YYPRINT
667 bff58270 2022-09-19 op /* YYTOKNUM[NUM] -- (External) token number corresponding to the
668 bff58270 2022-09-19 op (internal) symbol number NUM (which must be that of a token). */
669 bff58270 2022-09-19 op static const yytype_int16 yytoknum[] =
670 bff58270 2022-09-19 op {
671 bff58270 2022-09-19 op 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
672 bff58270 2022-09-19 op 265, 266, 267, 33, 123, 125
673 bff58270 2022-09-19 op };
674 bff58270 2022-09-19 op #endif
675 bff58270 2022-09-19 op
676 bff58270 2022-09-19 op #define YYPACT_NINF (-21)
677 bff58270 2022-09-19 op
678 bff58270 2022-09-19 op #define yypact_value_is_default(Yyn) \
679 bff58270 2022-09-19 op ((Yyn) == YYPACT_NINF)
680 bff58270 2022-09-19 op
681 bff58270 2022-09-19 op #define YYTABLE_NINF (-1)
682 bff58270 2022-09-19 op
683 bff58270 2022-09-19 op #define yytable_value_is_error(Yyn) \
684 bff58270 2022-09-19 op 0
685 bff58270 2022-09-19 op
686 bff58270 2022-09-19 op /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
687 bff58270 2022-09-19 op STATE-NUM. */
688 bff58270 2022-09-19 op static const yytype_int8 yypact[] =
689 bff58270 2022-09-19 op {
690 bff58270 2022-09-19 op -21, 5, -21, -21, 4, -21, 14, -21, -21, -21,
691 bff58270 2022-09-19 op -21, -21, 0, 8, -3, -21, -21, 8, 6, -21,
692 bff58270 2022-09-19 op 29, -21, -21, -21, -21, -21, -21, 10, -21, -21,
693 bff58270 2022-09-19 op 15, 20, 8, 8, 26, 27, 41, 38, -21, -21,
694 bff58270 2022-09-19 op -21, 31, 47, 49, -21, 21, -21, -21, -21, -21,
695 bff58270 2022-09-19 op -21, -21, -21, 51, -7, 41, 46, 52, 53, 8,
696 bff58270 2022-09-19 op -21, -21, 40, -21, -21, -21, 54, -21, -21, 46,
697 bff58270 2022-09-19 op -21
698 bff58270 2022-09-19 op };
699 bff58270 2022-09-19 op
700 bff58270 2022-09-19 op /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
701 bff58270 2022-09-19 op Performed when YYTABLE does not specify something else to do. Zero
702 bff58270 2022-09-19 op means the default is an error. */
703 bff58270 2022-09-19 op static const yytype_int8 yydefact[] =
704 bff58270 2022-09-19 op {
705 bff58270 2022-09-19 op 2, 0, 1, 6, 0, 9, 0, 3, 4, 5,
706 bff58270 2022-09-19 op 17, 7, 0, 0, 0, 10, 8, 37, 0, 13,
707 bff58270 2022-09-19 op 0, 18, 19, 20, 17, 23, 14, 0, 36, 16,
708 bff58270 2022-09-19 op 0, 0, 0, 0, 0, 0, 0, 0, 15, 33,
709 bff58270 2022-09-19 op 34, 0, 0, 0, 24, 0, 22, 17, 17, 26,
710 bff58270 2022-09-19 op 11, 25, 21, 0, 0, 0, 0, 35, 0, 0,
711 bff58270 2022-09-19 op 30, 28, 0, 27, 12, 31, 0, 17, 29, 0,
712 bff58270 2022-09-19 op 32
713 bff58270 2022-09-19 op };
714 bff58270 2022-09-19 op
715 bff58270 2022-09-19 op /* YYPGOTO[NTERM-NUM]. */
716 bff58270 2022-09-19 op static const yytype_int8 yypgoto[] =
717 bff58270 2022-09-19 op {
718 bff58270 2022-09-19 op -21, -21, -21, -1, -21, -21, -21, -21, -21, -20,
719 bff58270 2022-09-19 op -21, -21, 9, -21, -21, -21, -21, -12, -21, -21,
720 bff58270 2022-09-19 op -10
721 bff58270 2022-09-19 op };
722 bff58270 2022-09-19 op
723 bff58270 2022-09-19 op /* YYDEFGOTO[NTERM-NUM]. */
724 bff58270 2022-09-19 op static const yytype_int8 yydefgoto[] =
725 bff58270 2022-09-19 op {
726 bff58270 2022-09-19 op 0, 1, 7, 21, 12, 57, 22, 9, 10, 14,
727 bff58270 2022-09-19 op 23, 24, 46, 47, 48, 25, 67, 49, 27, 50,
728 bff58270 2022-09-19 op 35
729 bff58270 2022-09-19 op };
730 bff58270 2022-09-19 op
731 bff58270 2022-09-19 op /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
732 bff58270 2022-09-19 op positive, shift that token. If negative, reduce the rule whose
733 bff58270 2022-09-19 op number is the opposite. If YYTABLE_NINF, syntax error. */
734 bff58270 2022-09-19 op static const yytype_int8 yytable[] =
735 bff58270 2022-09-19 op {
736 bff58270 2022-09-19 op 8, 59, 26, 18, 36, 2, 3, 28, 60, 19,
737 bff58270 2022-09-19 op 5, 20, 15, 16, 4, 38, 11, 13, 5, 6,
738 bff58270 2022-09-19 op 17, 29, 41, 42, 37, 54, 30, 55, 56, 32,
739 bff58270 2022-09-19 op 39, 33, 34, 17, 30, 40, 31, 32, 43, 33,
740 bff58270 2022-09-19 op 34, 17, 44, 30, 63, 30, 51, 69, 32, 66,
741 bff58270 2022-09-19 op 33, 34, 17, 19, 5, 45, 64, 70, 19, 5,
742 bff58270 2022-09-19 op 62, 53, 52, 58, 61, 5, 0, 0, 65, 68
743 bff58270 2022-09-19 op };
744 bff58270 2022-09-19 op
745 bff58270 2022-09-19 op static const yytype_int8 yycheck[] =
746 bff58270 2022-09-19 op {
747 bff58270 2022-09-19 op 1, 8, 14, 13, 24, 0, 1, 17, 15, 12,
748 bff58270 2022-09-19 op 13, 14, 12, 13, 9, 27, 12, 3, 13, 14,
749 bff58270 2022-09-19 op 12, 15, 32, 33, 14, 4, 5, 47, 48, 8,
750 bff58270 2022-09-19 op 15, 10, 11, 12, 5, 15, 7, 8, 12, 10,
751 bff58270 2022-09-19 op 11, 12, 15, 5, 56, 5, 15, 67, 8, 59,
752 bff58270 2022-09-19 op 10, 11, 12, 12, 13, 14, 57, 69, 12, 13,
753 bff58270 2022-09-19 op 14, 12, 15, 12, 55, 13, -1, -1, 15, 15
754 bff58270 2022-09-19 op };
755 bff58270 2022-09-19 op
756 bff58270 2022-09-19 op /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
757 bff58270 2022-09-19 op symbol of state STATE-NUM. */
758 bff58270 2022-09-19 op static const yytype_int8 yystos[] =
759 bff58270 2022-09-19 op {
760 bff58270 2022-09-19 op 0, 17, 0, 1, 9, 13, 14, 18, 19, 23,
761 bff58270 2022-09-19 op 24, 12, 20, 3, 25, 12, 13, 12, 36, 12,
762 bff58270 2022-09-19 op 14, 19, 22, 26, 27, 31, 33, 34, 36, 15,
763 bff58270 2022-09-19 op 5, 7, 8, 10, 11, 36, 25, 14, 33, 15,
764 bff58270 2022-09-19 op 15, 36, 36, 12, 15, 14, 28, 29, 30, 33,
765 bff58270 2022-09-19 op 35, 15, 15, 12, 4, 25, 25, 21, 12, 8,
766 bff58270 2022-09-19 op 15, 28, 14, 33, 19, 15, 36, 32, 15, 25,
767 bff58270 2022-09-19 op 33
768 bff58270 2022-09-19 op };
769 bff58270 2022-09-19 op
770 bff58270 2022-09-19 op /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
771 bff58270 2022-09-19 op static const yytype_int8 yyr1[] =
772 bff58270 2022-09-19 op {
773 bff58270 2022-09-19 op 0, 16, 17, 17, 17, 17, 17, 18, 19, 20,
774 bff58270 2022-09-19 op 20, 21, 21, 22, 23, 23, 24, 25, 25, 25,
775 bff58270 2022-09-19 op 25, 26, 26, 26, 26, 27, 28, 28, 28, 29,
776 bff58270 2022-09-19 op 30, 32, 31, 33, 35, 34, 36, 36
777 bff58270 2022-09-19 op };
778 bff58270 2022-09-19 op
779 bff58270 2022-09-19 op /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
780 bff58270 2022-09-19 op static const yytype_int8 yyr2[] =
781 bff58270 2022-09-19 op {
782 bff58270 2022-09-19 op 0, 2, 0, 2, 2, 2, 2, 2, 3, 0,
783 bff58270 2022-09-19 op 2, 0, 2, 1, 3, 4, 4, 0, 2, 2,
784 bff58270 2022-09-19 op 2, 4, 3, 1, 3, 4, 1, 3, 3, 5,
785 bff58270 2022-09-19 op 3, 0, 9, 3, 0, 5, 2, 1
786 bff58270 2022-09-19 op };
787 bff58270 2022-09-19 op
788 bff58270 2022-09-19 op
789 bff58270 2022-09-19 op enum { YYENOMEM = -2 };
790 bff58270 2022-09-19 op
791 bff58270 2022-09-19 op #define yyerrok (yyerrstatus = 0)
792 bff58270 2022-09-19 op #define yyclearin (yychar = YYEMPTY)
793 bff58270 2022-09-19 op
794 bff58270 2022-09-19 op #define YYACCEPT goto yyacceptlab
795 bff58270 2022-09-19 op #define YYABORT goto yyabortlab
796 bff58270 2022-09-19 op #define YYERROR goto yyerrorlab
797 bff58270 2022-09-19 op
798 bff58270 2022-09-19 op
799 bff58270 2022-09-19 op #define YYRECOVERING() (!!yyerrstatus)
800 bff58270 2022-09-19 op
801 bff58270 2022-09-19 op #define YYBACKUP(Token, Value) \
802 bff58270 2022-09-19 op do \
803 bff58270 2022-09-19 op if (yychar == YYEMPTY) \
804 bff58270 2022-09-19 op { \
805 bff58270 2022-09-19 op yychar = (Token); \
806 bff58270 2022-09-19 op yylval = (Value); \
807 bff58270 2022-09-19 op YYPOPSTACK (yylen); \
808 bff58270 2022-09-19 op yystate = *yyssp; \
809 bff58270 2022-09-19 op goto yybackup; \
810 bff58270 2022-09-19 op } \
811 bff58270 2022-09-19 op else \
812 bff58270 2022-09-19 op { \
813 bff58270 2022-09-19 op yyerror (YY_("syntax error: cannot back up")); \
814 bff58270 2022-09-19 op YYERROR; \
815 bff58270 2022-09-19 op } \
816 bff58270 2022-09-19 op while (0)
817 bff58270 2022-09-19 op
818 bff58270 2022-09-19 op /* Backward compatibility with an undocumented macro.
819 bff58270 2022-09-19 op Use YYerror or YYUNDEF. */
820 bff58270 2022-09-19 op #define YYERRCODE YYUNDEF
821 bff58270 2022-09-19 op
822 bff58270 2022-09-19 op
823 bff58270 2022-09-19 op /* Enable debugging if requested. */
824 bff58270 2022-09-19 op #if YYDEBUG
825 bff58270 2022-09-19 op
826 bff58270 2022-09-19 op # ifndef YYFPRINTF
827 bff58270 2022-09-19 op # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
828 bff58270 2022-09-19 op # define YYFPRINTF fprintf
829 bff58270 2022-09-19 op # endif
830 bff58270 2022-09-19 op
831 bff58270 2022-09-19 op # define YYDPRINTF(Args) \
832 bff58270 2022-09-19 op do { \
833 bff58270 2022-09-19 op if (yydebug) \
834 bff58270 2022-09-19 op YYFPRINTF Args; \
835 bff58270 2022-09-19 op } while (0)
836 bff58270 2022-09-19 op
837 bff58270 2022-09-19 op /* This macro is provided for backward compatibility. */
838 bff58270 2022-09-19 op # ifndef YY_LOCATION_PRINT
839 bff58270 2022-09-19 op # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
840 bff58270 2022-09-19 op # endif
841 bff58270 2022-09-19 op
842 bff58270 2022-09-19 op
843 bff58270 2022-09-19 op # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
844 bff58270 2022-09-19 op do { \
845 bff58270 2022-09-19 op if (yydebug) \
846 bff58270 2022-09-19 op { \
847 bff58270 2022-09-19 op YYFPRINTF (stderr, "%s ", Title); \
848 bff58270 2022-09-19 op yy_symbol_print (stderr, \
849 bff58270 2022-09-19 op Kind, Value); \
850 bff58270 2022-09-19 op YYFPRINTF (stderr, "\n"); \
851 bff58270 2022-09-19 op } \
852 bff58270 2022-09-19 op } while (0)
853 bff58270 2022-09-19 op
854 bff58270 2022-09-19 op
855 bff58270 2022-09-19 op /*-----------------------------------.
856 bff58270 2022-09-19 op | Print this symbol's value on YYO. |
857 bff58270 2022-09-19 op `-----------------------------------*/
858 bff58270 2022-09-19 op
859 bff58270 2022-09-19 op static void
860 bff58270 2022-09-19 op yy_symbol_value_print (FILE *yyo,
861 bff58270 2022-09-19 op yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
862 bff58270 2022-09-19 op {
863 bff58270 2022-09-19 op FILE *yyoutput = yyo;
864 bff58270 2022-09-19 op YY_USE (yyoutput);
865 bff58270 2022-09-19 op if (!yyvaluep)
866 bff58270 2022-09-19 op return;
867 bff58270 2022-09-19 op # ifdef YYPRINT
868 bff58270 2022-09-19 op if (yykind < YYNTOKENS)
869 bff58270 2022-09-19 op YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
870 bff58270 2022-09-19 op # endif
871 bff58270 2022-09-19 op YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
872 bff58270 2022-09-19 op YY_USE (yykind);
873 bff58270 2022-09-19 op YY_IGNORE_MAYBE_UNINITIALIZED_END
874 bff58270 2022-09-19 op }
875 bff58270 2022-09-19 op
876 bff58270 2022-09-19 op
877 bff58270 2022-09-19 op /*---------------------------.
878 bff58270 2022-09-19 op | Print this symbol on YYO. |
879 bff58270 2022-09-19 op `---------------------------*/
880 bff58270 2022-09-19 op
881 bff58270 2022-09-19 op static void
882 bff58270 2022-09-19 op yy_symbol_print (FILE *yyo,
883 bff58270 2022-09-19 op yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
884 bff58270 2022-09-19 op {
885 bff58270 2022-09-19 op YYFPRINTF (yyo, "%s %s (",
886 bff58270 2022-09-19 op yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
887 bff58270 2022-09-19 op
888 bff58270 2022-09-19 op yy_symbol_value_print (yyo, yykind, yyvaluep);
889 bff58270 2022-09-19 op YYFPRINTF (yyo, ")");
890 bff58270 2022-09-19 op }
891 bff58270 2022-09-19 op
892 bff58270 2022-09-19 op /*------------------------------------------------------------------.
893 bff58270 2022-09-19 op | yy_stack_print -- Print the state stack from its BOTTOM up to its |
894 bff58270 2022-09-19 op | TOP (included). |
895 bff58270 2022-09-19 op `------------------------------------------------------------------*/
896 bff58270 2022-09-19 op
897 bff58270 2022-09-19 op static void
898 bff58270 2022-09-19 op yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
899 bff58270 2022-09-19 op {
900 bff58270 2022-09-19 op YYFPRINTF (stderr, "Stack now");
901 bff58270 2022-09-19 op for (; yybottom <= yytop; yybottom++)
902 bff58270 2022-09-19 op {
903 bff58270 2022-09-19 op int yybot = *yybottom;
904 bff58270 2022-09-19 op YYFPRINTF (stderr, " %d", yybot);
905 bff58270 2022-09-19 op }
906 bff58270 2022-09-19 op YYFPRINTF (stderr, "\n");
907 bff58270 2022-09-19 op }
908 bff58270 2022-09-19 op
909 bff58270 2022-09-19 op # define YY_STACK_PRINT(Bottom, Top) \
910 bff58270 2022-09-19 op do { \
911 bff58270 2022-09-19 op if (yydebug) \
912 bff58270 2022-09-19 op yy_stack_print ((Bottom), (Top)); \
913 bff58270 2022-09-19 op } while (0)
914 bff58270 2022-09-19 op
915 bff58270 2022-09-19 op
916 bff58270 2022-09-19 op /*------------------------------------------------.
917 bff58270 2022-09-19 op | Report that the YYRULE is going to be reduced. |
918 bff58270 2022-09-19 op `------------------------------------------------*/
919 bff58270 2022-09-19 op
920 bff58270 2022-09-19 op static void
921 bff58270 2022-09-19 op yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
922 bff58270 2022-09-19 op int yyrule)
923 bff58270 2022-09-19 op {
924 bff58270 2022-09-19 op int yylno = yyrline[yyrule];
925 bff58270 2022-09-19 op int yynrhs = yyr2[yyrule];
926 bff58270 2022-09-19 op int yyi;
927 bff58270 2022-09-19 op YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
928 bff58270 2022-09-19 op yyrule - 1, yylno);
929 bff58270 2022-09-19 op /* The symbols being reduced. */
930 bff58270 2022-09-19 op for (yyi = 0; yyi < yynrhs; yyi++)
931 bff58270 2022-09-19 op {
932 bff58270 2022-09-19 op YYFPRINTF (stderr, " $%d = ", yyi + 1);
933 bff58270 2022-09-19 op yy_symbol_print (stderr,
934 bff58270 2022-09-19 op YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
935 bff58270 2022-09-19 op &yyvsp[(yyi + 1) - (yynrhs)]);
936 bff58270 2022-09-19 op YYFPRINTF (stderr, "\n");
937 bff58270 2022-09-19 op }
938 bff58270 2022-09-19 op }
939 bff58270 2022-09-19 op
940 bff58270 2022-09-19 op # define YY_REDUCE_PRINT(Rule) \
941 bff58270 2022-09-19 op do { \
942 bff58270 2022-09-19 op if (yydebug) \
943 bff58270 2022-09-19 op yy_reduce_print (yyssp, yyvsp, Rule); \
944 bff58270 2022-09-19 op } while (0)
945 bff58270 2022-09-19 op
946 bff58270 2022-09-19 op /* Nonzero means print parse trace. It is left uninitialized so that
947 bff58270 2022-09-19 op multiple parsers can coexist. */
948 bff58270 2022-09-19 op int yydebug;
949 bff58270 2022-09-19 op #else /* !YYDEBUG */
950 bff58270 2022-09-19 op # define YYDPRINTF(Args) ((void) 0)
951 bff58270 2022-09-19 op # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
952 bff58270 2022-09-19 op # define YY_STACK_PRINT(Bottom, Top)
953 bff58270 2022-09-19 op # define YY_REDUCE_PRINT(Rule)
954 bff58270 2022-09-19 op #endif /* !YYDEBUG */
955 bff58270 2022-09-19 op
956 bff58270 2022-09-19 op
957 bff58270 2022-09-19 op /* YYINITDEPTH -- initial size of the parser's stacks. */
958 bff58270 2022-09-19 op #ifndef YYINITDEPTH
959 bff58270 2022-09-19 op # define YYINITDEPTH 200
960 bff58270 2022-09-19 op #endif
961 bff58270 2022-09-19 op
962 bff58270 2022-09-19 op /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
963 bff58270 2022-09-19 op if the built-in stack extension method is used).
964 bff58270 2022-09-19 op
965 bff58270 2022-09-19 op Do not make this value too large; the results are undefined if
966 bff58270 2022-09-19 op YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
967 bff58270 2022-09-19 op evaluated with infinite-precision integer arithmetic. */
968 bff58270 2022-09-19 op
969 bff58270 2022-09-19 op #ifndef YYMAXDEPTH
970 bff58270 2022-09-19 op # define YYMAXDEPTH 10000
971 bff58270 2022-09-19 op #endif
972 bff58270 2022-09-19 op
973 bff58270 2022-09-19 op
974 bff58270 2022-09-19 op
975 bff58270 2022-09-19 op
976 bff58270 2022-09-19 op
977 bff58270 2022-09-19 op
978 bff58270 2022-09-19 op /*-----------------------------------------------.
979 bff58270 2022-09-19 op | Release the memory associated to this symbol. |
980 bff58270 2022-09-19 op `-----------------------------------------------*/
981 bff58270 2022-09-19 op
982 bff58270 2022-09-19 op static void
983 bff58270 2022-09-19 op yydestruct (const char *yymsg,
984 bff58270 2022-09-19 op yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
985 bff58270 2022-09-19 op {
986 bff58270 2022-09-19 op YY_USE (yyvaluep);
987 bff58270 2022-09-19 op if (!yymsg)
988 bff58270 2022-09-19 op yymsg = "Deleting";
989 bff58270 2022-09-19 op YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
990 bff58270 2022-09-19 op
991 bff58270 2022-09-19 op YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
992 bff58270 2022-09-19 op YY_USE (yykind);
993 bff58270 2022-09-19 op YY_IGNORE_MAYBE_UNINITIALIZED_END
994 bff58270 2022-09-19 op }
995 bff58270 2022-09-19 op
996 bff58270 2022-09-19 op
997 bff58270 2022-09-19 op /* Lookahead token kind. */
998 bff58270 2022-09-19 op int yychar;
999 bff58270 2022-09-19 op
1000 bff58270 2022-09-19 op /* The semantic value of the lookahead symbol. */
1001 bff58270 2022-09-19 op YYSTYPE yylval;
1002 bff58270 2022-09-19 op /* Number of syntax errors so far. */
1003 bff58270 2022-09-19 op int yynerrs;
1004 bff58270 2022-09-19 op
1005 bff58270 2022-09-19 op
1006 bff58270 2022-09-19 op
1007 bff58270 2022-09-19 op
1008 bff58270 2022-09-19 op /*----------.
1009 bff58270 2022-09-19 op | yyparse. |
1010 bff58270 2022-09-19 op `----------*/
1011 bff58270 2022-09-19 op
1012 bff58270 2022-09-19 op int
1013 bff58270 2022-09-19 op yyparse (void)
1014 bff58270 2022-09-19 op {
1015 bff58270 2022-09-19 op yy_state_fast_t yystate = 0;
1016 bff58270 2022-09-19 op /* Number of tokens to shift before error messages enabled. */
1017 bff58270 2022-09-19 op int yyerrstatus = 0;
1018 bff58270 2022-09-19 op
1019 bff58270 2022-09-19 op /* Refer to the stacks through separate pointers, to allow yyoverflow
1020 bff58270 2022-09-19 op to reallocate them elsewhere. */
1021 bff58270 2022-09-19 op
1022 bff58270 2022-09-19 op /* Their size. */
1023 bff58270 2022-09-19 op YYPTRDIFF_T yystacksize = YYINITDEPTH;
1024 bff58270 2022-09-19 op
1025 bff58270 2022-09-19 op /* The state stack: array, bottom, top. */
1026 bff58270 2022-09-19 op yy_state_t yyssa[YYINITDEPTH];
1027 bff58270 2022-09-19 op yy_state_t *yyss = yyssa;
1028 bff58270 2022-09-19 op yy_state_t *yyssp = yyss;
1029 bff58270 2022-09-19 op
1030 bff58270 2022-09-19 op /* The semantic value stack: array, bottom, top. */
1031 bff58270 2022-09-19 op YYSTYPE yyvsa[YYINITDEPTH];
1032 bff58270 2022-09-19 op YYSTYPE *yyvs = yyvsa;
1033 bff58270 2022-09-19 op YYSTYPE *yyvsp = yyvs;
1034 bff58270 2022-09-19 op
1035 bff58270 2022-09-19 op int yyn;
1036 bff58270 2022-09-19 op /* The return value of yyparse. */
1037 bff58270 2022-09-19 op int yyresult;
1038 bff58270 2022-09-19 op /* Lookahead symbol kind. */
1039 bff58270 2022-09-19 op yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1040 bff58270 2022-09-19 op /* The variables used to return semantic value and location from the
1041 bff58270 2022-09-19 op action routines. */
1042 bff58270 2022-09-19 op YYSTYPE yyval;
1043 bff58270 2022-09-19 op
1044 bff58270 2022-09-19 op
1045 bff58270 2022-09-19 op
1046 bff58270 2022-09-19 op #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1047 bff58270 2022-09-19 op
1048 bff58270 2022-09-19 op /* The number of symbols on the RHS of the reduced rule.
1049 bff58270 2022-09-19 op Keep to zero when no symbol should be popped. */
1050 bff58270 2022-09-19 op int yylen = 0;
1051 bff58270 2022-09-19 op
1052 bff58270 2022-09-19 op YYDPRINTF ((stderr, "Starting parse\n"));
1053 bff58270 2022-09-19 op
1054 bff58270 2022-09-19 op yychar = YYEMPTY; /* Cause a token to be read. */
1055 bff58270 2022-09-19 op goto yysetstate;
1056 bff58270 2022-09-19 op
1057 bff58270 2022-09-19 op
1058 bff58270 2022-09-19 op /*------------------------------------------------------------.
1059 bff58270 2022-09-19 op | yynewstate -- push a new state, which is found in yystate. |
1060 bff58270 2022-09-19 op `------------------------------------------------------------*/
1061 bff58270 2022-09-19 op yynewstate:
1062 bff58270 2022-09-19 op /* In all cases, when you get here, the value and location stacks
1063 bff58270 2022-09-19 op have just been pushed. So pushing a state here evens the stacks. */
1064 bff58270 2022-09-19 op yyssp++;
1065 bff58270 2022-09-19 op
1066 bff58270 2022-09-19 op
1067 bff58270 2022-09-19 op /*--------------------------------------------------------------------.
1068 bff58270 2022-09-19 op | yysetstate -- set current state (the top of the stack) to yystate. |
1069 bff58270 2022-09-19 op `--------------------------------------------------------------------*/
1070 bff58270 2022-09-19 op yysetstate:
1071 bff58270 2022-09-19 op YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1072 bff58270 2022-09-19 op YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1073 bff58270 2022-09-19 op YY_IGNORE_USELESS_CAST_BEGIN
1074 bff58270 2022-09-19 op *yyssp = YY_CAST (yy_state_t, yystate);
1075 bff58270 2022-09-19 op YY_IGNORE_USELESS_CAST_END
1076 bff58270 2022-09-19 op YY_STACK_PRINT (yyss, yyssp);
1077 bff58270 2022-09-19 op
1078 bff58270 2022-09-19 op if (yyss + yystacksize - 1 <= yyssp)
1079 bff58270 2022-09-19 op #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1080 bff58270 2022-09-19 op goto yyexhaustedlab;
1081 bff58270 2022-09-19 op #else
1082 bff58270 2022-09-19 op {
1083 bff58270 2022-09-19 op /* Get the current used size of the three stacks, in elements. */
1084 bff58270 2022-09-19 op YYPTRDIFF_T yysize = yyssp - yyss + 1;
1085 bff58270 2022-09-19 op
1086 bff58270 2022-09-19 op # if defined yyoverflow
1087 bff58270 2022-09-19 op {
1088 bff58270 2022-09-19 op /* Give user a chance to reallocate the stack. Use copies of
1089 bff58270 2022-09-19 op these so that the &'s don't force the real ones into
1090 bff58270 2022-09-19 op memory. */
1091 bff58270 2022-09-19 op yy_state_t *yyss1 = yyss;
1092 bff58270 2022-09-19 op YYSTYPE *yyvs1 = yyvs;
1093 bff58270 2022-09-19 op
1094 bff58270 2022-09-19 op /* Each stack pointer address is followed by the size of the
1095 bff58270 2022-09-19 op data in use in that stack, in bytes. This used to be a
1096 bff58270 2022-09-19 op conditional around just the two extra args, but that might
1097 bff58270 2022-09-19 op be undefined if yyoverflow is a macro. */
1098 bff58270 2022-09-19 op yyoverflow (YY_("memory exhausted"),
1099 bff58270 2022-09-19 op &yyss1, yysize * YYSIZEOF (*yyssp),
1100 bff58270 2022-09-19 op &yyvs1, yysize * YYSIZEOF (*yyvsp),
1101 bff58270 2022-09-19 op &yystacksize);
1102 bff58270 2022-09-19 op yyss = yyss1;
1103 bff58270 2022-09-19 op yyvs = yyvs1;
1104 bff58270 2022-09-19 op }
1105 bff58270 2022-09-19 op # else /* defined YYSTACK_RELOCATE */
1106 bff58270 2022-09-19 op /* Extend the stack our own way. */
1107 bff58270 2022-09-19 op if (YYMAXDEPTH <= yystacksize)
1108 bff58270 2022-09-19 op goto yyexhaustedlab;
1109 bff58270 2022-09-19 op yystacksize *= 2;
1110 bff58270 2022-09-19 op if (YYMAXDEPTH < yystacksize)
1111 bff58270 2022-09-19 op yystacksize = YYMAXDEPTH;
1112 bff58270 2022-09-19 op
1113 bff58270 2022-09-19 op {
1114 bff58270 2022-09-19 op yy_state_t *yyss1 = yyss;
1115 bff58270 2022-09-19 op union yyalloc *yyptr =
1116 bff58270 2022-09-19 op YY_CAST (union yyalloc *,
1117 bff58270 2022-09-19 op YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1118 bff58270 2022-09-19 op if (! yyptr)
1119 bff58270 2022-09-19 op goto yyexhaustedlab;
1120 bff58270 2022-09-19 op YYSTACK_RELOCATE (yyss_alloc, yyss);
1121 bff58270 2022-09-19 op YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1122 bff58270 2022-09-19 op # undef YYSTACK_RELOCATE
1123 bff58270 2022-09-19 op if (yyss1 != yyssa)
1124 bff58270 2022-09-19 op YYSTACK_FREE (yyss1);
1125 bff58270 2022-09-19 op }
1126 bff58270 2022-09-19 op # endif
1127 bff58270 2022-09-19 op
1128 bff58270 2022-09-19 op yyssp = yyss + yysize - 1;
1129 bff58270 2022-09-19 op yyvsp = yyvs + yysize - 1;
1130 bff58270 2022-09-19 op
1131 bff58270 2022-09-19 op YY_IGNORE_USELESS_CAST_BEGIN
1132 bff58270 2022-09-19 op YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1133 bff58270 2022-09-19 op YY_CAST (long, yystacksize)));
1134 bff58270 2022-09-19 op YY_IGNORE_USELESS_CAST_END
1135 bff58270 2022-09-19 op
1136 bff58270 2022-09-19 op if (yyss + yystacksize - 1 <= yyssp)
1137 bff58270 2022-09-19 op YYABORT;
1138 bff58270 2022-09-19 op }
1139 bff58270 2022-09-19 op #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1140 bff58270 2022-09-19 op
1141 bff58270 2022-09-19 op if (yystate == YYFINAL)
1142 bff58270 2022-09-19 op YYACCEPT;
1143 bff58270 2022-09-19 op
1144 bff58270 2022-09-19 op goto yybackup;
1145 bff58270 2022-09-19 op
1146 bff58270 2022-09-19 op
1147 bff58270 2022-09-19 op /*-----------.
1148 bff58270 2022-09-19 op | yybackup. |
1149 bff58270 2022-09-19 op `-----------*/
1150 bff58270 2022-09-19 op yybackup:
1151 bff58270 2022-09-19 op /* Do appropriate processing given the current state. Read a
1152 bff58270 2022-09-19 op lookahead token if we need one and don't already have one. */
1153 bff58270 2022-09-19 op
1154 bff58270 2022-09-19 op /* First try to decide what to do without reference to lookahead token. */
1155 bff58270 2022-09-19 op yyn = yypact[yystate];
1156 bff58270 2022-09-19 op if (yypact_value_is_default (yyn))
1157 bff58270 2022-09-19 op goto yydefault;
1158 bff58270 2022-09-19 op
1159 bff58270 2022-09-19 op /* Not known => get a lookahead token if don't already have one. */
1160 bff58270 2022-09-19 op
1161 bff58270 2022-09-19 op /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1162 bff58270 2022-09-19 op if (yychar == YYEMPTY)
1163 bff58270 2022-09-19 op {
1164 bff58270 2022-09-19 op YYDPRINTF ((stderr, "Reading a token\n"));
1165 bff58270 2022-09-19 op yychar = yylex ();
1166 bff58270 2022-09-19 op }
1167 bff58270 2022-09-19 op
1168 bff58270 2022-09-19 op if (yychar <= YYEOF)
1169 bff58270 2022-09-19 op {
1170 bff58270 2022-09-19 op yychar = YYEOF;
1171 bff58270 2022-09-19 op yytoken = YYSYMBOL_YYEOF;
1172 bff58270 2022-09-19 op YYDPRINTF ((stderr, "Now at end of input.\n"));
1173 bff58270 2022-09-19 op }
1174 bff58270 2022-09-19 op else if (yychar == YYerror)
1175 bff58270 2022-09-19 op {
1176 bff58270 2022-09-19 op /* The scanner already issued an error message, process directly
1177 bff58270 2022-09-19 op to error recovery. But do not keep the error token as
1178 bff58270 2022-09-19 op lookahead, it is too special and may lead us to an endless
1179 bff58270 2022-09-19 op loop in error recovery. */
1180 bff58270 2022-09-19 op yychar = YYUNDEF;
1181 bff58270 2022-09-19 op yytoken = YYSYMBOL_YYerror;
1182 bff58270 2022-09-19 op goto yyerrlab1;
1183 bff58270 2022-09-19 op }
1184 bff58270 2022-09-19 op else
1185 bff58270 2022-09-19 op {
1186 bff58270 2022-09-19 op yytoken = YYTRANSLATE (yychar);
1187 bff58270 2022-09-19 op YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1188 bff58270 2022-09-19 op }
1189 bff58270 2022-09-19 op
1190 bff58270 2022-09-19 op /* If the proper action on seeing token YYTOKEN is to reduce or to
1191 bff58270 2022-09-19 op detect an error, take that action. */
1192 bff58270 2022-09-19 op yyn += yytoken;
1193 bff58270 2022-09-19 op if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1194 bff58270 2022-09-19 op goto yydefault;
1195 bff58270 2022-09-19 op yyn = yytable[yyn];
1196 bff58270 2022-09-19 op if (yyn <= 0)
1197 bff58270 2022-09-19 op {
1198 bff58270 2022-09-19 op if (yytable_value_is_error (yyn))
1199 bff58270 2022-09-19 op goto yyerrlab;
1200 bff58270 2022-09-19 op yyn = -yyn;
1201 bff58270 2022-09-19 op goto yyreduce;
1202 bff58270 2022-09-19 op }
1203 bff58270 2022-09-19 op
1204 bff58270 2022-09-19 op /* Count tokens shifted since error; after three, turn off error
1205 bff58270 2022-09-19 op status. */
1206 bff58270 2022-09-19 op if (yyerrstatus)
1207 bff58270 2022-09-19 op yyerrstatus--;
1208 bff58270 2022-09-19 op
1209 bff58270 2022-09-19 op /* Shift the lookahead token. */
1210 bff58270 2022-09-19 op YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1211 bff58270 2022-09-19 op yystate = yyn;
1212 bff58270 2022-09-19 op YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1213 bff58270 2022-09-19 op *++yyvsp = yylval;
1214 bff58270 2022-09-19 op YY_IGNORE_MAYBE_UNINITIALIZED_END
1215 bff58270 2022-09-19 op
1216 bff58270 2022-09-19 op /* Discard the shifted token. */
1217 bff58270 2022-09-19 op yychar = YYEMPTY;
1218 bff58270 2022-09-19 op goto yynewstate;
1219 bff58270 2022-09-19 op
1220 bff58270 2022-09-19 op
1221 bff58270 2022-09-19 op /*-----------------------------------------------------------.
1222 bff58270 2022-09-19 op | yydefault -- do the default action for the current state. |
1223 bff58270 2022-09-19 op `-----------------------------------------------------------*/
1224 bff58270 2022-09-19 op yydefault:
1225 bff58270 2022-09-19 op yyn = yydefact[yystate];
1226 bff58270 2022-09-19 op if (yyn == 0)
1227 bff58270 2022-09-19 op goto yyerrlab;
1228 bff58270 2022-09-19 op goto yyreduce;
1229 bff58270 2022-09-19 op
1230 bff58270 2022-09-19 op
1231 bff58270 2022-09-19 op /*-----------------------------.
1232 bff58270 2022-09-19 op | yyreduce -- do a reduction. |
1233 bff58270 2022-09-19 op `-----------------------------*/
1234 bff58270 2022-09-19 op yyreduce:
1235 bff58270 2022-09-19 op /* yyn is the number of a rule to reduce with. */
1236 bff58270 2022-09-19 op yylen = yyr2[yyn];
1237 bff58270 2022-09-19 op
1238 bff58270 2022-09-19 op /* If YYLEN is nonzero, implement the default value of the action:
1239 bff58270 2022-09-19 op '$$ = $1'.
1240 bff58270 2022-09-19 op
1241 bff58270 2022-09-19 op Otherwise, the following line sets YYVAL to garbage.
1242 bff58270 2022-09-19 op This behavior is undocumented and Bison
1243 bff58270 2022-09-19 op users should not rely upon it. Assigning to YYVAL
1244 bff58270 2022-09-19 op unconditionally makes the parser a bit smaller, and it avoids a
1245 bff58270 2022-09-19 op GCC warning that YYVAL may be used uninitialized. */
1246 bff58270 2022-09-19 op yyval = yyvsp[1-yylen];
1247 bff58270 2022-09-19 op
1248 bff58270 2022-09-19 op
1249 bff58270 2022-09-19 op YY_REDUCE_PRINT (yyn);
1250 bff58270 2022-09-19 op switch (yyn)
1251 bff58270 2022-09-19 op {
1252 bff58270 2022-09-19 op case 6: /* grammar: grammar error */
1253 bff58270 2022-09-19 op #line 97 "parse.y"
1254 bff58270 2022-09-19 op { file->errors++; }
1255 bff58270 2022-09-19 op #line 1256 "y.tab.c"
1256 bff58270 2022-09-19 op break;
1257 bff58270 2022-09-19 op
1258 bff58270 2022-09-19 op case 7: /* include: INCLUDE STRING */
1259 bff58270 2022-09-19 op #line 100 "parse.y"
1260 bff58270 2022-09-19 op {
1261 bff58270 2022-09-19 op struct file *nfile;
1262 bff58270 2022-09-19 op
1263 bff58270 2022-09-19 op if ((nfile = pushfile((yyvsp[0].v.string), 0)) == NULL) {
1264 bff58270 2022-09-19 op yyerror("failed to include file %s", (yyvsp[0].v.string));
1265 bff58270 2022-09-19 op free((yyvsp[0].v.string));
1266 bff58270 2022-09-19 op YYERROR;
1267 bff58270 2022-09-19 op }
1268 bff58270 2022-09-19 op free((yyvsp[0].v.string));
1269 bff58270 2022-09-19 op
1270 bff58270 2022-09-19 op file = nfile;
1271 bff58270 2022-09-19 op lungetc('\n');
1272 bff58270 2022-09-19 op }
1273 bff58270 2022-09-19 op #line 1274 "y.tab.c"
1274 bff58270 2022-09-19 op break;
1275 bff58270 2022-09-19 op
1276 bff58270 2022-09-19 op case 8: /* verbatim: '!' verbatim1 '!' */
1277 bff58270 2022-09-19 op #line 115 "parse.y"
1278 bff58270 2022-09-19 op {
1279 bff58270 2022-09-19 op if (in_define) {
1280 bff58270 2022-09-19 op /* TODO: check template status and exit in case */
1281 bff58270 2022-09-19 op }
1282 bff58270 2022-09-19 op }
1283 bff58270 2022-09-19 op #line 1284 "y.tab.c"
1284 bff58270 2022-09-19 op break;
1285 bff58270 2022-09-19 op
1286 bff58270 2022-09-19 op case 10: /* verbatim1: verbatim1 STRING */
1287 bff58270 2022-09-19 op #line 123 "parse.y"
1288 bff58270 2022-09-19 op {
1289 bff58270 2022-09-19 op if (*(yyvsp[0].v.string) != '\0') {
1290 bff58270 2022-09-19 op dbg();
1291 bff58270 2022-09-19 op puts((yyvsp[0].v.string));
1292 bff58270 2022-09-19 op }
1293 bff58270 2022-09-19 op free((yyvsp[0].v.string));
1294 bff58270 2022-09-19 op }
1295 bff58270 2022-09-19 op #line 1296 "y.tab.c"
1296 bff58270 2022-09-19 op break;
1297 bff58270 2022-09-19 op
1298 bff58270 2022-09-19 op case 13: /* raw: STRING */
1299 bff58270 2022-09-19 op #line 136 "parse.y"
1300 bff58270 2022-09-19 op {
1301 bff58270 2022-09-19 op dbg();
1302 bff58270 2022-09-19 op printf("if (tp->tp_puts(tp, ");
1303 bff58270 2022-09-19 op printq((yyvsp[0].v.string));
1304 bff58270 2022-09-19 op printf(") == -1) goto %s;\n", lerr);
1305 bff58270 2022-09-19 op
1306 bff58270 2022-09-19 op free((yyvsp[0].v.string));
1307 bff58270 2022-09-19 op }
1308 bff58270 2022-09-19 op #line 1309 "y.tab.c"
1309 bff58270 2022-09-19 op break;
1310 bff58270 2022-09-19 op
1311 bff58270 2022-09-19 op case 14: /* block: define body end */
1312 bff58270 2022-09-19 op #line 146 "parse.y"
1313 bff58270 2022-09-19 op {
1314 bff58270 2022-09-19 op printf("%s:\n", lerr);
1315 bff58270 2022-09-19 op puts("return tp->tp_ret;");
1316 bff58270 2022-09-19 op puts("}");
1317 bff58270 2022-09-19 op in_define = 0;
1318 bff58270 2022-09-19 op }
1319 bff58270 2022-09-19 op #line 1320 "y.tab.c"
1320 bff58270 2022-09-19 op break;
1321 bff58270 2022-09-19 op
1322 bff58270 2022-09-19 op case 15: /* block: define body finally end */
1323 bff58270 2022-09-19 op #line 152 "parse.y"
1324 bff58270 2022-09-19 op {
1325 bff58270 2022-09-19 op puts("return tp->tp_ret;");
1326 bff58270 2022-09-19 op puts("}");
1327 bff58270 2022-09-19 op in_define = 0;
1328 bff58270 2022-09-19 op }
1329 bff58270 2022-09-19 op #line 1330 "y.tab.c"
1330 bff58270 2022-09-19 op break;
1331 bff58270 2022-09-19 op
1332 bff58270 2022-09-19 op case 16: /* define: '{' DEFINE string '}' */
1333 bff58270 2022-09-19 op #line 159 "parse.y"
1334 bff58270 2022-09-19 op {
1335 bff58270 2022-09-19 op in_define = 1;
1336 bff58270 2022-09-19 op (void)snprintf(lerr, sizeof(lerr), "err%llu",
1337 bff58270 2022-09-19 op (unsigned long long)arc4random());
1338 bff58270 2022-09-19 op
1339 bff58270 2022-09-19 op dbg();
1340 bff58270 2022-09-19 op printf("int\n%s\n{\n", (yyvsp[-1].v.string));
1341 bff58270 2022-09-19 op
1342 bff58270 2022-09-19 op free((yyvsp[-1].v.string));
1343 bff58270 2022-09-19 op }
1344 bff58270 2022-09-19 op #line 1345 "y.tab.c"
1345 bff58270 2022-09-19 op break;
1346 bff58270 2022-09-19 op
1347 bff58270 2022-09-19 op case 21: /* special: '{' RENDER string '}' */
1348 bff58270 2022-09-19 op #line 177 "parse.y"
1349 bff58270 2022-09-19 op {
1350 bff58270 2022-09-19 op dbg();
1351 bff58270 2022-09-19 op if (strrchr((yyvsp[-1].v.string), ')') != NULL)
1352 bff58270 2022-09-19 op printf("if (%s == -1) goto %s;\n",
1353 bff58270 2022-09-19 op (yyvsp[-1].v.string), lerr);
1354 bff58270 2022-09-19 op else
1355 bff58270 2022-09-19 op printf("if (%s != NULL && %s(tp) == -1) "
1356 bff58270 2022-09-19 op "goto %s;\n", (yyvsp[-1].v.string), (yyvsp[-1].v.string), lerr);
1357 bff58270 2022-09-19 op free((yyvsp[-1].v.string));
1358 bff58270 2022-09-19 op }
1359 bff58270 2022-09-19 op #line 1360 "y.tab.c"
1360 bff58270 2022-09-19 op break;
1361 bff58270 2022-09-19 op
1362 bff58270 2022-09-19 op case 22: /* special: if body endif */
1363 bff58270 2022-09-19 op #line 187 "parse.y"
1364 bff58270 2022-09-19 op { puts("}"); }
1365 bff58270 2022-09-19 op #line 1366 "y.tab.c"
1366 bff58270 2022-09-19 op break;
1367 bff58270 2022-09-19 op
1368 bff58270 2022-09-19 op case 24: /* special: '{' string '}' */
1369 bff58270 2022-09-19 op #line 189 "parse.y"
1370 bff58270 2022-09-19 op {
1371 bff58270 2022-09-19 op dbg();
1372 bff58270 2022-09-19 op printf("if (tp->tp_escape(tp, %s) == -1) goto %s;\n",
1373 bff58270 2022-09-19 op (yyvsp[-1].v.string), lerr);
1374 bff58270 2022-09-19 op }
1375 bff58270 2022-09-19 op #line 1376 "y.tab.c"
1376 bff58270 2022-09-19 op break;
1377 bff58270 2022-09-19 op
1378 bff58270 2022-09-19 op case 25: /* if: '{' IF string '}' */
1379 bff58270 2022-09-19 op #line 196 "parse.y"
1380 bff58270 2022-09-19 op {
1381 bff58270 2022-09-19 op dbg();
1382 bff58270 2022-09-19 op printf("if (%s) {\n", (yyvsp[-1].v.string));
1383 bff58270 2022-09-19 op free((yyvsp[-1].v.string));
1384 bff58270 2022-09-19 op }
1385 bff58270 2022-09-19 op #line 1386 "y.tab.c"
1386 bff58270 2022-09-19 op break;
1387 bff58270 2022-09-19 op
1388 bff58270 2022-09-19 op case 29: /* elsif: '{' ELSE IF string '}' */
1389 bff58270 2022-09-19 op #line 208 "parse.y"
1390 bff58270 2022-09-19 op {
1391 bff58270 2022-09-19 op dbg();
1392 bff58270 2022-09-19 op printf("} else if (%s) {\n", (yyvsp[-1].v.string));
1393 bff58270 2022-09-19 op free((yyvsp[-1].v.string));
1394 bff58270 2022-09-19 op }
1395 bff58270 2022-09-19 op #line 1396 "y.tab.c"
1396 bff58270 2022-09-19 op break;
1397 bff58270 2022-09-19 op
1398 bff58270 2022-09-19 op case 30: /* else: '{' ELSE '}' */
1399 bff58270 2022-09-19 op #line 215 "parse.y"
1400 bff58270 2022-09-19 op {
1401 bff58270 2022-09-19 op dbg();
1402 bff58270 2022-09-19 op puts("} else {");
1403 bff58270 2022-09-19 op }
1404 bff58270 2022-09-19 op #line 1405 "y.tab.c"
1405 bff58270 2022-09-19 op break;
1406 bff58270 2022-09-19 op
1407 bff58270 2022-09-19 op case 31: /* $@1: %empty */
1408 bff58270 2022-09-19 op #line 221 "parse.y"
1409 bff58270 2022-09-19 op {
1410 bff58270 2022-09-19 op printf("TAILQ_FOREACH(%s, %s, %s) {\n",
1411 bff58270 2022-09-19 op (yyvsp[-3].v.string), (yyvsp[-2].v.string), (yyvsp[-1].v.string));
1412 bff58270 2022-09-19 op free((yyvsp[-3].v.string));
1413 bff58270 2022-09-19 op free((yyvsp[-2].v.string));
1414 bff58270 2022-09-19 op free((yyvsp[-1].v.string));
1415 bff58270 2022-09-19 op }
1416 bff58270 2022-09-19 op #line 1417 "y.tab.c"
1417 bff58270 2022-09-19 op break;
1418 bff58270 2022-09-19 op
1419 bff58270 2022-09-19 op case 32: /* loop: '{' TQFOREACH STRING STRING STRING '}' $@1 body end */
1420 bff58270 2022-09-19 op #line 227 "parse.y"
1421 bff58270 2022-09-19 op {
1422 bff58270 2022-09-19 op puts("}");
1423 bff58270 2022-09-19 op }
1424 bff58270 2022-09-19 op #line 1425 "y.tab.c"
1425 bff58270 2022-09-19 op break;
1426 bff58270 2022-09-19 op
1427 bff58270 2022-09-19 op case 34: /* $@2: %empty */
1428 bff58270 2022-09-19 op #line 235 "parse.y"
1429 bff58270 2022-09-19 op {
1430 bff58270 2022-09-19 op dbg();
1431 bff58270 2022-09-19 op printf("%s:\n", lerr);
1432 bff58270 2022-09-19 op }
1433 bff58270 2022-09-19 op #line 1434 "y.tab.c"
1434 bff58270 2022-09-19 op break;
1435 bff58270 2022-09-19 op
1436 bff58270 2022-09-19 op case 36: /* string: STRING string */
1437 bff58270 2022-09-19 op #line 241 "parse.y"
1438 bff58270 2022-09-19 op {
1439 bff58270 2022-09-19 op if (asprintf(&(yyval.v.string), "%s %s", (yyvsp[-1].v.string), (yyvsp[0].v.string)) == -1)
1440 bff58270 2022-09-19 op err(1, "asprintf");
1441 bff58270 2022-09-19 op free((yyvsp[-1].v.string));
1442 bff58270 2022-09-19 op free((yyvsp[0].v.string));
1443 bff58270 2022-09-19 op }
1444 bff58270 2022-09-19 op #line 1445 "y.tab.c"
1445 bff58270 2022-09-19 op break;
1446 bff58270 2022-09-19 op
1447 bff58270 2022-09-19 op
1448 bff58270 2022-09-19 op #line 1449 "y.tab.c"
1449 bff58270 2022-09-19 op
1450 bff58270 2022-09-19 op default: break;
1451 bff58270 2022-09-19 op }
1452 bff58270 2022-09-19 op /* User semantic actions sometimes alter yychar, and that requires
1453 bff58270 2022-09-19 op that yytoken be updated with the new translation. We take the
1454 bff58270 2022-09-19 op approach of translating immediately before every use of yytoken.
1455 bff58270 2022-09-19 op One alternative is translating here after every semantic action,
1456 bff58270 2022-09-19 op but that translation would be missed if the semantic action invokes
1457 bff58270 2022-09-19 op YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1458 bff58270 2022-09-19 op if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1459 bff58270 2022-09-19 op incorrect destructor might then be invoked immediately. In the
1460 bff58270 2022-09-19 op case of YYERROR or YYBACKUP, subsequent parser actions might lead
1461 bff58270 2022-09-19 op to an incorrect destructor call or verbose syntax error message
1462 bff58270 2022-09-19 op before the lookahead is translated. */
1463 bff58270 2022-09-19 op YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1464 bff58270 2022-09-19 op
1465 bff58270 2022-09-19 op YYPOPSTACK (yylen);
1466 bff58270 2022-09-19 op yylen = 0;
1467 bff58270 2022-09-19 op
1468 bff58270 2022-09-19 op *++yyvsp = yyval;
1469 bff58270 2022-09-19 op
1470 bff58270 2022-09-19 op /* Now 'shift' the result of the reduction. Determine what state
1471 bff58270 2022-09-19 op that goes to, based on the state we popped back to and the rule
1472 bff58270 2022-09-19 op number reduced by. */
1473 bff58270 2022-09-19 op {
1474 bff58270 2022-09-19 op const int yylhs = yyr1[yyn] - YYNTOKENS;
1475 bff58270 2022-09-19 op const int yyi = yypgoto[yylhs] + *yyssp;
1476 bff58270 2022-09-19 op yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1477 bff58270 2022-09-19 op ? yytable[yyi]
1478 bff58270 2022-09-19 op : yydefgoto[yylhs]);
1479 bff58270 2022-09-19 op }
1480 bff58270 2022-09-19 op
1481 bff58270 2022-09-19 op goto yynewstate;
1482 bff58270 2022-09-19 op
1483 bff58270 2022-09-19 op
1484 bff58270 2022-09-19 op /*--------------------------------------.
1485 bff58270 2022-09-19 op | yyerrlab -- here on detecting error. |
1486 bff58270 2022-09-19 op `--------------------------------------*/
1487 bff58270 2022-09-19 op yyerrlab:
1488 bff58270 2022-09-19 op /* Make sure we have latest lookahead translation. See comments at
1489 bff58270 2022-09-19 op user semantic actions for why this is necessary. */
1490 bff58270 2022-09-19 op yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1491 bff58270 2022-09-19 op /* If not already recovering from an error, report this error. */
1492 bff58270 2022-09-19 op if (!yyerrstatus)
1493 bff58270 2022-09-19 op {
1494 bff58270 2022-09-19 op ++yynerrs;
1495 bff58270 2022-09-19 op yyerror (YY_("syntax error"));
1496 bff58270 2022-09-19 op }
1497 bff58270 2022-09-19 op
1498 bff58270 2022-09-19 op if (yyerrstatus == 3)
1499 bff58270 2022-09-19 op {
1500 bff58270 2022-09-19 op /* If just tried and failed to reuse lookahead token after an
1501 bff58270 2022-09-19 op error, discard it. */
1502 bff58270 2022-09-19 op
1503 bff58270 2022-09-19 op if (yychar <= YYEOF)
1504 bff58270 2022-09-19 op {
1505 bff58270 2022-09-19 op /* Return failure if at end of input. */
1506 bff58270 2022-09-19 op if (yychar == YYEOF)
1507 bff58270 2022-09-19 op YYABORT;
1508 bff58270 2022-09-19 op }
1509 bff58270 2022-09-19 op else
1510 bff58270 2022-09-19 op {
1511 bff58270 2022-09-19 op yydestruct ("Error: discarding",
1512 bff58270 2022-09-19 op yytoken, &yylval);
1513 bff58270 2022-09-19 op yychar = YYEMPTY;
1514 bff58270 2022-09-19 op }
1515 bff58270 2022-09-19 op }
1516 bff58270 2022-09-19 op
1517 bff58270 2022-09-19 op /* Else will try to reuse lookahead token after shifting the error
1518 bff58270 2022-09-19 op token. */
1519 bff58270 2022-09-19 op goto yyerrlab1;
1520 bff58270 2022-09-19 op
1521 bff58270 2022-09-19 op
1522 bff58270 2022-09-19 op /*---------------------------------------------------.
1523 bff58270 2022-09-19 op | yyerrorlab -- error raised explicitly by YYERROR. |
1524 bff58270 2022-09-19 op `---------------------------------------------------*/
1525 bff58270 2022-09-19 op yyerrorlab:
1526 bff58270 2022-09-19 op /* Pacify compilers when the user code never invokes YYERROR and the
1527 bff58270 2022-09-19 op label yyerrorlab therefore never appears in user code. */
1528 bff58270 2022-09-19 op if (0)
1529 bff58270 2022-09-19 op YYERROR;
1530 bff58270 2022-09-19 op
1531 bff58270 2022-09-19 op /* Do not reclaim the symbols of the rule whose action triggered
1532 bff58270 2022-09-19 op this YYERROR. */
1533 bff58270 2022-09-19 op YYPOPSTACK (yylen);
1534 bff58270 2022-09-19 op yylen = 0;
1535 bff58270 2022-09-19 op YY_STACK_PRINT (yyss, yyssp);
1536 bff58270 2022-09-19 op yystate = *yyssp;
1537 bff58270 2022-09-19 op goto yyerrlab1;
1538 bff58270 2022-09-19 op
1539 bff58270 2022-09-19 op
1540 bff58270 2022-09-19 op /*-------------------------------------------------------------.
1541 bff58270 2022-09-19 op | yyerrlab1 -- common code for both syntax error and YYERROR. |
1542 bff58270 2022-09-19 op `-------------------------------------------------------------*/
1543 bff58270 2022-09-19 op yyerrlab1:
1544 bff58270 2022-09-19 op yyerrstatus = 3; /* Each real token shifted decrements this. */
1545 bff58270 2022-09-19 op
1546 bff58270 2022-09-19 op /* Pop stack until we find a state that shifts the error token. */
1547 bff58270 2022-09-19 op for (;;)
1548 bff58270 2022-09-19 op {
1549 bff58270 2022-09-19 op yyn = yypact[yystate];
1550 bff58270 2022-09-19 op if (!yypact_value_is_default (yyn))
1551 bff58270 2022-09-19 op {
1552 bff58270 2022-09-19 op yyn += YYSYMBOL_YYerror;
1553 bff58270 2022-09-19 op if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1554 bff58270 2022-09-19 op {
1555 bff58270 2022-09-19 op yyn = yytable[yyn];
1556 bff58270 2022-09-19 op if (0 < yyn)
1557 bff58270 2022-09-19 op break;
1558 bff58270 2022-09-19 op }
1559 bff58270 2022-09-19 op }
1560 bff58270 2022-09-19 op
1561 bff58270 2022-09-19 op /* Pop the current state because it cannot handle the error token. */
1562 bff58270 2022-09-19 op if (yyssp == yyss)
1563 bff58270 2022-09-19 op YYABORT;
1564 bff58270 2022-09-19 op
1565 bff58270 2022-09-19 op
1566 bff58270 2022-09-19 op yydestruct ("Error: popping",
1567 bff58270 2022-09-19 op YY_ACCESSING_SYMBOL (yystate), yyvsp);
1568 bff58270 2022-09-19 op YYPOPSTACK (1);
1569 bff58270 2022-09-19 op yystate = *yyssp;
1570 bff58270 2022-09-19 op YY_STACK_PRINT (yyss, yyssp);
1571 bff58270 2022-09-19 op }
1572 bff58270 2022-09-19 op
1573 bff58270 2022-09-19 op YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1574 bff58270 2022-09-19 op *++yyvsp = yylval;
1575 bff58270 2022-09-19 op YY_IGNORE_MAYBE_UNINITIALIZED_END
1576 bff58270 2022-09-19 op
1577 bff58270 2022-09-19 op
1578 bff58270 2022-09-19 op /* Shift the error token. */
1579 bff58270 2022-09-19 op YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1580 bff58270 2022-09-19 op
1581 bff58270 2022-09-19 op yystate = yyn;
1582 bff58270 2022-09-19 op goto yynewstate;
1583 bff58270 2022-09-19 op
1584 bff58270 2022-09-19 op
1585 bff58270 2022-09-19 op /*-------------------------------------.
1586 bff58270 2022-09-19 op | yyacceptlab -- YYACCEPT comes here. |
1587 bff58270 2022-09-19 op `-------------------------------------*/
1588 bff58270 2022-09-19 op yyacceptlab:
1589 bff58270 2022-09-19 op yyresult = 0;
1590 bff58270 2022-09-19 op goto yyreturn;
1591 bff58270 2022-09-19 op
1592 bff58270 2022-09-19 op
1593 bff58270 2022-09-19 op /*-----------------------------------.
1594 bff58270 2022-09-19 op | yyabortlab -- YYABORT comes here. |
1595 bff58270 2022-09-19 op `-----------------------------------*/
1596 bff58270 2022-09-19 op yyabortlab:
1597 bff58270 2022-09-19 op yyresult = 1;
1598 bff58270 2022-09-19 op goto yyreturn;
1599 bff58270 2022-09-19 op
1600 bff58270 2022-09-19 op
1601 bff58270 2022-09-19 op #if !defined yyoverflow
1602 bff58270 2022-09-19 op /*-------------------------------------------------.
1603 bff58270 2022-09-19 op | yyexhaustedlab -- memory exhaustion comes here. |
1604 bff58270 2022-09-19 op `-------------------------------------------------*/
1605 bff58270 2022-09-19 op yyexhaustedlab:
1606 bff58270 2022-09-19 op yyerror (YY_("memory exhausted"));
1607 bff58270 2022-09-19 op yyresult = 2;
1608 bff58270 2022-09-19 op goto yyreturn;
1609 bff58270 2022-09-19 op #endif
1610 bff58270 2022-09-19 op
1611 bff58270 2022-09-19 op
1612 bff58270 2022-09-19 op /*-------------------------------------------------------.
1613 bff58270 2022-09-19 op | yyreturn -- parsing is finished, clean up and return. |
1614 bff58270 2022-09-19 op `-------------------------------------------------------*/
1615 bff58270 2022-09-19 op yyreturn:
1616 bff58270 2022-09-19 op if (yychar != YYEMPTY)
1617 bff58270 2022-09-19 op {
1618 bff58270 2022-09-19 op /* Make sure we have latest lookahead translation. See comments at
1619 bff58270 2022-09-19 op user semantic actions for why this is necessary. */
1620 bff58270 2022-09-19 op yytoken = YYTRANSLATE (yychar);
1621 bff58270 2022-09-19 op yydestruct ("Cleanup: discarding lookahead",
1622 bff58270 2022-09-19 op yytoken, &yylval);
1623 bff58270 2022-09-19 op }
1624 bff58270 2022-09-19 op /* Do not reclaim the symbols of the rule whose action triggered
1625 bff58270 2022-09-19 op this YYABORT or YYACCEPT. */
1626 bff58270 2022-09-19 op YYPOPSTACK (yylen);
1627 bff58270 2022-09-19 op YY_STACK_PRINT (yyss, yyssp);
1628 bff58270 2022-09-19 op while (yyssp != yyss)
1629 bff58270 2022-09-19 op {
1630 bff58270 2022-09-19 op yydestruct ("Cleanup: popping",
1631 bff58270 2022-09-19 op YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1632 bff58270 2022-09-19 op YYPOPSTACK (1);
1633 bff58270 2022-09-19 op }
1634 bff58270 2022-09-19 op #ifndef yyoverflow
1635 bff58270 2022-09-19 op if (yyss != yyssa)
1636 bff58270 2022-09-19 op YYSTACK_FREE (yyss);
1637 bff58270 2022-09-19 op #endif
1638 bff58270 2022-09-19 op
1639 bff58270 2022-09-19 op return yyresult;
1640 bff58270 2022-09-19 op }
1641 bff58270 2022-09-19 op
1642 bff58270 2022-09-19 op #line 250 "parse.y"
1643 bff58270 2022-09-19 op
1644 bff58270 2022-09-19 op
1645 bff58270 2022-09-19 op struct keywords {
1646 bff58270 2022-09-19 op const char *k_name;
1647 bff58270 2022-09-19 op int k_val;
1648 bff58270 2022-09-19 op };
1649 bff58270 2022-09-19 op
1650 bff58270 2022-09-19 op int
1651 bff58270 2022-09-19 op yyerror(const char *fmt, ...)
1652 bff58270 2022-09-19 op {
1653 bff58270 2022-09-19 op va_list ap;
1654 bff58270 2022-09-19 op char *msg;
1655 bff58270 2022-09-19 op
1656 bff58270 2022-09-19 op file->errors++;
1657 bff58270 2022-09-19 op va_start(ap, fmt);
1658 bff58270 2022-09-19 op if (vasprintf(&msg, fmt, ap) == -1)
1659 bff58270 2022-09-19 op err(1, "yyerror vasprintf");
1660 bff58270 2022-09-19 op va_end(ap);
1661 bff58270 2022-09-19 op fprintf(stderr, "%s:%d: %s\n", file->name, yylval.lineno, msg);
1662 bff58270 2022-09-19 op free(msg);
1663 bff58270 2022-09-19 op return (0);
1664 bff58270 2022-09-19 op }
1665 bff58270 2022-09-19 op
1666 bff58270 2022-09-19 op int
1667 bff58270 2022-09-19 op kw_cmp(const void *k, const void *e)
1668 bff58270 2022-09-19 op {
1669 bff58270 2022-09-19 op return (strcmp(k, ((const struct keywords *)e)->k_name));
1670 bff58270 2022-09-19 op }
1671 bff58270 2022-09-19 op
1672 bff58270 2022-09-19 op int
1673 bff58270 2022-09-19 op lookup(char *s)
1674 bff58270 2022-09-19 op {
1675 bff58270 2022-09-19 op /* this has to be sorted always */
1676 bff58270 2022-09-19 op static const struct keywords keywords[] = {
1677 bff58270 2022-09-19 op { "define", DEFINE },
1678 bff58270 2022-09-19 op { "else", ELSE },
1679 bff58270 2022-09-19 op { "end", END },
1680 bff58270 2022-09-19 op { "finally", FINALLY },
1681 bff58270 2022-09-19 op { "if", IF },
1682 bff58270 2022-09-19 op { "include", INCLUDE },
1683 bff58270 2022-09-19 op { "render", RENDER },
1684 bff58270 2022-09-19 op { "tailq-foreach", TQFOREACH },
1685 bff58270 2022-09-19 op };
1686 bff58270 2022-09-19 op const struct keywords *p;
1687 bff58270 2022-09-19 op
1688 bff58270 2022-09-19 op p = bsearch(s, keywords, nitems(keywords), sizeof(keywords[0]),
1689 bff58270 2022-09-19 op kw_cmp);
1690 bff58270 2022-09-19 op
1691 bff58270 2022-09-19 op if (p)
1692 bff58270 2022-09-19 op return (p->k_val);
1693 bff58270 2022-09-19 op else
1694 bff58270 2022-09-19 op return (STRING);
1695 bff58270 2022-09-19 op }
1696 bff58270 2022-09-19 op
1697 bff58270 2022-09-19 op #define START_EXPAND 1
1698 bff58270 2022-09-19 op #define DONE_EXPAND 2
1699 bff58270 2022-09-19 op
1700 bff58270 2022-09-19 op static int expanding;
1701 bff58270 2022-09-19 op
1702 bff58270 2022-09-19 op int
1703 bff58270 2022-09-19 op igetc(void)
1704 bff58270 2022-09-19 op {
1705 bff58270 2022-09-19 op int c;
1706 bff58270 2022-09-19 op
1707 bff58270 2022-09-19 op while (1) {
1708 bff58270 2022-09-19 op if (file->ungetpos > 0)
1709 bff58270 2022-09-19 op c = file->ungetbuf[--file->ungetpos];
1710 bff58270 2022-09-19 op else
1711 bff58270 2022-09-19 op c = getc(file->stream);
1712 bff58270 2022-09-19 op
1713 bff58270 2022-09-19 op if (c == START_EXPAND)
1714 bff58270 2022-09-19 op expanding = 1;
1715 bff58270 2022-09-19 op else if (c == DONE_EXPAND)
1716 bff58270 2022-09-19 op expanding = 0;
1717 bff58270 2022-09-19 op else
1718 bff58270 2022-09-19 op break;
1719 bff58270 2022-09-19 op }
1720 bff58270 2022-09-19 op return (c);
1721 bff58270 2022-09-19 op }
1722 bff58270 2022-09-19 op
1723 bff58270 2022-09-19 op int
1724 bff58270 2022-09-19 op lgetc(int quotec)
1725 bff58270 2022-09-19 op {
1726 bff58270 2022-09-19 op int c, next;
1727 bff58270 2022-09-19 op
1728 bff58270 2022-09-19 op if (quotec) {
1729 bff58270 2022-09-19 op if ((c = igetc()) == EOF) {
1730 bff58270 2022-09-19 op yyerror("reached end of filewhile parsing "
1731 bff58270 2022-09-19 op "quoted string");
1732 bff58270 2022-09-19 op if (file == topfile || popfile() == EOF)
1733 bff58270 2022-09-19 op return (EOF);
1734 bff58270 2022-09-19 op return (quotec);
1735 bff58270 2022-09-19 op }
1736 bff58270 2022-09-19 op return (c);
1737 bff58270 2022-09-19 op }
1738 bff58270 2022-09-19 op
1739 bff58270 2022-09-19 op while ((c = igetc()) == '\\') {
1740 bff58270 2022-09-19 op next = igetc();
1741 bff58270 2022-09-19 op if (next != '\n') {
1742 bff58270 2022-09-19 op c = next;
1743 bff58270 2022-09-19 op break;
1744 bff58270 2022-09-19 op }
1745 bff58270 2022-09-19 op yylval.lineno = file->lineno;
1746 bff58270 2022-09-19 op file->lineno++;
1747 bff58270 2022-09-19 op }
1748 bff58270 2022-09-19 op if (c == '\t' || c == ' ') {
1749 bff58270 2022-09-19 op /* Compress blanks to a sigle space. */
1750 bff58270 2022-09-19 op do {
1751 bff58270 2022-09-19 op c = getc(file->stream);
1752 bff58270 2022-09-19 op } while (c == '\t' || c == ' ');
1753 bff58270 2022-09-19 op ungetc(c, file->stream);
1754 bff58270 2022-09-19 op c = ' ';
1755 bff58270 2022-09-19 op }
1756 bff58270 2022-09-19 op
1757 bff58270 2022-09-19 op if (c == EOF) {
1758 bff58270 2022-09-19 op /*
1759 bff58270 2022-09-19 op * Fake EOL when hit EOF for the first time. This gets line
1760 bff58270 2022-09-19 op * count rigchtif last line included file is syntactically
1761 bff58270 2022-09-19 op * invalid and has no newline.
1762 bff58270 2022-09-19 op */
1763 bff58270 2022-09-19 op if (file->eof_reached == 0) {
1764 bff58270 2022-09-19 op file->eof_reached = 1;
1765 bff58270 2022-09-19 op return ('\n');
1766 bff58270 2022-09-19 op }
1767 bff58270 2022-09-19 op while (c == EOF) {
1768 bff58270 2022-09-19 op if (file == topfile || popfile() == EOF)
1769 bff58270 2022-09-19 op return (EOF);
1770 bff58270 2022-09-19 op c = igetc();
1771 bff58270 2022-09-19 op }
1772 bff58270 2022-09-19 op }
1773 bff58270 2022-09-19 op return (c);
1774 bff58270 2022-09-19 op }
1775 bff58270 2022-09-19 op
1776 bff58270 2022-09-19 op void
1777 bff58270 2022-09-19 op lungetc(int c)
1778 bff58270 2022-09-19 op {
1779 bff58270 2022-09-19 op if (c == EOF)
1780 bff58270 2022-09-19 op return;
1781 bff58270 2022-09-19 op
1782 bff58270 2022-09-19 op if (file->ungetpos >= file->ungetsize) {
1783 bff58270 2022-09-19 op void *p = reallocarray(file->ungetbuf, file->ungetsize, 2);
1784 bff58270 2022-09-19 op if (p == NULL)
1785 bff58270 2022-09-19 op err(1, "reallocarray");
1786 bff58270 2022-09-19 op file->ungetbuf = p;
1787 bff58270 2022-09-19 op file->ungetsize *= 2;
1788 bff58270 2022-09-19 op }
1789 bff58270 2022-09-19 op file->ungetbuf[file->ungetpos++] = c;
1790 bff58270 2022-09-19 op }
1791 bff58270 2022-09-19 op
1792 bff58270 2022-09-19 op int
1793 bff58270 2022-09-19 op findeol(void)
1794 bff58270 2022-09-19 op {
1795 bff58270 2022-09-19 op int c;
1796 bff58270 2022-09-19 op
1797 bff58270 2022-09-19 op /* skip to either EOF or the first real EOL */
1798 bff58270 2022-09-19 op while (1) {
1799 bff58270 2022-09-19 op c = lgetc(0);
1800 bff58270 2022-09-19 op if (c == '\n') {
1801 bff58270 2022-09-19 op file->lineno++;
1802 bff58270 2022-09-19 op break;
1803 bff58270 2022-09-19 op }
1804 bff58270 2022-09-19 op if (c == EOF)
1805 bff58270 2022-09-19 op break;
1806 bff58270 2022-09-19 op }
1807 bff58270 2022-09-19 op return (ERROR);
1808 bff58270 2022-09-19 op }
1809 bff58270 2022-09-19 op
1810 bff58270 2022-09-19 op int
1811 bff58270 2022-09-19 op yylex(void)
1812 bff58270 2022-09-19 op {
1813 bff58270 2022-09-19 op char buf[8096];
1814 bff58270 2022-09-19 op char *p = buf;
1815 bff58270 2022-09-19 op int c;
1816 bff58270 2022-09-19 op int token;
1817 bff58270 2022-09-19 op int starting = 0;
1818 bff58270 2022-09-19 op int ending = 0;
1819 bff58270 2022-09-19 op
1820 bff58270 2022-09-19 op if (!in_define && block == 0) {
1821 bff58270 2022-09-19 op while ((c = lgetc(0)) != '{' && c != EOF) {
1822 bff58270 2022-09-19 op if (c == '\n')
1823 bff58270 2022-09-19 op file->lineno++;
1824 bff58270 2022-09-19 op }
1825 bff58270 2022-09-19 op
1826 bff58270 2022-09-19 op if (c == EOF)
1827 bff58270 2022-09-19 op return (0);
1828 bff58270 2022-09-19 op
1829 bff58270 2022-09-19 op newblock:
1830 bff58270 2022-09-19 op c = lgetc(0);
1831 bff58270 2022-09-19 op if (c == '{' || c == '!') {
1832 bff58270 2022-09-19 op if (c == '{')
1833 bff58270 2022-09-19 op block = '}';
1834 bff58270 2022-09-19 op else
1835 bff58270 2022-09-19 op block = c;
1836 bff58270 2022-09-19 op return (c);
1837 bff58270 2022-09-19 op }
1838 bff58270 2022-09-19 op if (c == '\n')
1839 bff58270 2022-09-19 op file->lineno++;
1840 bff58270 2022-09-19 op }
1841 bff58270 2022-09-19 op
1842 bff58270 2022-09-19 op while ((c = lgetc(0)) == ' ' || c == '\t' || c == '\n') {
1843 bff58270 2022-09-19 op if (c == '\n')
1844 bff58270 2022-09-19 op file->lineno++;
1845 bff58270 2022-09-19 op }
1846 bff58270 2022-09-19 op
1847 bff58270 2022-09-19 op if (c == EOF) {
1848 bff58270 2022-09-19 op yyerror("unterminated block");
1849 bff58270 2022-09-19 op return (0);
1850 bff58270 2022-09-19 op }
1851 bff58270 2022-09-19 op
1852 bff58270 2022-09-19 op yylval.lineno = file->lineno;
1853 bff58270 2022-09-19 op
1854 bff58270 2022-09-19 op if (block != 0 && c == block) {
1855 bff58270 2022-09-19 op if ((c = lgetc(0)) == '}') {
1856 bff58270 2022-09-19 op if (block == '!') {
1857 bff58270 2022-09-19 op block = 0;
1858 bff58270 2022-09-19 op return ('!');
1859 bff58270 2022-09-19 op }
1860 bff58270 2022-09-19 op block = 0;
1861 bff58270 2022-09-19 op return ('}');
1862 bff58270 2022-09-19 op }
1863 bff58270 2022-09-19 op lungetc(c);
1864 bff58270 2022-09-19 op c = block;
1865 bff58270 2022-09-19 op }
1866 bff58270 2022-09-19 op
1867 bff58270 2022-09-19 op if (in_define && block == 0) {
1868 bff58270 2022-09-19 op if (c == '{')
1869 bff58270 2022-09-19 op goto newblock;
1870 bff58270 2022-09-19 op
1871 bff58270 2022-09-19 op do {
1872 bff58270 2022-09-19 op if (starting) {
1873 bff58270 2022-09-19 op if (c == '!' || c == '{') {
1874 bff58270 2022-09-19 op lungetc('{');
1875 bff58270 2022-09-19 op lungetc(c);
1876 bff58270 2022-09-19 op break;
1877 bff58270 2022-09-19 op }
1878 bff58270 2022-09-19 op starting = 0;
1879 bff58270 2022-09-19 op lungetc(c);
1880 bff58270 2022-09-19 op c = '{';
1881 bff58270 2022-09-19 op } else if (c == '{') {
1882 bff58270 2022-09-19 op starting = 1;
1883 bff58270 2022-09-19 op continue;
1884 bff58270 2022-09-19 op }
1885 bff58270 2022-09-19 op
1886 bff58270 2022-09-19 op *p++ = c;
1887 bff58270 2022-09-19 op if ((size_t)(p - buf) >= sizeof(buf)) {
1888 bff58270 2022-09-19 op yyerror("string too long");
1889 bff58270 2022-09-19 op return (findeol());
1890 bff58270 2022-09-19 op }
1891 bff58270 2022-09-19 op } while ((c = lgetc(0)) != EOF && c != '\n');
1892 bff58270 2022-09-19 op *p = '\0';
1893 bff58270 2022-09-19 op if (c == EOF) {
1894 bff58270 2022-09-19 op yyerror("unterminated block");
1895 bff58270 2022-09-19 op return (0);
1896 bff58270 2022-09-19 op }
1897 bff58270 2022-09-19 op if (c == '\n')
1898 bff58270 2022-09-19 op file->lineno++;
1899 bff58270 2022-09-19 op if ((yylval.v.string = strdup(buf)) == NULL)
1900 bff58270 2022-09-19 op err(1, "strdup");
1901 bff58270 2022-09-19 op return (STRING);
1902 bff58270 2022-09-19 op }
1903 bff58270 2022-09-19 op
1904 bff58270 2022-09-19 op if (block == '!') {
1905 bff58270 2022-09-19 op do {
1906 bff58270 2022-09-19 op if (ending) {
1907 bff58270 2022-09-19 op if (c == '}') {
1908 bff58270 2022-09-19 op lungetc(c);
1909 bff58270 2022-09-19 op lungetc(block);
1910 bff58270 2022-09-19 op break;
1911 bff58270 2022-09-19 op }
1912 bff58270 2022-09-19 op ending = 0;
1913 bff58270 2022-09-19 op lungetc(c);
1914 bff58270 2022-09-19 op c = block;
1915 bff58270 2022-09-19 op } else if (c == '!') {
1916 bff58270 2022-09-19 op ending = 1;
1917 bff58270 2022-09-19 op continue;
1918 bff58270 2022-09-19 op }
1919 bff58270 2022-09-19 op
1920 bff58270 2022-09-19 op *p++ = c;
1921 bff58270 2022-09-19 op if ((size_t)(p - buf) >= sizeof(buf)) {
1922 bff58270 2022-09-19 op yyerror("line too long");
1923 bff58270 2022-09-19 op return (findeol());
1924 bff58270 2022-09-19 op }
1925 bff58270 2022-09-19 op } while ((c = lgetc(0)) != EOF && c != '\n');
1926 bff58270 2022-09-19 op *p = '\0';
1927 bff58270 2022-09-19 op
1928 bff58270 2022-09-19 op if (c == EOF) {
1929 bff58270 2022-09-19 op yyerror("unterminated block");
1930 bff58270 2022-09-19 op return (0);
1931 bff58270 2022-09-19 op }
1932 bff58270 2022-09-19 op if (c == '\n')
1933 bff58270 2022-09-19 op file->lineno++;
1934 bff58270 2022-09-19 op
1935 bff58270 2022-09-19 op if ((yylval.v.string = strdup(buf)) == NULL)
1936 bff58270 2022-09-19 op err(1, "strdup");
1937 bff58270 2022-09-19 op return (STRING);
1938 bff58270 2022-09-19 op }
1939 bff58270 2022-09-19 op
1940 bff58270 2022-09-19 op do {
1941 bff58270 2022-09-19 op if (ending) {
1942 bff58270 2022-09-19 op if (c == '}') {
1943 bff58270 2022-09-19 op lungetc(c);
1944 bff58270 2022-09-19 op lungetc('}');
1945 bff58270 2022-09-19 op break;
1946 bff58270 2022-09-19 op }
1947 bff58270 2022-09-19 op ending = 0;
1948 bff58270 2022-09-19 op lungetc(c);
1949 bff58270 2022-09-19 op c = block;
1950 bff58270 2022-09-19 op } else if (c == '}') {
1951 bff58270 2022-09-19 op ending = 1;
1952 bff58270 2022-09-19 op continue;
1953 bff58270 2022-09-19 op }
1954 bff58270 2022-09-19 op
1955 bff58270 2022-09-19 op *p++ = c;
1956 bff58270 2022-09-19 op if ((size_t)(p - buf) >= sizeof(buf)) {
1957 bff58270 2022-09-19 op yyerror("string too long");
1958 bff58270 2022-09-19 op return (findeol());
1959 bff58270 2022-09-19 op }
1960 bff58270 2022-09-19 op } while ((c = lgetc(0)) != EOF && !isspace((unsigned char)c));
1961 bff58270 2022-09-19 op *p = '\0';
1962 bff58270 2022-09-19 op
1963 bff58270 2022-09-19 op if (c == EOF) {
1964 bff58270 2022-09-19 op yyerror("unterminated block");
1965 bff58270 2022-09-19 op return (0);
1966 bff58270 2022-09-19 op }
1967 bff58270 2022-09-19 op if (c == '\n')
1968 bff58270 2022-09-19 op file->lineno++;
1969 bff58270 2022-09-19 op if ((token = lookup(buf)) == STRING)
1970 bff58270 2022-09-19 op if ((yylval.v.string = strdup(buf)) == NULL)
1971 bff58270 2022-09-19 op err(1, "strdup");
1972 bff58270 2022-09-19 op return (token);
1973 bff58270 2022-09-19 op }
1974 bff58270 2022-09-19 op
1975 bff58270 2022-09-19 op struct file *
1976 bff58270 2022-09-19 op pushfile(const char *name, int secret)
1977 bff58270 2022-09-19 op {
1978 bff58270 2022-09-19 op struct file *nfile;
1979 bff58270 2022-09-19 op
1980 bff58270 2022-09-19 op if ((nfile = calloc(1, sizeof(*nfile))) == NULL)
1981 bff58270 2022-09-19 op err(1, "calloc");
1982 bff58270 2022-09-19 op if ((nfile->name = strdup(name)) == NULL)
1983 bff58270 2022-09-19 op err(1, "strdup");
1984 bff58270 2022-09-19 op if ((nfile->stream = fopen(nfile->name, "r")) == NULL) {
1985 bff58270 2022-09-19 op warn("can't open %s", nfile->name);
1986 bff58270 2022-09-19 op free(nfile->name);
1987 bff58270 2022-09-19 op free(nfile);
1988 bff58270 2022-09-19 op return (NULL);
1989 bff58270 2022-09-19 op }
1990 bff58270 2022-09-19 op nfile->lineno = TAILQ_EMPTY(&files) ? 1 : 0;
1991 bff58270 2022-09-19 op nfile->ungetsize = 16;
1992 bff58270 2022-09-19 op nfile->ungetbuf = malloc(nfile->ungetsize);
1993 bff58270 2022-09-19 op if (nfile->ungetbuf == NULL)
1994 bff58270 2022-09-19 op err(1, "malloc");
1995 bff58270 2022-09-19 op TAILQ_INSERT_TAIL(&files, nfile, entry);
1996 bff58270 2022-09-19 op return (nfile);
1997 bff58270 2022-09-19 op }
1998 bff58270 2022-09-19 op
1999 bff58270 2022-09-19 op int
2000 bff58270 2022-09-19 op popfile(void)
2001 bff58270 2022-09-19 op {
2002 bff58270 2022-09-19 op struct file *prev;
2003 bff58270 2022-09-19 op
2004 bff58270 2022-09-19 op if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
2005 bff58270 2022-09-19 op prev->errors += file->errors;
2006 bff58270 2022-09-19 op
2007 bff58270 2022-09-19 op TAILQ_REMOVE(&files, file, entry);
2008 bff58270 2022-09-19 op fclose(file->stream);
2009 bff58270 2022-09-19 op free(file->name);
2010 bff58270 2022-09-19 op free(file->ungetbuf);
2011 bff58270 2022-09-19 op free(file);
2012 bff58270 2022-09-19 op file = prev;
2013 bff58270 2022-09-19 op return (file ? 0 : EOF);
2014 bff58270 2022-09-19 op }
2015 bff58270 2022-09-19 op
2016 bff58270 2022-09-19 op int
2017 bff58270 2022-09-19 op parse(const char *filename)
2018 bff58270 2022-09-19 op {
2019 bff58270 2022-09-19 op if ((file = pushfile(filename, 0)) == 0)
2020 bff58270 2022-09-19 op return (-1);
2021 bff58270 2022-09-19 op topfile = file;
2022 bff58270 2022-09-19 op
2023 bff58270 2022-09-19 op yyparse();
2024 bff58270 2022-09-19 op errors = file->errors;
2025 bff58270 2022-09-19 op popfile();
2026 bff58270 2022-09-19 op
2027 bff58270 2022-09-19 op return (errors ? -1 : 0);
2028 bff58270 2022-09-19 op }
2029 bff58270 2022-09-19 op
2030 bff58270 2022-09-19 op void
2031 bff58270 2022-09-19 op dbg(void)
2032 bff58270 2022-09-19 op {
2033 bff58270 2022-09-19 op if (nodebug)
2034 bff58270 2022-09-19 op return;
2035 bff58270 2022-09-19 op
2036 bff58270 2022-09-19 op printf("#line %d ", yylval.lineno);
2037 bff58270 2022-09-19 op printq(file->name);
2038 bff58270 2022-09-19 op putchar('\n');
2039 bff58270 2022-09-19 op }
2040 bff58270 2022-09-19 op
2041 bff58270 2022-09-19 op void
2042 bff58270 2022-09-19 op printq(const char *str)
2043 bff58270 2022-09-19 op {
2044 bff58270 2022-09-19 op putchar('"');
2045 bff58270 2022-09-19 op for (; *str; ++str) {
2046 bff58270 2022-09-19 op if (*str == '"')
2047 bff58270 2022-09-19 op putchar('\\');
2048 bff58270 2022-09-19 op putchar(*str);
2049 bff58270 2022-09-19 op }
2050 bff58270 2022-09-19 op putchar('"');
2051 bff58270 2022-09-19 op }