Coverage Report

Created: 2025-11-24 06:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/jq/src/parser.c
Line
Count
Source
1
/* A Bison parser, made by GNU Bison 3.8.2.  */
2
3
/* Bison implementation for Yacc-like parsers in C
4
5
   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6
   Inc.
7
8
   This program is free software: you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
10
   the Free Software Foundation, either version 3 of the License, or
11
   (at your option) any later version.
12
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
18
   You should have received a copy of the GNU General Public License
19
   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
20
21
/* As a special exception, you may create a larger work that contains
22
   part or all of the Bison parser skeleton and distribute that work
23
   under terms of your choice, so long as that work isn't itself a
24
   parser generator using the skeleton or a modified version thereof
25
   as a parser skeleton.  Alternatively, if you modify or redistribute
26
   the parser skeleton itself, you may (at your option) remove this
27
   special exception, which will cause the skeleton and the resulting
28
   Bison output files to be licensed under the GNU General Public
29
   License without this special exception.
30
31
   This special exception was added by the Free Software Foundation in
32
   version 2.2 of Bison.  */
33
34
/* C LALR(1) parser skeleton written by Richard Stallman, by
35
   simplifying the original so-called "semantic" parser.  */
36
37
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38
   especially those whose name start with YY_ or yy_.  They are
39
   private implementation details that can be changed or removed.  */
40
41
/* All symbols defined below should begin with yy or YY, to avoid
42
   infringing on user name space.  This should be done even for local
43
   variables, as they might otherwise be expanded by user macros.
44
   There are some unavoidable exceptions within include files to
45
   define necessary library symbols; they are noted "INFRINGES ON
46
   USER NAME SPACE" below.  */
47
48
/* Identify Bison output, and Bison version.  */
49
#define YYBISON 30802
50
51
/* Bison version string.  */
52
#define YYBISON_VERSION "3.8.2"
53
54
/* Skeleton name.  */
55
#define YYSKELETON_NAME "yacc.c"
56
57
/* Pure parsers.  */
58
#define YYPURE 1
59
60
/* Push parsers.  */
61
#define YYPUSH 0
62
63
/* Pull parsers.  */
64
#define YYPULL 1
65
66
67
68
69
/* First part of user prologue.  */
70
#line 1 "src/parser.y"
71
72
#include <assert.h>
73
#include <math.h>
74
#include <stdio.h>
75
#include <string.h>
76
#include "compile.h"
77
#include "jv_alloc.h"
78
#include "builtin.h"
79
#define YYMALLOC jv_mem_alloc
80
0
#define YYFREE jv_mem_free
81
82
#line 83 "src/parser.c"
83
84
# ifndef YY_CAST
85
#  ifdef __cplusplus
86
#   define YY_CAST(Type, Val) static_cast<Type> (Val)
87
#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
88
#  else
89
0
#   define YY_CAST(Type, Val) ((Type) (Val))
90
#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
91
#  endif
92
# endif
93
# ifndef YY_NULLPTR
94
#  if defined __cplusplus
95
#   if 201103L <= __cplusplus
96
#    define YY_NULLPTR nullptr
97
#   else
98
#    define YY_NULLPTR 0
99
#   endif
100
#  else
101
0
#   define YY_NULLPTR ((void*)0)
102
#  endif
103
# endif
104
105
/* Use api.header.include to #include this header
106
   instead of duplicating it here.  */
107
#ifndef YY_YY_SRC_PARSER_H_INCLUDED
108
# define YY_YY_SRC_PARSER_H_INCLUDED
109
/* Debug traces.  */
110
#ifndef YYDEBUG
111
# define YYDEBUG 0
112
#endif
113
#if YYDEBUG
114
extern int yydebug;
115
#endif
116
/* "%code requires" blocks.  */
117
#line 12 "src/parser.y"
118
119
#include "locfile.h"
120
struct lexer_param;
121
122
0
#define YYLTYPE location
123
#define YYLLOC_DEFAULT(Loc, Rhs, N)             \
124
0
  do {                                          \
125
0
    if (N) {                                    \
126
0
      (Loc).start = YYRHSLOC(Rhs, 1).start;     \
127
0
      (Loc).end = YYRHSLOC(Rhs, N).end;         \
128
0
    } else {                                    \
129
0
      (Loc).start = YYRHSLOC(Rhs, 0).end;       \
130
0
      (Loc).end = YYRHSLOC(Rhs, 0).end;         \
131
0
    }                                           \
132
0
  } while (0)
133
134
#line 135 "src/parser.c"
135
136
/* Token kinds.  */
137
#ifndef YYTOKENTYPE
138
# define YYTOKENTYPE
139
  enum yytokentype
140
  {
141
    YYEMPTY = -2,
142
    YYEOF = 0,                     /* "end of file"  */
143
    YYerror = 256,                 /* error  */
144
    YYUNDEF = 257,                 /* "invalid token"  */
145
    INVALID_CHARACTER = 258,       /* INVALID_CHARACTER  */
146
    IDENT = 259,                   /* IDENT  */
147
    FIELD = 260,                   /* FIELD  */
148
    BINDING = 261,                 /* BINDING  */
149
    LITERAL = 262,                 /* LITERAL  */
150
    FORMAT = 263,                  /* FORMAT  */
151
    REC = 264,                     /* ".."  */
152
    SETMOD = 265,                  /* "%="  */
153
    EQ = 266,                      /* "=="  */
154
    NEQ = 267,                     /* "!="  */
155
    DEFINEDOR = 268,               /* "//"  */
156
    AS = 269,                      /* "as"  */
157
    DEF = 270,                     /* "def"  */
158
    MODULE = 271,                  /* "module"  */
159
    IMPORT = 272,                  /* "import"  */
160
    INCLUDE = 273,                 /* "include"  */
161
    IF = 274,                      /* "if"  */
162
    THEN = 275,                    /* "then"  */
163
    ELSE = 276,                    /* "else"  */
164
    ELSE_IF = 277,                 /* "elif"  */
165
    REDUCE = 278,                  /* "reduce"  */
166
    FOREACH = 279,                 /* "foreach"  */
167
    END = 280,                     /* "end"  */
168
    AND = 281,                     /* "and"  */
169
    OR = 282,                      /* "or"  */
170
    TRY = 283,                     /* "try"  */
171
    CATCH = 284,                   /* "catch"  */
172
    LABEL = 285,                   /* "label"  */
173
    BREAK = 286,                   /* "break"  */
174
    LOC = 287,                     /* "$__loc__"  */
175
    SETPIPE = 288,                 /* "|="  */
176
    SETPLUS = 289,                 /* "+="  */
177
    SETMINUS = 290,                /* "-="  */
178
    SETMULT = 291,                 /* "*="  */
179
    SETDIV = 292,                  /* "/="  */
180
    SETDEFINEDOR = 293,            /* "//="  */
181
    LESSEQ = 294,                  /* "<="  */
182
    GREATEREQ = 295,               /* ">="  */
183
    ALTERNATION = 296,             /* "?//"  */
184
    QQSTRING_START = 297,          /* QQSTRING_START  */
185
    QQSTRING_TEXT = 298,           /* QQSTRING_TEXT  */
186
    QQSTRING_INTERP_START = 299,   /* QQSTRING_INTERP_START  */
187
    QQSTRING_INTERP_END = 300,     /* QQSTRING_INTERP_END  */
188
    QQSTRING_END = 301,            /* QQSTRING_END  */
189
    FUNCDEF = 302,                 /* FUNCDEF  */
190
    NONOPT = 303                   /* NONOPT  */
191
  };
192
  typedef enum yytokentype yytoken_kind_t;
193
#endif
194
/* Token kinds.  */
195
0
#define YYEMPTY -2
196
0
#define YYEOF 0
197
0
#define YYerror 256
198
0
#define YYUNDEF 257
199
#define INVALID_CHARACTER 258
200
#define IDENT 259
201
#define FIELD 260
202
#define BINDING 261
203
0
#define LITERAL 262
204
#define FORMAT 263
205
#define REC 264
206
#define SETMOD 265
207
0
#define EQ 266
208
0
#define NEQ 267
209
#define DEFINEDOR 268
210
#define AS 269
211
#define DEF 270
212
#define MODULE 271
213
#define IMPORT 272
214
#define INCLUDE 273
215
#define IF 274
216
#define THEN 275
217
#define ELSE 276
218
#define ELSE_IF 277
219
#define REDUCE 278
220
#define FOREACH 279
221
#define END 280
222
#define AND 281
223
#define OR 282
224
#define TRY 283
225
#define CATCH 284
226
#define LABEL 285
227
#define BREAK 286
228
#define LOC 287
229
#define SETPIPE 288
230
#define SETPLUS 289
231
#define SETMINUS 290
232
#define SETMULT 291
233
#define SETDIV 292
234
#define SETDEFINEDOR 293
235
0
#define LESSEQ 294
236
0
#define GREATEREQ 295
237
#define ALTERNATION 296
238
#define QQSTRING_START 297
239
0
#define QQSTRING_TEXT 298
240
#define QQSTRING_INTERP_START 299
241
#define QQSTRING_INTERP_END 300
242
#define QQSTRING_END 301
243
#define FUNCDEF 302
244
#define NONOPT 303
245
246
/* Value type.  */
247
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
248
union YYSTYPE
249
{
250
#line 32 "src/parser.y"
251
252
  jv literal;
253
  block blk;
254
255
#line 256 "src/parser.c"
256
257
};
258
typedef union YYSTYPE YYSTYPE;
259
# define YYSTYPE_IS_TRIVIAL 1
260
# define YYSTYPE_IS_DECLARED 1
261
#endif
262
263
/* Location type.  */
264
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
265
typedef struct YYLTYPE YYLTYPE;
266
struct YYLTYPE
267
{
268
  int first_line;
269
  int first_column;
270
  int last_line;
271
  int last_column;
272
};
273
# define YYLTYPE_IS_DECLARED 1
274
# define YYLTYPE_IS_TRIVIAL 1
275
#endif
276
277
278
279
280
int yyparse (block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr);
281
282
283
#endif /* !YY_YY_SRC_PARSER_H_INCLUDED  */
284
/* Symbol kind.  */
285
enum yysymbol_kind_t
286
{
287
  YYSYMBOL_YYEMPTY = -2,
288
  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
289
  YYSYMBOL_YYerror = 1,                    /* error  */
290
  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
291
  YYSYMBOL_INVALID_CHARACTER = 3,          /* INVALID_CHARACTER  */
292
  YYSYMBOL_IDENT = 4,                      /* IDENT  */
293
  YYSYMBOL_FIELD = 5,                      /* FIELD  */
294
  YYSYMBOL_BINDING = 6,                    /* BINDING  */
295
  YYSYMBOL_LITERAL = 7,                    /* LITERAL  */
296
  YYSYMBOL_FORMAT = 8,                     /* FORMAT  */
297
  YYSYMBOL_REC = 9,                        /* ".."  */
298
  YYSYMBOL_SETMOD = 10,                    /* "%="  */
299
  YYSYMBOL_EQ = 11,                        /* "=="  */
300
  YYSYMBOL_NEQ = 12,                       /* "!="  */
301
  YYSYMBOL_DEFINEDOR = 13,                 /* "//"  */
302
  YYSYMBOL_AS = 14,                        /* "as"  */
303
  YYSYMBOL_DEF = 15,                       /* "def"  */
304
  YYSYMBOL_MODULE = 16,                    /* "module"  */
305
  YYSYMBOL_IMPORT = 17,                    /* "import"  */
306
  YYSYMBOL_INCLUDE = 18,                   /* "include"  */
307
  YYSYMBOL_IF = 19,                        /* "if"  */
308
  YYSYMBOL_THEN = 20,                      /* "then"  */
309
  YYSYMBOL_ELSE = 21,                      /* "else"  */
310
  YYSYMBOL_ELSE_IF = 22,                   /* "elif"  */
311
  YYSYMBOL_REDUCE = 23,                    /* "reduce"  */
312
  YYSYMBOL_FOREACH = 24,                   /* "foreach"  */
313
  YYSYMBOL_END = 25,                       /* "end"  */
314
  YYSYMBOL_AND = 26,                       /* "and"  */
315
  YYSYMBOL_OR = 27,                        /* "or"  */
316
  YYSYMBOL_TRY = 28,                       /* "try"  */
317
  YYSYMBOL_CATCH = 29,                     /* "catch"  */
318
  YYSYMBOL_LABEL = 30,                     /* "label"  */
319
  YYSYMBOL_BREAK = 31,                     /* "break"  */
320
  YYSYMBOL_LOC = 32,                       /* "$__loc__"  */
321
  YYSYMBOL_SETPIPE = 33,                   /* "|="  */
322
  YYSYMBOL_SETPLUS = 34,                   /* "+="  */
323
  YYSYMBOL_SETMINUS = 35,                  /* "-="  */
324
  YYSYMBOL_SETMULT = 36,                   /* "*="  */
325
  YYSYMBOL_SETDIV = 37,                    /* "/="  */
326
  YYSYMBOL_SETDEFINEDOR = 38,              /* "//="  */
327
  YYSYMBOL_LESSEQ = 39,                    /* "<="  */
328
  YYSYMBOL_GREATEREQ = 40,                 /* ">="  */
329
  YYSYMBOL_ALTERNATION = 41,               /* "?//"  */
330
  YYSYMBOL_QQSTRING_START = 42,            /* QQSTRING_START  */
331
  YYSYMBOL_QQSTRING_TEXT = 43,             /* QQSTRING_TEXT  */
332
  YYSYMBOL_QQSTRING_INTERP_START = 44,     /* QQSTRING_INTERP_START  */
333
  YYSYMBOL_QQSTRING_INTERP_END = 45,       /* QQSTRING_INTERP_END  */
334
  YYSYMBOL_QQSTRING_END = 46,              /* QQSTRING_END  */
335
  YYSYMBOL_FUNCDEF = 47,                   /* FUNCDEF  */
336
  YYSYMBOL_48_ = 48,                       /* '|'  */
337
  YYSYMBOL_49_ = 49,                       /* ','  */
338
  YYSYMBOL_50_ = 50,                       /* '='  */
339
  YYSYMBOL_51_ = 51,                       /* '<'  */
340
  YYSYMBOL_52_ = 52,                       /* '>'  */
341
  YYSYMBOL_53_ = 53,                       /* '+'  */
342
  YYSYMBOL_54_ = 54,                       /* '-'  */
343
  YYSYMBOL_55_ = 55,                       /* '*'  */
344
  YYSYMBOL_56_ = 56,                       /* '/'  */
345
  YYSYMBOL_57_ = 57,                       /* '%'  */
346
  YYSYMBOL_NONOPT = 58,                    /* NONOPT  */
347
  YYSYMBOL_59_ = 59,                       /* '?'  */
348
  YYSYMBOL_60_ = 60,                       /* '.'  */
349
  YYSYMBOL_61_ = 61,                       /* '['  */
350
  YYSYMBOL_62_ = 62,                       /* ';'  */
351
  YYSYMBOL_63_ = 63,                       /* ':'  */
352
  YYSYMBOL_64_ = 64,                       /* '('  */
353
  YYSYMBOL_65_ = 65,                       /* ')'  */
354
  YYSYMBOL_66_ = 66,                       /* ']'  */
355
  YYSYMBOL_67_ = 67,                       /* '{'  */
356
  YYSYMBOL_68_ = 68,                       /* '}'  */
357
  YYSYMBOL_69_ = 69,                       /* '$'  */
358
  YYSYMBOL_YYACCEPT = 70,                  /* $accept  */
359
  YYSYMBOL_TopLevel = 71,                  /* TopLevel  */
360
  YYSYMBOL_Module = 72,                    /* Module  */
361
  YYSYMBOL_Imports = 73,                   /* Imports  */
362
  YYSYMBOL_FuncDefs = 74,                  /* FuncDefs  */
363
  YYSYMBOL_Query = 75,                     /* Query  */
364
  YYSYMBOL_Expr = 76,                      /* Expr  */
365
  YYSYMBOL_Import = 77,                    /* Import  */
366
  YYSYMBOL_ImportWhat = 78,                /* ImportWhat  */
367
  YYSYMBOL_ImportFrom = 79,                /* ImportFrom  */
368
  YYSYMBOL_FuncDef = 80,                   /* FuncDef  */
369
  YYSYMBOL_Params = 81,                    /* Params  */
370
  YYSYMBOL_Param = 82,                     /* Param  */
371
  YYSYMBOL_StringStart = 83,               /* StringStart  */
372
  YYSYMBOL_String = 84,                    /* String  */
373
  YYSYMBOL_QQString = 85,                  /* QQString  */
374
  YYSYMBOL_ElseBody = 86,                  /* ElseBody  */
375
  YYSYMBOL_Term = 87,                      /* Term  */
376
  YYSYMBOL_Args = 88,                      /* Args  */
377
  YYSYMBOL_Arg = 89,                       /* Arg  */
378
  YYSYMBOL_RepPatterns = 90,               /* RepPatterns  */
379
  YYSYMBOL_Patterns = 91,                  /* Patterns  */
380
  YYSYMBOL_Pattern = 92,                   /* Pattern  */
381
  YYSYMBOL_ArrayPats = 93,                 /* ArrayPats  */
382
  YYSYMBOL_ObjPats = 94,                   /* ObjPats  */
383
  YYSYMBOL_ObjPat = 95,                    /* ObjPat  */
384
  YYSYMBOL_Keyword = 96,                   /* Keyword  */
385
  YYSYMBOL_DictPairs = 97,                 /* DictPairs  */
386
  YYSYMBOL_DictPair = 98,                  /* DictPair  */
387
  YYSYMBOL_DictExpr = 99                   /* DictExpr  */
388
};
389
typedef enum yysymbol_kind_t yysymbol_kind_t;
390
391
392
/* Second part of user prologue.  */
393
#line 127 "src/parser.y"
394
395
#include "lexer.h"
396
struct lexer_param {
397
  yyscan_t lexer;
398
};
399
#define FAIL(loc, msg)                                             \
400
0
  do {                                                             \
401
0
    location l = loc;                                              \
402
0
    yyerror(&l, answer, errors, locations, lexer_param_ptr, msg);  \
403
0
    /*YYERROR*/;                                                   \
404
0
  } while (0)
405
406
void yyerror(YYLTYPE* loc, block* answer, int* errors,
407
0
             struct locfile* locations, struct lexer_param* lexer_param_ptr, const char *s){
408
0
  (*errors)++;
409
0
  locfile_locate(locations, *loc, "jq: error: %s", s);
410
0
}
411
412
int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, block* answer, int* errors,
413
0
          struct locfile* locations, struct lexer_param* lexer_param_ptr) {
414
0
  yyscan_t lexer = lexer_param_ptr->lexer;
415
0
  int tok = jq_yylex(yylval, yylloc, lexer);
416
0
  if ((tok == LITERAL || tok == QQSTRING_TEXT) && !jv_is_valid(yylval->literal)) {
417
0
    jv msg = jv_invalid_get_msg(jv_copy(yylval->literal));
418
0
    if (jv_get_kind(msg) == JV_KIND_STRING) {
419
0
      FAIL(*yylloc, jv_string_value(msg));
420
0
    } else {
421
0
      FAIL(*yylloc, "Invalid literal");
422
0
    }
423
0
    jv_free(msg);
424
0
    jv_free(yylval->literal);
425
0
    yylval->literal = jv_null();
426
0
  }
427
0
  return tok;
428
0
}
429
430
/* Returns string message if the block is a constant that is not valid as an
431
 * object key. */
432
0
static jv check_object_key(block k) {
433
0
  if (block_is_const(k) && block_const_kind(k) != JV_KIND_STRING) {
434
0
    char errbuf[15];
435
0
    return jv_string_fmt("Cannot use %s (%s) as object key",
436
0
        jv_kind_name(block_const_kind(k)),
437
0
        jv_dump_string_trunc(block_const(k), errbuf, sizeof(errbuf)));
438
0
  }
439
0
  return jv_invalid();
440
0
}
441
442
0
static block gen_index(block obj, block key) {
443
0
  return BLOCK(gen_subexp(key), obj, gen_op_simple(INDEX));
444
0
}
445
446
0
static block gen_index_opt(block obj, block key) {
447
0
  return BLOCK(gen_subexp(key), obj, gen_op_simple(INDEX_OPT));
448
0
}
449
450
0
static block gen_slice_index(block obj, block start, block end, opcode idx_op) {
451
0
  block key = BLOCK(gen_subexp(gen_const(jv_object())),
452
0
                    gen_subexp(gen_const(jv_string("start"))),
453
0
                    gen_subexp(start),
454
0
                    gen_op_simple(INSERT),
455
0
                    gen_subexp(gen_const(jv_string("end"))),
456
0
                    gen_subexp(end),
457
0
                    gen_op_simple(INSERT));
458
0
  return BLOCK(key, obj, gen_op_simple(idx_op));
459
0
}
460
461
0
static block constant_fold(block a, block b, int op) {
462
0
  if (!block_is_single(a) || !block_is_const(a) ||
463
0
      !block_is_single(b) || !block_is_const(b))
464
0
    return gen_noop();
465
466
0
  jv jv_a = block_const(a);
467
0
  block_free(a);
468
0
  jv jv_b = block_const(b);
469
0
  block_free(b);
470
471
0
  jv res = jv_invalid();
472
0
  switch (op) {
473
0
  case '+': res = binop_plus(jv_a, jv_b); break;
474
0
  case '-': res = binop_minus(jv_a, jv_b); break;
475
0
  case '*': res = binop_multiply(jv_a, jv_b); break;
476
0
  case '/': res = binop_divide(jv_a, jv_b); break;
477
0
  case '%': res = binop_mod(jv_a, jv_b); break;
478
0
  case EQ: res = binop_equal(jv_a, jv_b); break;
479
0
  case NEQ: res = binop_notequal(jv_a, jv_b); break;
480
0
  case '<': res = binop_less(jv_a, jv_b); break;
481
0
  case '>': res = binop_greater(jv_a, jv_b); break;
482
0
  case LESSEQ: res = binop_lesseq(jv_a, jv_b); break;
483
0
  case GREATEREQ: res = binop_greatereq(jv_a, jv_b); break;
484
0
  }
485
486
0
  if (jv_is_valid(res))
487
0
    return gen_const(res);
488
489
0
  return gen_error(jv_invalid_get_msg(res));
490
0
}
491
492
0
static block gen_binop(block a, block b, int op) {
493
0
  block folded = constant_fold(a, b, op);
494
0
  if (!block_is_noop(folded))
495
0
    return folded;
496
497
0
  const char* funcname = 0;
498
0
  switch (op) {
499
0
  case '+': funcname = "_plus"; break;
500
0
  case '-': funcname = "_minus"; break;
501
0
  case '*': funcname = "_multiply"; break;
502
0
  case '/': funcname = "_divide"; break;
503
0
  case '%': funcname = "_mod"; break;
504
0
  case EQ: funcname = "_equal"; break;
505
0
  case NEQ: funcname = "_notequal"; break;
506
0
  case '<': funcname = "_less"; break;
507
0
  case '>': funcname = "_greater"; break;
508
0
  case LESSEQ: funcname = "_lesseq"; break;
509
0
  case GREATEREQ: funcname = "_greatereq"; break;
510
0
  }
511
0
  assert(funcname);
512
513
0
  return gen_call(funcname, BLOCK(gen_lambda(a), gen_lambda(b)));
514
0
}
515
516
0
static block gen_format(block a, jv fmt) {
517
0
  return BLOCK(a, gen_call("format", gen_lambda(gen_const(fmt))));
518
0
}
519
520
0
static block gen_definedor_assign(block object, block val) {
521
0
  block tmp = gen_op_var_fresh(STOREV, "tmp");
522
0
  return BLOCK(gen_op_simple(DUP),
523
0
               val, tmp,
524
0
               gen_call("_modify", BLOCK(gen_lambda(object),
525
0
                                         gen_lambda(gen_definedor(gen_noop(),
526
0
                                                                  gen_op_bound(LOADV, tmp))))));
527
0
}
528
529
0
static block gen_update(block object, block val, int optype) {
530
0
  block tmp = gen_op_var_fresh(STOREV, "tmp");
531
0
  return BLOCK(gen_op_simple(DUP),
532
0
               val,
533
0
               tmp,
534
0
               gen_call("_modify", BLOCK(gen_lambda(object),
535
0
                                         gen_lambda(gen_binop(gen_noop(),
536
0
                                                              gen_op_bound(LOADV, tmp),
537
0
                                                              optype)))));
538
0
}
539
540
0
static block gen_loc_object(location *loc, struct locfile *locations) {
541
0
  return gen_const(JV_OBJECT(jv_string("file"), jv_copy(locations->fname),
542
0
                             jv_string("line"), jv_number(locfile_get_line(locations, loc->start) + 1)));
543
0
}
544
545
546
#line 547 "src/parser.c"
547
548
549
#ifdef short
550
# undef short
551
#endif
552
553
/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
554
   <limits.h> and (if available) <stdint.h> are included
555
   so that the code can choose integer types of a good width.  */
556
557
#ifndef __PTRDIFF_MAX__
558
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
559
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
560
#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
561
#  define YY_STDINT_H
562
# endif
563
#endif
564
565
/* Narrow types that promote to a signed type and that can represent a
566
   signed or unsigned integer of at least N bits.  In tables they can
567
   save space and decrease cache pressure.  Promoting to a signed type
568
   helps avoid bugs in integer arithmetic.  */
569
570
#ifdef __INT_LEAST8_MAX__
571
typedef __INT_LEAST8_TYPE__ yytype_int8;
572
#elif defined YY_STDINT_H
573
typedef int_least8_t yytype_int8;
574
#else
575
typedef signed char yytype_int8;
576
#endif
577
578
#ifdef __INT_LEAST16_MAX__
579
typedef __INT_LEAST16_TYPE__ yytype_int16;
580
#elif defined YY_STDINT_H
581
typedef int_least16_t yytype_int16;
582
#else
583
typedef short yytype_int16;
584
#endif
585
586
/* Work around bug in HP-UX 11.23, which defines these macros
587
   incorrectly for preprocessor constants.  This workaround can likely
588
   be removed in 2023, as HPE has promised support for HP-UX 11.23
589
   (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
590
   <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
591
#ifdef __hpux
592
# undef UINT_LEAST8_MAX
593
# undef UINT_LEAST16_MAX
594
# define UINT_LEAST8_MAX 255
595
# define UINT_LEAST16_MAX 65535
596
#endif
597
598
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
599
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
600
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
601
       && UINT_LEAST8_MAX <= INT_MAX)
602
typedef uint_least8_t yytype_uint8;
603
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
604
typedef unsigned char yytype_uint8;
605
#else
606
typedef short yytype_uint8;
607
#endif
608
609
#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
610
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
611
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
612
       && UINT_LEAST16_MAX <= INT_MAX)
613
typedef uint_least16_t yytype_uint16;
614
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
615
typedef unsigned short yytype_uint16;
616
#else
617
typedef int yytype_uint16;
618
#endif
619
620
#ifndef YYPTRDIFF_T
621
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
622
0
#  define YYPTRDIFF_T __PTRDIFF_TYPE__
623
#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
624
# elif defined PTRDIFF_MAX
625
#  ifndef ptrdiff_t
626
#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
627
#  endif
628
#  define YYPTRDIFF_T ptrdiff_t
629
#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
630
# else
631
#  define YYPTRDIFF_T long
632
#  define YYPTRDIFF_MAXIMUM LONG_MAX
633
# endif
634
#endif
635
636
#ifndef YYSIZE_T
637
# ifdef __SIZE_TYPE__
638
#  define YYSIZE_T __SIZE_TYPE__
639
# elif defined size_t
640
#  define YYSIZE_T size_t
641
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
642
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
643
#  define YYSIZE_T size_t
644
# else
645
#  define YYSIZE_T unsigned
646
# endif
647
#endif
648
649
#define YYSIZE_MAXIMUM                                  \
650
0
  YY_CAST (YYPTRDIFF_T,                                 \
651
           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
652
            ? YYPTRDIFF_MAXIMUM                         \
653
            : YY_CAST (YYSIZE_T, -1)))
654
655
0
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
656
657
658
/* Stored state numbers (used for stacks). */
659
typedef yytype_int16 yy_state_t;
660
661
/* State numbers in computations.  */
662
typedef int yy_state_fast_t;
663
664
#ifndef YY_
665
# if defined YYENABLE_NLS && YYENABLE_NLS
666
#  if ENABLE_NLS
667
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
668
#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
669
#  endif
670
# endif
671
# ifndef YY_
672
0
#  define YY_(Msgid) Msgid
673
# endif
674
#endif
675
676
677
#ifndef YY_ATTRIBUTE_PURE
678
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
679
#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
680
# else
681
#  define YY_ATTRIBUTE_PURE
682
# endif
683
#endif
684
685
#ifndef YY_ATTRIBUTE_UNUSED
686
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
687
#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
688
# else
689
#  define YY_ATTRIBUTE_UNUSED
690
# endif
691
#endif
692
693
/* Suppress unused-variable warnings by "using" E.  */
694
#if ! defined lint || defined __GNUC__
695
0
# define YY_USE(E) ((void) (E))
696
#else
697
# define YY_USE(E) /* empty */
698
#endif
699
700
/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
701
#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
702
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
703
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
704
    _Pragma ("GCC diagnostic push")                                     \
705
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
706
# else
707
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
708
    _Pragma ("GCC diagnostic push")                                     \
709
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
710
    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
711
# endif
712
# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
713
    _Pragma ("GCC diagnostic pop")
714
#else
715
0
# define YY_INITIAL_VALUE(Value) Value
716
#endif
717
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
718
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
719
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
720
#endif
721
#ifndef YY_INITIAL_VALUE
722
# define YY_INITIAL_VALUE(Value) /* Nothing. */
723
#endif
724
725
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
726
# define YY_IGNORE_USELESS_CAST_BEGIN                          \
727
    _Pragma ("GCC diagnostic push")                            \
728
    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
729
# define YY_IGNORE_USELESS_CAST_END            \
730
    _Pragma ("GCC diagnostic pop")
731
#endif
732
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
733
# define YY_IGNORE_USELESS_CAST_BEGIN
734
# define YY_IGNORE_USELESS_CAST_END
735
#endif
736
737
738
0
#define YY_ASSERT(E) ((void) (0 && (E)))
739
740
#if 1
741
742
/* The parser invokes alloca or malloc; define the necessary symbols.  */
743
744
# ifdef YYSTACK_USE_ALLOCA
745
#  if YYSTACK_USE_ALLOCA
746
#   ifdef __GNUC__
747
#    define YYSTACK_ALLOC __builtin_alloca
748
#   elif defined __BUILTIN_VA_ARG_INCR
749
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
750
#   elif defined _AIX
751
#    define YYSTACK_ALLOC __alloca
752
#   elif defined _MSC_VER
753
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
754
#    define alloca _alloca
755
#   else
756
#    define YYSTACK_ALLOC alloca
757
#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
758
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
759
      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
760
#     ifndef EXIT_SUCCESS
761
#      define EXIT_SUCCESS 0
762
#     endif
763
#    endif
764
#   endif
765
#  endif
766
# endif
767
768
# ifdef YYSTACK_ALLOC
769
   /* Pacify GCC's 'empty if-body' warning.  */
770
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
771
#  ifndef YYSTACK_ALLOC_MAXIMUM
772
    /* The OS might guarantee only one guard page at the bottom of the stack,
773
       and a page size can be as small as 4096 bytes.  So we cannot safely
774
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
775
       to allow for a few compiler-allocated temporary stack slots.  */
776
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
777
#  endif
778
# else
779
#  define YYSTACK_ALLOC YYMALLOC
780
0
#  define YYSTACK_FREE YYFREE
781
#  ifndef YYSTACK_ALLOC_MAXIMUM
782
0
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
783
#  endif
784
#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
785
       && ! ((defined YYMALLOC || defined malloc) \
786
             && (defined YYFREE || defined free)))
787
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
788
#   ifndef EXIT_SUCCESS
789
#    define EXIT_SUCCESS 0
790
#   endif
791
#  endif
792
#  ifndef YYMALLOC
793
#   define YYMALLOC malloc
794
#   if ! defined malloc && ! defined EXIT_SUCCESS
795
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
796
#   endif
797
#  endif
798
#  ifndef YYFREE
799
#   define YYFREE free
800
#   if ! defined free && ! defined EXIT_SUCCESS
801
void free (void *); /* INFRINGES ON USER NAME SPACE */
802
#   endif
803
#  endif
804
# endif
805
#endif /* 1 */
806
807
#if (! defined yyoverflow \
808
     && (! defined __cplusplus \
809
         || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
810
             && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
811
812
/* A type that is properly aligned for any stack member.  */
813
union yyalloc
814
{
815
  yy_state_t yyss_alloc;
816
  YYSTYPE yyvs_alloc;
817
  YYLTYPE yyls_alloc;
818
};
819
820
/* The size of the maximum gap between one aligned stack and the next.  */
821
0
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
822
823
/* The size of an array large to enough to hold all stacks, each with
824
   N elements.  */
825
# define YYSTACK_BYTES(N) \
826
     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
827
             + YYSIZEOF (YYLTYPE)) \
828
      + 2 * YYSTACK_GAP_MAXIMUM)
829
830
# define YYCOPY_NEEDED 1
831
832
/* Relocate STACK from its old location to the new one.  The
833
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
834
   elements in the stack, and YYPTR gives the new location of the
835
   stack.  Advance YYPTR to a properly aligned location for the next
836
   stack.  */
837
# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
838
0
    do                                                                  \
839
0
      {                                                                 \
840
0
        YYPTRDIFF_T yynewbytes;                                         \
841
0
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
842
0
        Stack = &yyptr->Stack_alloc;                                    \
843
0
        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
844
0
        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
845
0
      }                                                                 \
846
0
    while (0)
847
848
#endif
849
850
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
851
/* Copy COUNT objects from SRC to DST.  The source and destination do
852
   not overlap.  */
853
# ifndef YYCOPY
854
#  if defined __GNUC__ && 1 < __GNUC__
855
#   define YYCOPY(Dst, Src, Count) \
856
0
      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
857
#  else
858
#   define YYCOPY(Dst, Src, Count)              \
859
      do                                        \
860
        {                                       \
861
          YYPTRDIFF_T yyi;                      \
862
          for (yyi = 0; yyi < (Count); yyi++)   \
863
            (Dst)[yyi] = (Src)[yyi];            \
864
        }                                       \
865
      while (0)
866
#  endif
867
# endif
868
#endif /* !YYCOPY_NEEDED */
869
870
/* YYFINAL -- State number of the termination state.  */
871
0
#define YYFINAL  31
872
/* YYLAST -- Last index in YYTABLE.  */
873
0
#define YYLAST   1226
874
875
/* YYNTOKENS -- Number of terminals.  */
876
0
#define YYNTOKENS  70
877
/* YYNNTS -- Number of nonterminals.  */
878
#define YYNNTS  30
879
/* YYNRULES -- Number of rules.  */
880
#define YYNRULES  168
881
/* YYNSTATES -- Number of states.  */
882
#define YYNSTATES  312
883
884
/* YYMAXUTOK -- Last valid token kind.  */
885
0
#define YYMAXUTOK   303
886
887
888
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
889
   as returned by yylex, with out-of-bounds checking.  */
890
#define YYTRANSLATE(YYX)                                \
891
0
  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
892
0
   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
893
0
   : YYSYMBOL_YYUNDEF)
894
895
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
896
   as returned by yylex.  */
897
static const yytype_int8 yytranslate[] =
898
{
899
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
900
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
901
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
902
       2,     2,     2,     2,     2,     2,    69,    57,     2,     2,
903
      64,    65,    55,    53,    49,    54,    60,    56,     2,     2,
904
       2,     2,     2,     2,     2,     2,     2,     2,    63,    62,
905
      51,    50,    52,    59,     2,     2,     2,     2,     2,     2,
906
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
907
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
908
       2,    61,     2,    66,     2,     2,     2,     2,     2,     2,
909
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
910
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
911
       2,     2,     2,    67,    48,    68,     2,     2,     2,     2,
912
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
913
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
914
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
915
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
916
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
917
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
918
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
919
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
920
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
921
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
922
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
923
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
924
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
925
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
926
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
927
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
928
      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
929
      45,    46,    47,    58
930
};
931
932
#if YYDEBUG
933
/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
934
static const yytype_int16 yyrline[] =
935
{
936
       0,   282,   282,   285,   290,   293,   308,   311,   316,   319,
937
     325,   328,   331,   337,   340,   343,   349,   352,   355,   358,
938
     361,   364,   367,   370,   373,   376,   379,   382,   385,   388,
939
     391,   394,   397,   400,   403,   406,   409,   412,   415,   421,
940
     424,   441,   450,   457,   465,   476,   481,   487,   490,   495,
941
     499,   506,   509,   515,   522,   525,   528,   534,   537,   540,
942
     546,   549,   552,   560,   564,   567,   570,   573,   576,   579,
943
     582,   585,   588,   592,   598,   601,   604,   607,   610,   613,
944
     616,   619,   622,   625,   628,   631,   634,   637,   640,   643,
945
     646,   649,   652,   655,   658,   661,   664,   671,   674,   677,
946
     680,   683,   687,   690,   694,   712,   716,   720,   723,   735,
947
     740,   741,   742,   743,   746,   749,   754,   759,   762,   767,
948
     770,   775,   779,   782,   787,   790,   795,   798,   803,   806,
949
     809,   812,   815,   818,   826,   832,   835,   838,   841,   844,
950
     847,   850,   853,   856,   859,   862,   865,   868,   871,   874,
951
     877,   880,   883,   889,   892,   895,   900,   903,   906,   909,
952
     913,   918,   922,   926,   930,   934,   942,   948,   951
953
};
954
#endif
955
956
/** Accessing symbol of state STATE.  */
957
0
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
958
959
#if 1
960
/* The user-facing name of the symbol whose (internal) number is
961
   YYSYMBOL.  No bounds checking.  */
962
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
963
964
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
965
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
966
static const char *const yytname[] =
967
{
968
  "\"end of file\"", "error", "\"invalid token\"", "INVALID_CHARACTER",
969
  "IDENT", "FIELD", "BINDING", "LITERAL", "FORMAT", "\"..\"", "\"%=\"",
970
  "\"==\"", "\"!=\"", "\"//\"", "\"as\"", "\"def\"", "\"module\"",
971
  "\"import\"", "\"include\"", "\"if\"", "\"then\"", "\"else\"",
972
  "\"elif\"", "\"reduce\"", "\"foreach\"", "\"end\"", "\"and\"", "\"or\"",
973
  "\"try\"", "\"catch\"", "\"label\"", "\"break\"", "\"$__loc__\"",
974
  "\"|=\"", "\"+=\"", "\"-=\"", "\"*=\"", "\"/=\"", "\"//=\"", "\"<=\"",
975
  "\">=\"", "\"?//\"", "QQSTRING_START", "QQSTRING_TEXT",
976
  "QQSTRING_INTERP_START", "QQSTRING_INTERP_END", "QQSTRING_END",
977
  "FUNCDEF", "'|'", "','", "'='", "'<'", "'>'", "'+'", "'-'", "'*'", "'/'",
978
  "'%'", "NONOPT", "'?'", "'.'", "'['", "';'", "':'", "'('", "')'", "']'",
979
  "'{'", "'}'", "'$'", "$accept", "TopLevel", "Module", "Imports",
980
  "FuncDefs", "Query", "Expr", "Import", "ImportWhat", "ImportFrom",
981
  "FuncDef", "Params", "Param", "StringStart", "String", "QQString",
982
  "ElseBody", "Term", "Args", "Arg", "RepPatterns", "Patterns", "Pattern",
983
  "ArrayPats", "ObjPats", "ObjPat", "Keyword", "DictPairs", "DictPair",
984
  "DictExpr", YY_NULLPTR
985
};
986
987
static const char *
988
yysymbol_name (yysymbol_kind_t yysymbol)
989
0
{
990
0
  return yytname[yysymbol];
991
0
}
992
#endif
993
994
0
#define YYPACT_NINF (-146)
995
996
#define yypact_value_is_default(Yyn) \
997
0
  ((Yyn) == YYPACT_NINF)
998
999
0
#define YYTABLE_NINF (-154)
1000
1001
#define yytable_value_is_error(Yyn) \
1002
0
  ((Yyn) == YYTABLE_NINF)
1003
1004
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1005
   STATE-NUM.  */
1006
static const yytype_int16 yypact[] =
1007
{
1008
      31,   890,    44,    35,    11,     9,  -146,  -146,    38,  -146,
1009
      85,   890,   956,   956,   956,   112,    26,  -146,  -146,   956,
1010
     279,   345,   412,   608,    59,    25,  1040,   890,  -146,  -146,
1011
      -2,  -146,     4,     4,   890,    35,   692,   890,  -146,  -146,
1012
      20,   -18,  1073,  1105,   131,    86,  -146,  -146,    -2,  -146,
1013
     164,    38,   108,   107,  -146,    22,   104,     0,   -34,   121,
1014
     124,  -146,  -146,  -146,  -146,  -146,  -146,  -146,  -146,  -146,
1015
    -146,  -146,  -146,  -146,  -146,  -146,  -146,  -146,  -146,  -146,
1016
     890,   135,   137,   134,   126,   141,   890,   890,  -146,   956,
1017
     956,   956,   956,    -5,   956,   956,   956,   956,   956,   956,
1018
     956,   956,   956,   956,   956,   956,   956,   956,   956,   956,
1019
     956,   956,    84,   177,   147,  -146,     3,   173,   199,  -146,
1020
    -146,  -146,    84,   890,  -146,  -146,   114,    84,    77,  -146,
1021
     890,    13,   479,    -5,    -5,   546,   890,  -146,  -146,  -146,
1022
    -146,  -146,  -146,   956,  -146,   956,   956,    78,   956,   956,
1023
    -146,   663,   220,    84,  -146,  1169,   505,   505,  1137,  -146,
1024
      -5,  1018,   187,   166,   188,   606,   205,  1169,  1169,  1169,
1025
    1169,  1169,  1169,   505,   505,  1169,   505,   505,   208,   208,
1026
    -146,  -146,  -146,  -146,   890,  -146,  -146,   758,   176,   175,
1027
     890,   184,     6,    57,  -146,  -146,   890,  -146,   123,  -146,
1028
    -146,    83,  -146,  -146,    18,   185,   189,  -146,  -146,    84,
1029
    1137,   200,   200,   200,   203,   200,   200,   206,  -146,  -146,
1030
    -146,   -42,   207,   209,   210,   890,   212,   -45,  -146,   213,
1031
      -5,   890,    33,   193,    28,  -146,  -146,    71,  -146,   824,
1032
     218,  -146,  -146,  -146,  -146,    13,   215,   890,   890,  -146,
1033
    -146,   890,   890,   956,   956,    -5,  -146,    -5,    -5,    -5,
1034
     103,    -5,  1018,  -146,    -5,   227,    84,  -146,  -146,   222,
1035
     223,   226,    74,  -146,  -146,   890,    -7,     2,   160,   163,
1036
     200,   200,  -146,  -146,  -146,  -146,   225,  -146,  -146,  -146,
1037
    -146,  -146,  -146,   235,   170,  -146,   890,   890,   890,    -5,
1038
    -146,  -146,    18,   105,    76,  -146,  -146,  -146,   890,  -146,
1039
     142,  -146
1040
};
1041
1042
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
1043
   Performed when YYTABLE does not specify something else to do.  Zero
1044
   means the default is an error.  */
1045
static const yytype_uint8 yydefact[] =
1046
{
1047
       4,     0,     0,     6,   108,    69,   106,    89,    91,    61,
1048
       0,     0,     0,     0,     0,     0,     0,   107,    52,     0,
1049
       0,     0,     0,     0,     0,     0,    15,     0,    54,    90,
1050
      38,     1,     0,     0,     8,     6,     0,     0,    65,    51,
1051
       0,     0,     0,     0,   104,     0,    63,    62,    92,    72,
1052
       0,     0,    71,     0,    95,     0,     0,     0,     0,   162,
1053
     161,   135,   136,   137,   138,   139,   140,   141,   142,   143,
1054
     144,   145,   146,   147,   148,   149,   150,   151,   152,   163,
1055
       0,   159,   164,     0,   154,     0,     0,     0,     5,     0,
1056
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1057
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1058
       0,     0,    10,     0,    68,    88,     0,     0,     0,    44,
1059
      43,     3,     2,     8,     7,    39,     0,   116,     0,   114,
1060
       0,     0,     0,     0,     0,     0,     0,    73,    67,   111,
1061
      94,   110,    93,     0,   113,     0,     0,     0,     0,     0,
1062
      96,     0,     0,    13,    14,    31,    32,    33,    16,   121,
1063
       0,     0,     0,     0,   120,    19,    18,    21,    23,    25,
1064
      27,    30,    20,    36,    37,    17,    34,    35,    22,    24,
1065
      26,    28,    29,    55,     0,    53,    64,     0,    70,     0,
1066
       0,    79,     0,     0,     9,    40,     0,   109,     0,    50,
1067
      49,     0,    47,   101,     0,     0,     0,   103,   102,    12,
1068
     168,   166,   156,   160,     0,   158,   157,     0,   155,   105,
1069
     124,     0,     0,     0,   128,     0,     0,     0,   126,     0,
1070
       0,     0,     0,    81,     0,    66,   112,     0,    78,     0,
1071
      75,    42,    41,   115,    45,     0,     0,     0,     0,    59,
1072
     100,     0,     0,     0,     0,     0,   122,     0,     0,     0,
1073
       0,     0,     0,   123,     0,   119,    11,    56,    80,    77,
1074
      87,    86,     0,    74,    48,     0,     0,     0,     0,     0,
1075
     167,   165,   125,   134,   130,   129,     0,   132,   127,   131,
1076
      76,    84,    83,    85,     0,    58,     0,     0,     0,     0,
1077
      82,    46,     0,     0,     0,   133,    57,    97,     0,    99,
1078
       0,    98
1079
};
1080
1081
/* YYPGOTO[NTERM-NUM].  */
1082
static const yytype_int16 yypgoto[] =
1083
{
1084
    -146,  -146,  -146,   236,   179,    -1,     1,  -146,  -146,   253,
1085
      -8,  -146,    53,  -146,     5,  -146,     7,   284,  -146,   115,
1086
    -146,    60,  -100,  -146,  -146,    48,  -145,   169,  -146,  -140
1087
};
1088
1089
/* YYDEFGOTO[NTERM-NUM].  */
1090
static const yytype_uint8 yydefgoto[] =
1091
{
1092
       0,     2,     3,    34,   121,   112,    26,    35,    36,   118,
1093
      27,   201,   202,    28,    29,   113,   250,    30,   128,   129,
1094
     162,   163,   164,   221,   227,   228,    82,    83,    84,   211
1095
};
1096
1097
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
1098
   positive, shift that token.  If negative, reduce the rule whose
1099
   number is the opposite.  If YYTABLE_NINF, syntax error.  */
1100
static const yytype_int16 yytable[] =
1101
{
1102
      25,   159,   132,   114,   262,   212,   213,   255,   215,   216,
1103
      41,    51,    51,    42,    43,    44,   229,   199,   295,   200,
1104
      55,    57,   296,   263,   256,    52,   123,    46,    81,   143,
1105
      86,    87,    47,   122,   144,   126,   127,   119,   119,   247,
1106
     248,    86,    87,   249,    31,    18,    18,     1,    86,    87,
1107
      86,    87,    32,    33,    86,    87,   160,   115,   116,   117,
1108
     220,   241,   161,   242,   187,   142,    86,    87,    38,   239,
1109
      86,    87,   240,    86,    87,    37,    86,    87,   267,   147,
1110
      39,    86,    87,   130,   131,   153,   154,    88,   140,    40,
1111
     155,   156,   157,   158,   269,   165,   166,   167,   168,   169,
1112
     170,   171,   172,   173,   174,   175,   176,   177,   178,   179,
1113
     180,   181,   182,   280,   281,   123,   192,   229,    45,    86,
1114
      87,   188,    86,    87,    86,    87,    86,    87,    85,   198,
1115
     265,   204,    86,    87,   136,   209,   208,   270,   308,   196,
1116
     293,   309,   197,   214,   210,   245,   210,   210,   246,   210,
1117
     210,    86,    87,    86,    87,   282,    81,   283,   284,   285,
1118
     135,   287,    86,    87,   289,   137,   226,   138,   286,   141,
1119
     307,    86,    87,   139,   189,   151,   195,     4,     5,     6,
1120
       7,     8,     9,   232,   145,   244,   234,   146,    10,   237,
1121
      86,    87,    11,   205,   206,   127,    12,    13,   148,   305,
1122
     149,    14,   150,    15,    16,    17,   186,   311,    86,    87,
1123
     152,    86,    87,   193,   231,    18,    90,    91,    86,    87,
1124
     183,   184,   297,   185,   260,   298,   219,    19,   230,  -118,
1125
     266,    94,   301,    20,    21,   235,   190,    22,   272,   191,
1126
      23,   236,    24,   238,   102,   103,   276,   277,   253,   251,
1127
     278,   279,   268,   252,   210,   210,   105,   106,   107,   108,
1128
     109,   110,   111,   109,   110,   111,   254,   226,  -117,   143,
1129
     257,   124,   258,   259,   294,   261,   264,   273,   275,   -60,
1130
      49,   290,   291,    50,   -60,   292,   120,    51,   299,   -60,
1131
     -60,   -60,   -60,   -60,   300,   302,   303,   304,   274,   -60,
1132
     -60,   -60,   194,    48,   -60,   -60,   -60,   310,   -60,   306,
1133
     288,   243,   -60,   -60,   -60,   -60,   -60,   -60,   -60,   -60,
1134
     218,    18,     0,     0,   -60,     0,     0,   -60,   -60,   -60,
1135
     -60,   -60,   -60,   -60,   -60,   -60,   -60,     0,   -60,   -60,
1136
     -60,   -60,   -60,     0,   -60,   -60,    53,   -60,     0,     4,
1137
       5,     6,     7,     8,     9,     0,     0,     0,     0,     0,
1138
      10,     0,     0,     0,    11,     0,     0,     0,    12,    13,
1139
       0,     0,     0,    14,     0,    15,    16,    17,     0,     0,
1140
       0,     0,     0,     0,     0,     0,     0,    18,     0,     0,
1141
       0,     0,     0,     0,     0,     0,     0,     0,     0,    19,
1142
       0,     0,     0,     0,     0,    20,    21,     0,     0,    22,
1143
       0,    54,    23,    56,    24,     0,     4,     5,     6,     7,
1144
       8,     9,     0,     0,     0,     0,     0,    10,     0,     0,
1145
       0,    11,     0,     0,     0,    12,    13,     0,     0,     0,
1146
      14,     0,    15,    16,    17,     0,     0,     0,     0,     0,
1147
       0,     0,     0,     0,    18,     0,     0,     0,     0,     0,
1148
       0,     0,     0,     0,     0,     0,    19,     0,     0,     0,
1149
       0,     0,    20,    21,     0,     0,    22,     0,     0,    23,
1150
     203,    24,     0,     4,     5,     6,     7,     8,     9,     0,
1151
       0,     0,     0,     0,    10,     0,     0,     0,    11,     0,
1152
       0,     0,    12,    13,     0,     0,     0,    14,     0,    15,
1153
      16,    17,     0,     0,     0,     0,  -154,  -154,     0,     0,
1154
       0,    18,     0,     0,     0,     0,     0,     0,     0,     0,
1155
       0,     0,     0,    19,     0,     0,     0,     0,     0,    20,
1156
      21,     0,     0,    22,  -154,  -154,    23,   207,    24,     0,
1157
       4,     5,     6,     7,     8,     9,  -154,  -154,   107,   108,
1158
     109,   110,   111,     0,     0,    11,     0,     0,     0,    12,
1159
      13,     0,     0,     0,    14,     0,     0,    16,    17,     0,
1160
       0,     0,     0,     0,     0,     0,     0,     0,    18,     0,
1161
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1162
      19,     0,     0,     0,     0,     0,    20,    21,     0,    58,
1163
      22,     0,    59,    23,    60,    24,    51,    90,    91,     0,
1164
       0,     0,    61,    62,    63,    64,    65,    66,    67,    68,
1165
      69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
1166
      79,     0,     0,     0,     0,   102,   103,     0,     0,     0,
1167
      18,     0,     0,     0,     0,     0,     0,   105,   106,   107,
1168
     108,   109,   110,   111,   217,     0,     0,    59,     0,    60,
1169
       0,    51,    80,     0,     0,     0,  -153,    61,    62,    63,
1170
      64,    65,    66,    67,    68,    69,    70,    71,    72,    73,
1171
      74,    75,    76,    77,    78,    79,     4,     5,     6,     7,
1172
       8,     9,     0,     0,     0,    18,     0,    10,     0,     0,
1173
       0,    11,     0,     0,     0,    12,    13,     0,     0,     0,
1174
      14,     0,    15,    16,    17,     0,     0,    80,     0,     0,
1175
       0,  -153,     0,     0,    18,     0,     0,     0,     0,     0,
1176
       0,     0,     0,     0,     0,     0,    19,     0,     0,     0,
1177
       0,     0,    20,    21,   125,     0,    22,     0,     0,    23,
1178
       0,    24,     4,     5,     6,     7,     8,     9,     0,     0,
1179
       0,     0,     0,    10,     0,     0,     0,    11,     0,     0,
1180
       0,    12,    13,     0,     0,     0,    14,     0,    15,    16,
1181
      17,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1182
      18,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1183
       0,     0,    19,     0,     0,     0,     0,     0,    20,    21,
1184
       0,     0,    22,     0,   233,    23,     0,    24,     4,     5,
1185
       6,     7,     8,     9,     0,     0,     0,     0,     0,    10,
1186
       0,     0,     0,    11,     0,     0,     0,    12,    13,     0,
1187
       0,     0,    14,     0,    15,    16,    17,     0,     0,     0,
1188
       0,     0,     0,     0,     0,     0,    18,     0,     0,     0,
1189
       0,     0,     0,     0,     0,     0,     0,     0,    19,     0,
1190
       0,     0,     0,     0,    20,    21,     0,     0,    22,     0,
1191
     271,    23,     0,    24,     4,     5,     6,     7,     8,     9,
1192
       0,     0,     0,     0,     0,    10,     0,     0,     0,    11,
1193
       0,     0,     0,    12,    13,     0,     0,     0,    14,     0,
1194
      15,    16,    17,     0,     0,     0,     0,     0,     0,     0,
1195
       0,     0,    18,     0,     0,     0,     0,     0,     0,     0,
1196
       0,     0,     0,     0,    19,     0,     0,     0,     0,     0,
1197
      20,    21,     0,     0,    22,     0,     0,    23,     0,    24,
1198
       4,     5,     6,     7,     8,     9,     0,     0,     0,     0,
1199
       0,     0,     0,     0,     0,    11,     0,     0,     0,    12,
1200
      13,     0,     0,     0,    14,     0,     0,    16,    17,     0,
1201
       0,     0,     0,     0,     0,     0,     0,     0,    18,     0,
1202
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1203
      19,     0,     0,     0,     0,     0,    20,    21,     0,   222,
1204
      22,     0,   223,    23,   224,    24,    51,     0,     0,     0,
1205
       0,     0,    61,    62,    63,    64,    65,    66,    67,    68,
1206
      69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
1207
      89,    90,    91,    92,    93,     0,     0,     0,     0,     0,
1208
      18,     0,     0,     0,     0,     0,    94,    95,     0,     0,
1209
       0,     0,     0,    96,    97,    98,    99,   100,   101,   102,
1210
     103,     0,   225,    89,    90,    91,    92,   133,     0,     0,
1211
     104,   105,   106,   107,   108,   109,   110,   111,     0,    94,
1212
      95,     0,     0,     0,     0,     0,    96,    97,    98,    99,
1213
     100,   101,   102,   103,     0,    89,    90,    91,    92,   134,
1214
       0,     0,     0,   104,   105,   106,   107,   108,   109,   110,
1215
     111,    94,    95,     0,     0,     0,     0,     0,    96,    97,
1216
      98,    99,   100,   101,   102,   103,     0,    89,    90,    91,
1217
      92,     0,     0,     0,     0,   104,   105,   106,   107,   108,
1218
     109,   110,   111,    94,    95,     0,     0,     0,     0,     0,
1219
      96,    97,    98,    99,   100,   101,   102,   103,     0,  -154,
1220
      90,    91,     0,     0,     0,     0,     0,   104,   105,   106,
1221
     107,   108,   109,   110,   111,    94,    95,     0,     0,     0,
1222
       0,     0,  -154,  -154,  -154,  -154,  -154,  -154,   102,   103,
1223
       0,     0,     0,     0,     0,     0,     0,     0,     0,  -154,
1224
     105,   106,   107,   108,   109,   110,   111
1225
};
1226
1227
static const yytype_int16 yycheck[] =
1228
{
1229
       1,     6,    20,     5,    49,   145,   146,    49,   148,   149,
1230
      11,     8,     8,    12,    13,    14,   161,     4,    25,     6,
1231
      21,    22,    20,    68,    66,    20,    34,     1,    23,    63,
1232
      48,    49,     6,    34,    68,    36,    37,    32,    33,    21,
1233
      22,    48,    49,    25,     0,    42,    42,    16,    48,    49,
1234
      48,    49,    17,    18,    48,    49,    61,    59,    60,    61,
1235
     160,     4,    67,     6,    61,    65,    48,    49,    59,    63,
1236
      48,    49,    66,    48,    49,    64,    48,    49,    45,    80,
1237
      42,    48,    49,    63,    64,    86,    87,    62,    66,     4,
1238
      89,    90,    91,    92,    66,    94,    95,    96,    97,    98,
1239
      99,   100,   101,   102,   103,   104,   105,   106,   107,   108,
1240
     109,   110,   111,   253,   254,   123,   117,   262,     6,    48,
1241
      49,   116,    48,    49,    48,    49,    48,    49,    69,   130,
1242
     230,   132,    48,    49,    48,   136,   135,    66,    62,    62,
1243
      66,    65,    65,    65,   143,    62,   145,   146,    65,   148,
1244
     149,    48,    49,    48,    49,   255,   151,   257,   258,   259,
1245
      29,   261,    48,    49,   264,     1,   161,    59,    65,    65,
1246
      65,    48,    49,    66,     1,    49,    62,     4,     5,     6,
1247
       7,     8,     9,   184,    63,    62,   187,    63,    15,   190,
1248
      48,    49,    19,   133,   134,   196,    23,    24,    63,   299,
1249
      63,    28,    68,    30,    31,    32,    59,    65,    48,    49,
1250
      69,    48,    49,    14,    48,    42,    11,    12,    48,    49,
1251
      43,    44,    62,    46,   225,    62,     6,    54,    41,    41,
1252
     231,    26,    62,    60,    61,    59,    63,    64,   239,    66,
1253
      67,    66,    69,    59,    39,    40,   247,   248,    48,    64,
1254
     251,   252,    59,    64,   253,   254,    51,    52,    53,    54,
1255
      55,    56,    57,    55,    56,    57,    63,   262,    41,    63,
1256
      63,    35,    63,    63,   275,    63,    63,    59,    63,     0,
1257
       1,    59,    59,     4,     5,    59,    33,     8,    63,    10,
1258
      11,    12,    13,    14,    59,   296,   297,   298,   245,    20,
1259
      21,    22,   123,    19,    25,    26,    27,   308,    29,   302,
1260
     262,   196,    33,    34,    35,    36,    37,    38,    39,    40,
1261
     151,    42,    -1,    -1,    45,    -1,    -1,    48,    49,    50,
1262
      51,    52,    53,    54,    55,    56,    57,    -1,    59,    60,
1263
      61,    62,    63,    -1,    65,    66,     1,    68,    -1,     4,
1264
       5,     6,     7,     8,     9,    -1,    -1,    -1,    -1,    -1,
1265
      15,    -1,    -1,    -1,    19,    -1,    -1,    -1,    23,    24,
1266
      -1,    -1,    -1,    28,    -1,    30,    31,    32,    -1,    -1,
1267
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    42,    -1,    -1,
1268
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    54,
1269
      -1,    -1,    -1,    -1,    -1,    60,    61,    -1,    -1,    64,
1270
      -1,    66,    67,     1,    69,    -1,     4,     5,     6,     7,
1271
       8,     9,    -1,    -1,    -1,    -1,    -1,    15,    -1,    -1,
1272
      -1,    19,    -1,    -1,    -1,    23,    24,    -1,    -1,    -1,
1273
      28,    -1,    30,    31,    32,    -1,    -1,    -1,    -1,    -1,
1274
      -1,    -1,    -1,    -1,    42,    -1,    -1,    -1,    -1,    -1,
1275
      -1,    -1,    -1,    -1,    -1,    -1,    54,    -1,    -1,    -1,
1276
      -1,    -1,    60,    61,    -1,    -1,    64,    -1,    -1,    67,
1277
       1,    69,    -1,     4,     5,     6,     7,     8,     9,    -1,
1278
      -1,    -1,    -1,    -1,    15,    -1,    -1,    -1,    19,    -1,
1279
      -1,    -1,    23,    24,    -1,    -1,    -1,    28,    -1,    30,
1280
      31,    32,    -1,    -1,    -1,    -1,    11,    12,    -1,    -1,
1281
      -1,    42,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1282
      -1,    -1,    -1,    54,    -1,    -1,    -1,    -1,    -1,    60,
1283
      61,    -1,    -1,    64,    39,    40,    67,     1,    69,    -1,
1284
       4,     5,     6,     7,     8,     9,    51,    52,    53,    54,
1285
      55,    56,    57,    -1,    -1,    19,    -1,    -1,    -1,    23,
1286
      24,    -1,    -1,    -1,    28,    -1,    -1,    31,    32,    -1,
1287
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    42,    -1,
1288
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1289
      54,    -1,    -1,    -1,    -1,    -1,    60,    61,    -1,     1,
1290
      64,    -1,     4,    67,     6,    69,     8,    11,    12,    -1,
1291
      -1,    -1,    14,    15,    16,    17,    18,    19,    20,    21,
1292
      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
1293
      32,    -1,    -1,    -1,    -1,    39,    40,    -1,    -1,    -1,
1294
      42,    -1,    -1,    -1,    -1,    -1,    -1,    51,    52,    53,
1295
      54,    55,    56,    57,     1,    -1,    -1,     4,    -1,     6,
1296
      -1,     8,    64,    -1,    -1,    -1,    68,    14,    15,    16,
1297
      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
1298
      27,    28,    29,    30,    31,    32,     4,     5,     6,     7,
1299
       8,     9,    -1,    -1,    -1,    42,    -1,    15,    -1,    -1,
1300
      -1,    19,    -1,    -1,    -1,    23,    24,    -1,    -1,    -1,
1301
      28,    -1,    30,    31,    32,    -1,    -1,    64,    -1,    -1,
1302
      -1,    68,    -1,    -1,    42,    -1,    -1,    -1,    -1,    -1,
1303
      -1,    -1,    -1,    -1,    -1,    -1,    54,    -1,    -1,    -1,
1304
      -1,    -1,    60,    61,    62,    -1,    64,    -1,    -1,    67,
1305
      -1,    69,     4,     5,     6,     7,     8,     9,    -1,    -1,
1306
      -1,    -1,    -1,    15,    -1,    -1,    -1,    19,    -1,    -1,
1307
      -1,    23,    24,    -1,    -1,    -1,    28,    -1,    30,    31,
1308
      32,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1309
      42,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1310
      -1,    -1,    54,    -1,    -1,    -1,    -1,    -1,    60,    61,
1311
      -1,    -1,    64,    -1,    66,    67,    -1,    69,     4,     5,
1312
       6,     7,     8,     9,    -1,    -1,    -1,    -1,    -1,    15,
1313
      -1,    -1,    -1,    19,    -1,    -1,    -1,    23,    24,    -1,
1314
      -1,    -1,    28,    -1,    30,    31,    32,    -1,    -1,    -1,
1315
      -1,    -1,    -1,    -1,    -1,    -1,    42,    -1,    -1,    -1,
1316
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    54,    -1,
1317
      -1,    -1,    -1,    -1,    60,    61,    -1,    -1,    64,    -1,
1318
      66,    67,    -1,    69,     4,     5,     6,     7,     8,     9,
1319
      -1,    -1,    -1,    -1,    -1,    15,    -1,    -1,    -1,    19,
1320
      -1,    -1,    -1,    23,    24,    -1,    -1,    -1,    28,    -1,
1321
      30,    31,    32,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1322
      -1,    -1,    42,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1323
      -1,    -1,    -1,    -1,    54,    -1,    -1,    -1,    -1,    -1,
1324
      60,    61,    -1,    -1,    64,    -1,    -1,    67,    -1,    69,
1325
       4,     5,     6,     7,     8,     9,    -1,    -1,    -1,    -1,
1326
      -1,    -1,    -1,    -1,    -1,    19,    -1,    -1,    -1,    23,
1327
      24,    -1,    -1,    -1,    28,    -1,    -1,    31,    32,    -1,
1328
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    42,    -1,
1329
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1330
      54,    -1,    -1,    -1,    -1,    -1,    60,    61,    -1,     1,
1331
      64,    -1,     4,    67,     6,    69,     8,    -1,    -1,    -1,
1332
      -1,    -1,    14,    15,    16,    17,    18,    19,    20,    21,
1333
      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
1334
      10,    11,    12,    13,    14,    -1,    -1,    -1,    -1,    -1,
1335
      42,    -1,    -1,    -1,    -1,    -1,    26,    27,    -1,    -1,
1336
      -1,    -1,    -1,    33,    34,    35,    36,    37,    38,    39,
1337
      40,    -1,    64,    10,    11,    12,    13,    14,    -1,    -1,
1338
      50,    51,    52,    53,    54,    55,    56,    57,    -1,    26,
1339
      27,    -1,    -1,    -1,    -1,    -1,    33,    34,    35,    36,
1340
      37,    38,    39,    40,    -1,    10,    11,    12,    13,    14,
1341
      -1,    -1,    -1,    50,    51,    52,    53,    54,    55,    56,
1342
      57,    26,    27,    -1,    -1,    -1,    -1,    -1,    33,    34,
1343
      35,    36,    37,    38,    39,    40,    -1,    10,    11,    12,
1344
      13,    -1,    -1,    -1,    -1,    50,    51,    52,    53,    54,
1345
      55,    56,    57,    26,    27,    -1,    -1,    -1,    -1,    -1,
1346
      33,    34,    35,    36,    37,    38,    39,    40,    -1,    10,
1347
      11,    12,    -1,    -1,    -1,    -1,    -1,    50,    51,    52,
1348
      53,    54,    55,    56,    57,    26,    27,    -1,    -1,    -1,
1349
      -1,    -1,    33,    34,    35,    36,    37,    38,    39,    40,
1350
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    50,
1351
      51,    52,    53,    54,    55,    56,    57
1352
};
1353
1354
/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
1355
   state STATE-NUM.  */
1356
static const yytype_int8 yystos[] =
1357
{
1358
       0,    16,    71,    72,     4,     5,     6,     7,     8,     9,
1359
      15,    19,    23,    24,    28,    30,    31,    32,    42,    54,
1360
      60,    61,    64,    67,    69,    75,    76,    80,    83,    84,
1361
      87,     0,    17,    18,    73,    77,    78,    64,    59,    42,
1362
       4,    75,    76,    76,    76,     6,     1,     6,    87,     1,
1363
       4,     8,    84,     1,    66,    75,     1,    75,     1,     4,
1364
       6,    14,    15,    16,    17,    18,    19,    20,    21,    22,
1365
      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
1366
      64,    84,    96,    97,    98,    69,    48,    49,    62,    10,
1367
      11,    12,    13,    14,    26,    27,    33,    34,    35,    36,
1368
      37,    38,    39,    40,    50,    51,    52,    53,    54,    55,
1369
      56,    57,    75,    85,     5,    59,    60,    61,    79,    84,
1370
      79,    74,    75,    80,    73,    62,    75,    75,    88,    89,
1371
      63,    64,    20,    14,    14,    29,    48,     1,    59,    66,
1372
      66,    65,    65,    63,    68,    63,    63,    75,    63,    63,
1373
      68,    49,    69,    75,    75,    76,    76,    76,    76,     6,
1374
      61,    67,    90,    91,    92,    76,    76,    76,    76,    76,
1375
      76,    76,    76,    76,    76,    76,    76,    76,    76,    76,
1376
      76,    76,    76,    43,    44,    46,    59,    61,    84,     1,
1377
      63,    66,    75,    14,    74,    62,    62,    65,    75,     4,
1378
       6,    81,    82,     1,    75,    91,    91,     1,    76,    75,
1379
      76,    99,    99,    99,    65,    99,    99,     1,    97,     6,
1380
      92,    93,     1,     4,     6,    64,    84,    94,    95,    96,
1381
      41,    48,    75,    66,    75,    59,    66,    75,    59,    63,
1382
      66,     4,     6,    89,    62,    62,    65,    21,    22,    25,
1383
      86,    64,    64,    48,    63,    49,    66,    63,    63,    63,
1384
      75,    63,    49,    68,    63,    92,    75,    45,    59,    66,
1385
      66,    66,    75,    59,    82,    63,    75,    75,    75,    75,
1386
      99,    99,    92,    92,    92,    92,    65,    92,    95,    92,
1387
      59,    59,    59,    66,    75,    25,    20,    62,    62,    63,
1388
      59,    62,    75,    75,    75,    92,    86,    65,    62,    65,
1389
      75,    65
1390
};
1391
1392
/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
1393
static const yytype_int8 yyr1[] =
1394
{
1395
       0,    70,    71,    71,    72,    72,    73,    73,    74,    74,
1396
      75,    75,    75,    75,    75,    75,    76,    76,    76,    76,
1397
      76,    76,    76,    76,    76,    76,    76,    76,    76,    76,
1398
      76,    76,    76,    76,    76,    76,    76,    76,    76,    77,
1399
      77,    78,    78,    78,    79,    80,    80,    81,    81,    82,
1400
      82,    83,    83,    84,    85,    85,    85,    86,    86,    86,
1401
      87,    87,    87,    87,    87,    87,    87,    87,    87,    87,
1402
      87,    87,    87,    87,    87,    87,    87,    87,    87,    87,
1403
      87,    87,    87,    87,    87,    87,    87,    87,    87,    87,
1404
      87,    87,    87,    87,    87,    87,    87,    87,    87,    87,
1405
      87,    87,    87,    87,    87,    87,    87,    87,    87,    87,
1406
      87,    87,    87,    87,    88,    88,    89,    90,    90,    91,
1407
      91,    92,    92,    92,    93,    93,    94,    94,    95,    95,
1408
      95,    95,    95,    95,    95,    96,    96,    96,    96,    96,
1409
      96,    96,    96,    96,    96,    96,    96,    96,    96,    96,
1410
      96,    96,    96,    97,    97,    97,    98,    98,    98,    98,
1411
      98,    98,    98,    98,    98,    98,    98,    99,    99
1412
};
1413
1414
/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
1415
static const yytype_int8 yyr2[] =
1416
{
1417
       0,     2,     3,     3,     0,     3,     0,     2,     0,     2,
1418
       2,     5,     4,     3,     3,     1,     3,     3,     3,     3,
1419
       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
1420
       3,     3,     3,     3,     3,     3,     3,     3,     1,     2,
1421
       3,     4,     4,     2,     1,     5,     8,     1,     3,     1,
1422
       1,     2,     1,     3,     0,     2,     4,     5,     3,     1,
1423
       1,     1,     2,     2,     3,     2,     4,     3,     2,     1,
1424
       3,     2,     2,     3,     5,     4,     6,     5,     4,     3,
1425
       5,     4,     7,     6,     6,     6,     5,     5,     2,     1,
1426
       1,     1,     2,     3,     3,     2,     3,     9,    11,     9,
1427
       5,     4,     4,     4,     2,     4,     1,     1,     1,     4,
1428
       3,     3,     4,     3,     1,     3,     1,     3,     1,     3,
1429
       1,     1,     3,     3,     1,     3,     1,     3,     1,     3,
1430
       3,     3,     3,     5,     3,     1,     1,     1,     1,     1,
1431
       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1432
       1,     1,     1,     0,     1,     3,     3,     3,     3,     1,
1433
       3,     1,     1,     1,     1,     5,     3,     3,     1
1434
};
1435
1436
1437
enum { YYENOMEM = -2 };
1438
1439
#define yyerrok         (yyerrstatus = 0)
1440
#define yyclearin       (yychar = YYEMPTY)
1441
1442
0
#define YYACCEPT        goto yyacceptlab
1443
0
#define YYABORT         goto yyabortlab
1444
0
#define YYERROR         goto yyerrorlab
1445
0
#define YYNOMEM         goto yyexhaustedlab
1446
1447
1448
#define YYRECOVERING()  (!!yyerrstatus)
1449
1450
#define YYBACKUP(Token, Value)                                    \
1451
  do                                                              \
1452
    if (yychar == YYEMPTY)                                        \
1453
      {                                                           \
1454
        yychar = (Token);                                         \
1455
        yylval = (Value);                                         \
1456
        YYPOPSTACK (yylen);                                       \
1457
        yystate = *yyssp;                                         \
1458
        goto yybackup;                                            \
1459
      }                                                           \
1460
    else                                                          \
1461
      {                                                           \
1462
        yyerror (&yylloc, answer, errors, locations, lexer_param_ptr, YY_("syntax error: cannot back up")); \
1463
        YYERROR;                                                  \
1464
      }                                                           \
1465
  while (0)
1466
1467
/* Backward compatibility with an undocumented macro.
1468
   Use YYerror or YYUNDEF. */
1469
#define YYERRCODE YYUNDEF
1470
1471
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1472
   If N is 0, then set CURRENT to the empty location which ends
1473
   the previous symbol: RHS[0] (always defined).  */
1474
1475
#ifndef YYLLOC_DEFAULT
1476
# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
1477
    do                                                                  \
1478
      if (N)                                                            \
1479
        {                                                               \
1480
          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
1481
          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
1482
          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
1483
          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
1484
        }                                                               \
1485
      else                                                              \
1486
        {                                                               \
1487
          (Current).first_line   = (Current).last_line   =              \
1488
            YYRHSLOC (Rhs, 0).last_line;                                \
1489
          (Current).first_column = (Current).last_column =              \
1490
            YYRHSLOC (Rhs, 0).last_column;                              \
1491
        }                                                               \
1492
    while (0)
1493
#endif
1494
1495
0
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1496
1497
1498
/* Enable debugging if requested.  */
1499
#if YYDEBUG
1500
1501
# ifndef YYFPRINTF
1502
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1503
#  define YYFPRINTF fprintf
1504
# endif
1505
1506
# define YYDPRINTF(Args)                        \
1507
do {                                            \
1508
  if (yydebug)                                  \
1509
    YYFPRINTF Args;                             \
1510
} while (0)
1511
1512
1513
/* YYLOCATION_PRINT -- Print the location on the stream.
1514
   This macro was not mandated originally: define only if we know
1515
   we won't break user code: when these are the locations we know.  */
1516
1517
# ifndef YYLOCATION_PRINT
1518
1519
#  if defined YY_LOCATION_PRINT
1520
1521
   /* Temporary convenience wrapper in case some people defined the
1522
      undocumented and private YY_LOCATION_PRINT macros.  */
1523
#   define YYLOCATION_PRINT(File, Loc)  YY_LOCATION_PRINT(File, *(Loc))
1524
1525
#  elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1526
1527
/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
1528
1529
YY_ATTRIBUTE_UNUSED
1530
static int
1531
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
1532
{
1533
  int res = 0;
1534
  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
1535
  if (0 <= yylocp->first_line)
1536
    {
1537
      res += YYFPRINTF (yyo, "%d", yylocp->first_line);
1538
      if (0 <= yylocp->first_column)
1539
        res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
1540
    }
1541
  if (0 <= yylocp->last_line)
1542
    {
1543
      if (yylocp->first_line < yylocp->last_line)
1544
        {
1545
          res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
1546
          if (0 <= end_col)
1547
            res += YYFPRINTF (yyo, ".%d", end_col);
1548
        }
1549
      else if (0 <= end_col && yylocp->first_column < end_col)
1550
        res += YYFPRINTF (yyo, "-%d", end_col);
1551
    }
1552
  return res;
1553
}
1554
1555
#   define YYLOCATION_PRINT  yy_location_print_
1556
1557
    /* Temporary convenience wrapper in case some people defined the
1558
       undocumented and private YY_LOCATION_PRINT macros.  */
1559
#   define YY_LOCATION_PRINT(File, Loc)  YYLOCATION_PRINT(File, &(Loc))
1560
1561
#  else
1562
1563
#   define YYLOCATION_PRINT(File, Loc) ((void) 0)
1564
    /* Temporary convenience wrapper in case some people defined the
1565
       undocumented and private YY_LOCATION_PRINT macros.  */
1566
#   define YY_LOCATION_PRINT  YYLOCATION_PRINT
1567
1568
#  endif
1569
# endif /* !defined YYLOCATION_PRINT */
1570
1571
1572
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
1573
do {                                                                      \
1574
  if (yydebug)                                                            \
1575
    {                                                                     \
1576
      YYFPRINTF (stderr, "%s ", Title);                                   \
1577
      yy_symbol_print (stderr,                                            \
1578
                  Kind, Value, Location, answer, errors, locations, lexer_param_ptr); \
1579
      YYFPRINTF (stderr, "\n");                                           \
1580
    }                                                                     \
1581
} while (0)
1582
1583
1584
/*-----------------------------------.
1585
| Print this symbol's value on YYO.  |
1586
`-----------------------------------*/
1587
1588
static void
1589
yy_symbol_value_print (FILE *yyo,
1590
                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr)
1591
{
1592
  FILE *yyoutput = yyo;
1593
  YY_USE (yyoutput);
1594
  YY_USE (yylocationp);
1595
  YY_USE (answer);
1596
  YY_USE (errors);
1597
  YY_USE (locations);
1598
  YY_USE (lexer_param_ptr);
1599
  if (!yyvaluep)
1600
    return;
1601
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1602
  YY_USE (yykind);
1603
  YY_IGNORE_MAYBE_UNINITIALIZED_END
1604
}
1605
1606
1607
/*---------------------------.
1608
| Print this symbol on YYO.  |
1609
`---------------------------*/
1610
1611
static void
1612
yy_symbol_print (FILE *yyo,
1613
                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr)
1614
{
1615
  YYFPRINTF (yyo, "%s %s (",
1616
             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1617
1618
  YYLOCATION_PRINT (yyo, yylocationp);
1619
  YYFPRINTF (yyo, ": ");
1620
  yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, answer, errors, locations, lexer_param_ptr);
1621
  YYFPRINTF (yyo, ")");
1622
}
1623
1624
/*------------------------------------------------------------------.
1625
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1626
| TOP (included).                                                   |
1627
`------------------------------------------------------------------*/
1628
1629
static void
1630
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1631
{
1632
  YYFPRINTF (stderr, "Stack now");
1633
  for (; yybottom <= yytop; yybottom++)
1634
    {
1635
      int yybot = *yybottom;
1636
      YYFPRINTF (stderr, " %d", yybot);
1637
    }
1638
  YYFPRINTF (stderr, "\n");
1639
}
1640
1641
# define YY_STACK_PRINT(Bottom, Top)                            \
1642
do {                                                            \
1643
  if (yydebug)                                                  \
1644
    yy_stack_print ((Bottom), (Top));                           \
1645
} while (0)
1646
1647
1648
/*------------------------------------------------.
1649
| Report that the YYRULE is going to be reduced.  |
1650
`------------------------------------------------*/
1651
1652
static void
1653
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp,
1654
                 int yyrule, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr)
1655
{
1656
  int yylno = yyrline[yyrule];
1657
  int yynrhs = yyr2[yyrule];
1658
  int yyi;
1659
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1660
             yyrule - 1, yylno);
1661
  /* The symbols being reduced.  */
1662
  for (yyi = 0; yyi < yynrhs; yyi++)
1663
    {
1664
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
1665
      yy_symbol_print (stderr,
1666
                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1667
                       &yyvsp[(yyi + 1) - (yynrhs)],
1668
                       &(yylsp[(yyi + 1) - (yynrhs)]), answer, errors, locations, lexer_param_ptr);
1669
      YYFPRINTF (stderr, "\n");
1670
    }
1671
}
1672
1673
# define YY_REDUCE_PRINT(Rule)          \
1674
do {                                    \
1675
  if (yydebug)                          \
1676
    yy_reduce_print (yyssp, yyvsp, yylsp, Rule, answer, errors, locations, lexer_param_ptr); \
1677
} while (0)
1678
1679
/* Nonzero means print parse trace.  It is left uninitialized so that
1680
   multiple parsers can coexist.  */
1681
int yydebug;
1682
#else /* !YYDEBUG */
1683
0
# define YYDPRINTF(Args) ((void) 0)
1684
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1685
# define YY_STACK_PRINT(Bottom, Top)
1686
# define YY_REDUCE_PRINT(Rule)
1687
#endif /* !YYDEBUG */
1688
1689
1690
/* YYINITDEPTH -- initial size of the parser's stacks.  */
1691
#ifndef YYINITDEPTH
1692
0
# define YYINITDEPTH 200
1693
#endif
1694
1695
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1696
   if the built-in stack extension method is used).
1697
1698
   Do not make this value too large; the results are undefined if
1699
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1700
   evaluated with infinite-precision integer arithmetic.  */
1701
1702
#ifndef YYMAXDEPTH
1703
0
# define YYMAXDEPTH 10000
1704
#endif
1705
1706
1707
/* Context of a parse error.  */
1708
typedef struct
1709
{
1710
  yy_state_t *yyssp;
1711
  yysymbol_kind_t yytoken;
1712
  YYLTYPE *yylloc;
1713
} yypcontext_t;
1714
1715
/* Put in YYARG at most YYARGN of the expected tokens given the
1716
   current YYCTX, and return the number of tokens stored in YYARG.  If
1717
   YYARG is null, return the number of expected tokens (guaranteed to
1718
   be less than YYNTOKENS).  Return YYENOMEM on memory exhaustion.
1719
   Return 0 if there are more than YYARGN expected tokens, yet fill
1720
   YYARG up to YYARGN. */
1721
static int
1722
yypcontext_expected_tokens (const yypcontext_t *yyctx,
1723
                            yysymbol_kind_t yyarg[], int yyargn)
1724
0
{
1725
  /* Actual size of YYARG. */
1726
0
  int yycount = 0;
1727
0
  int yyn = yypact[+*yyctx->yyssp];
1728
0
  if (!yypact_value_is_default (yyn))
1729
0
    {
1730
      /* Start YYX at -YYN if negative to avoid negative indexes in
1731
         YYCHECK.  In other words, skip the first -YYN actions for
1732
         this state because they are default actions.  */
1733
0
      int yyxbegin = yyn < 0 ? -yyn : 0;
1734
      /* Stay within bounds of both yycheck and yytname.  */
1735
0
      int yychecklim = YYLAST - yyn + 1;
1736
0
      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1737
0
      int yyx;
1738
0
      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1739
0
        if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
1740
0
            && !yytable_value_is_error (yytable[yyx + yyn]))
1741
0
          {
1742
0
            if (!yyarg)
1743
0
              ++yycount;
1744
0
            else if (yycount == yyargn)
1745
0
              return 0;
1746
0
            else
1747
0
              yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
1748
0
          }
1749
0
    }
1750
0
  if (yyarg && yycount == 0 && 0 < yyargn)
1751
0
    yyarg[0] = YYSYMBOL_YYEMPTY;
1752
0
  return yycount;
1753
0
}
1754
1755
1756
1757
1758
#ifndef yystrlen
1759
# if defined __GLIBC__ && defined _STRING_H
1760
0
#  define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1761
# else
1762
/* Return the length of YYSTR.  */
1763
static YYPTRDIFF_T
1764
yystrlen (const char *yystr)
1765
{
1766
  YYPTRDIFF_T yylen;
1767
  for (yylen = 0; yystr[yylen]; yylen++)
1768
    continue;
1769
  return yylen;
1770
}
1771
# endif
1772
#endif
1773
1774
#ifndef yystpcpy
1775
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1776
0
#  define yystpcpy stpcpy
1777
# else
1778
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1779
   YYDEST.  */
1780
static char *
1781
yystpcpy (char *yydest, const char *yysrc)
1782
{
1783
  char *yyd = yydest;
1784
  const char *yys = yysrc;
1785
1786
  while ((*yyd++ = *yys++) != '\0')
1787
    continue;
1788
1789
  return yyd - 1;
1790
}
1791
# endif
1792
#endif
1793
1794
#ifndef yytnamerr
1795
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1796
   quotes and backslashes, so that it's suitable for yyerror.  The
1797
   heuristic is that double-quoting is unnecessary unless the string
1798
   contains an apostrophe, a comma, or backslash (other than
1799
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1800
   null, do not copy; instead, return the length of what the result
1801
   would have been.  */
1802
static YYPTRDIFF_T
1803
yytnamerr (char *yyres, const char *yystr)
1804
0
{
1805
0
  if (*yystr == '"')
1806
0
    {
1807
0
      YYPTRDIFF_T yyn = 0;
1808
0
      char const *yyp = yystr;
1809
0
      for (;;)
1810
0
        switch (*++yyp)
1811
0
          {
1812
0
          case '\'':
1813
0
          case ',':
1814
0
            goto do_not_strip_quotes;
1815
1816
0
          case '\\':
1817
0
            if (*++yyp != '\\')
1818
0
              goto do_not_strip_quotes;
1819
0
            else
1820
0
              goto append;
1821
1822
0
          append:
1823
0
          default:
1824
0
            if (yyres)
1825
0
              yyres[yyn] = *yyp;
1826
0
            yyn++;
1827
0
            break;
1828
1829
0
          case '"':
1830
0
            if (yyres)
1831
0
              yyres[yyn] = '\0';
1832
0
            return yyn;
1833
0
          }
1834
0
    do_not_strip_quotes: ;
1835
0
    }
1836
1837
0
  if (yyres)
1838
0
    return yystpcpy (yyres, yystr) - yyres;
1839
0
  else
1840
0
    return yystrlen (yystr);
1841
0
}
1842
#endif
1843
1844
1845
static int
1846
yy_syntax_error_arguments (const yypcontext_t *yyctx,
1847
                           yysymbol_kind_t yyarg[], int yyargn)
1848
0
{
1849
  /* Actual size of YYARG. */
1850
0
  int yycount = 0;
1851
  /* There are many possibilities here to consider:
1852
     - If this state is a consistent state with a default action, then
1853
       the only way this function was invoked is if the default action
1854
       is an error action.  In that case, don't check for expected
1855
       tokens because there are none.
1856
     - The only way there can be no lookahead present (in yychar) is if
1857
       this state is a consistent state with a default action.  Thus,
1858
       detecting the absence of a lookahead is sufficient to determine
1859
       that there is no unexpected or expected token to report.  In that
1860
       case, just report a simple "syntax error".
1861
     - Don't assume there isn't a lookahead just because this state is a
1862
       consistent state with a default action.  There might have been a
1863
       previous inconsistent state, consistent state with a non-default
1864
       action, or user semantic action that manipulated yychar.
1865
     - Of course, the expected token list depends on states to have
1866
       correct lookahead information, and it depends on the parser not
1867
       to perform extra reductions after fetching a lookahead from the
1868
       scanner and before detecting a syntax error.  Thus, state merging
1869
       (from LALR or IELR) and default reductions corrupt the expected
1870
       token list.  However, the list is correct for canonical LR with
1871
       one exception: it will still contain any token that will not be
1872
       accepted due to an error action in a later state.
1873
  */
1874
0
  if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
1875
0
    {
1876
0
      int yyn;
1877
0
      if (yyarg)
1878
0
        yyarg[yycount] = yyctx->yytoken;
1879
0
      ++yycount;
1880
0
      yyn = yypcontext_expected_tokens (yyctx,
1881
0
                                        yyarg ? yyarg + 1 : yyarg, yyargn - 1);
1882
0
      if (yyn == YYENOMEM)
1883
0
        return YYENOMEM;
1884
0
      else
1885
0
        yycount += yyn;
1886
0
    }
1887
0
  return yycount;
1888
0
}
1889
1890
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1891
   about the unexpected token YYTOKEN for the state stack whose top is
1892
   YYSSP.
1893
1894
   Return 0 if *YYMSG was successfully written.  Return -1 if *YYMSG is
1895
   not large enough to hold the message.  In that case, also set
1896
   *YYMSG_ALLOC to the required number of bytes.  Return YYENOMEM if the
1897
   required number of bytes is too large to store.  */
1898
static int
1899
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1900
                const yypcontext_t *yyctx)
1901
0
{
1902
0
  enum { YYARGS_MAX = 5 };
1903
  /* Internationalized format string. */
1904
0
  const char *yyformat = YY_NULLPTR;
1905
  /* Arguments of yyformat: reported tokens (one for the "unexpected",
1906
     one per "expected"). */
1907
0
  yysymbol_kind_t yyarg[YYARGS_MAX];
1908
  /* Cumulated lengths of YYARG.  */
1909
0
  YYPTRDIFF_T yysize = 0;
1910
1911
  /* Actual size of YYARG. */
1912
0
  int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1913
0
  if (yycount == YYENOMEM)
1914
0
    return YYENOMEM;
1915
1916
0
  switch (yycount)
1917
0
    {
1918
0
#define YYCASE_(N, S)                       \
1919
0
      case N:                               \
1920
0
        yyformat = S;                       \
1921
0
        break
1922
0
    default: /* Avoid compiler warnings. */
1923
0
      YYCASE_(0, YY_("syntax error"));
1924
0
      YYCASE_(1, YY_("syntax error, unexpected %s"));
1925
0
      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1926
0
      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1927
0
      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1928
0
      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1929
0
#undef YYCASE_
1930
0
    }
1931
1932
  /* Compute error message size.  Don't count the "%s"s, but reserve
1933
     room for the terminator.  */
1934
0
  yysize = yystrlen (yyformat) - 2 * yycount + 1;
1935
0
  {
1936
0
    int yyi;
1937
0
    for (yyi = 0; yyi < yycount; ++yyi)
1938
0
      {
1939
0
        YYPTRDIFF_T yysize1
1940
0
          = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
1941
0
        if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1942
0
          yysize = yysize1;
1943
0
        else
1944
0
          return YYENOMEM;
1945
0
      }
1946
0
  }
1947
1948
0
  if (*yymsg_alloc < yysize)
1949
0
    {
1950
0
      *yymsg_alloc = 2 * yysize;
1951
0
      if (! (yysize <= *yymsg_alloc
1952
0
             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1953
0
        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1954
0
      return -1;
1955
0
    }
1956
1957
  /* Avoid sprintf, as that infringes on the user's name space.
1958
     Don't have undefined behavior even if the translation
1959
     produced a string with the wrong number of "%s"s.  */
1960
0
  {
1961
0
    char *yyp = *yymsg;
1962
0
    int yyi = 0;
1963
0
    while ((*yyp = *yyformat) != '\0')
1964
0
      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1965
0
        {
1966
0
          yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
1967
0
          yyformat += 2;
1968
0
        }
1969
0
      else
1970
0
        {
1971
0
          ++yyp;
1972
0
          ++yyformat;
1973
0
        }
1974
0
  }
1975
0
  return 0;
1976
0
}
1977
1978
1979
/*-----------------------------------------------.
1980
| Release the memory associated to this symbol.  |
1981
`-----------------------------------------------*/
1982
1983
static void
1984
yydestruct (const char *yymsg,
1985
            yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr)
1986
0
{
1987
0
  YY_USE (yyvaluep);
1988
0
  YY_USE (yylocationp);
1989
0
  YY_USE (answer);
1990
0
  YY_USE (errors);
1991
0
  YY_USE (locations);
1992
0
  YY_USE (lexer_param_ptr);
1993
0
  if (!yymsg)
1994
0
    yymsg = "Deleting";
1995
0
  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1996
1997
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1998
0
  switch (yykind)
1999
0
    {
2000
0
    case YYSYMBOL_IDENT: /* IDENT  */
2001
0
#line 37 "src/parser.y"
2002
0
            { jv_free(((*yyvaluep).literal)); }
2003
0
#line 2004 "src/parser.c"
2004
0
        break;
2005
2006
0
    case YYSYMBOL_FIELD: /* FIELD  */
2007
0
#line 37 "src/parser.y"
2008
0
            { jv_free(((*yyvaluep).literal)); }
2009
0
#line 2010 "src/parser.c"
2010
0
        break;
2011
2012
0
    case YYSYMBOL_BINDING: /* BINDING  */
2013
0
#line 37 "src/parser.y"
2014
0
            { jv_free(((*yyvaluep).literal)); }
2015
0
#line 2016 "src/parser.c"
2016
0
        break;
2017
2018
0
    case YYSYMBOL_LITERAL: /* LITERAL  */
2019
0
#line 37 "src/parser.y"
2020
0
            { jv_free(((*yyvaluep).literal)); }
2021
0
#line 2022 "src/parser.c"
2022
0
        break;
2023
2024
0
    case YYSYMBOL_FORMAT: /* FORMAT  */
2025
0
#line 37 "src/parser.y"
2026
0
            { jv_free(((*yyvaluep).literal)); }
2027
0
#line 2028 "src/parser.c"
2028
0
        break;
2029
2030
0
    case YYSYMBOL_QQSTRING_TEXT: /* QQSTRING_TEXT  */
2031
0
#line 37 "src/parser.y"
2032
0
            { jv_free(((*yyvaluep).literal)); }
2033
0
#line 2034 "src/parser.c"
2034
0
        break;
2035
2036
0
    case YYSYMBOL_Module: /* Module  */
2037
0
#line 38 "src/parser.y"
2038
0
            { block_free(((*yyvaluep).blk)); }
2039
0
#line 2040 "src/parser.c"
2040
0
        break;
2041
2042
0
    case YYSYMBOL_Imports: /* Imports  */
2043
0
#line 38 "src/parser.y"
2044
0
            { block_free(((*yyvaluep).blk)); }
2045
0
#line 2046 "src/parser.c"
2046
0
        break;
2047
2048
0
    case YYSYMBOL_FuncDefs: /* FuncDefs  */
2049
0
#line 38 "src/parser.y"
2050
0
            { block_free(((*yyvaluep).blk)); }
2051
0
#line 2052 "src/parser.c"
2052
0
        break;
2053
2054
0
    case YYSYMBOL_Query: /* Query  */
2055
0
#line 38 "src/parser.y"
2056
0
            { block_free(((*yyvaluep).blk)); }
2057
0
#line 2058 "src/parser.c"
2058
0
        break;
2059
2060
0
    case YYSYMBOL_Expr: /* Expr  */
2061
0
#line 38 "src/parser.y"
2062
0
            { block_free(((*yyvaluep).blk)); }
2063
0
#line 2064 "src/parser.c"
2064
0
        break;
2065
2066
0
    case YYSYMBOL_Import: /* Import  */
2067
0
#line 38 "src/parser.y"
2068
0
            { block_free(((*yyvaluep).blk)); }
2069
0
#line 2070 "src/parser.c"
2070
0
        break;
2071
2072
0
    case YYSYMBOL_ImportWhat: /* ImportWhat  */
2073
0
#line 38 "src/parser.y"
2074
0
            { block_free(((*yyvaluep).blk)); }
2075
0
#line 2076 "src/parser.c"
2076
0
        break;
2077
2078
0
    case YYSYMBOL_ImportFrom: /* ImportFrom  */
2079
0
#line 38 "src/parser.y"
2080
0
            { block_free(((*yyvaluep).blk)); }
2081
0
#line 2082 "src/parser.c"
2082
0
        break;
2083
2084
0
    case YYSYMBOL_FuncDef: /* FuncDef  */
2085
0
#line 38 "src/parser.y"
2086
0
            { block_free(((*yyvaluep).blk)); }
2087
0
#line 2088 "src/parser.c"
2088
0
        break;
2089
2090
0
    case YYSYMBOL_Params: /* Params  */
2091
0
#line 38 "src/parser.y"
2092
0
            { block_free(((*yyvaluep).blk)); }
2093
0
#line 2094 "src/parser.c"
2094
0
        break;
2095
2096
0
    case YYSYMBOL_Param: /* Param  */
2097
0
#line 38 "src/parser.y"
2098
0
            { block_free(((*yyvaluep).blk)); }
2099
0
#line 2100 "src/parser.c"
2100
0
        break;
2101
2102
0
    case YYSYMBOL_StringStart: /* StringStart  */
2103
0
#line 37 "src/parser.y"
2104
0
            { jv_free(((*yyvaluep).literal)); }
2105
0
#line 2106 "src/parser.c"
2106
0
        break;
2107
2108
0
    case YYSYMBOL_String: /* String  */
2109
0
#line 38 "src/parser.y"
2110
0
            { block_free(((*yyvaluep).blk)); }
2111
0
#line 2112 "src/parser.c"
2112
0
        break;
2113
2114
0
    case YYSYMBOL_QQString: /* QQString  */
2115
0
#line 38 "src/parser.y"
2116
0
            { block_free(((*yyvaluep).blk)); }
2117
0
#line 2118 "src/parser.c"
2118
0
        break;
2119
2120
0
    case YYSYMBOL_ElseBody: /* ElseBody  */
2121
0
#line 38 "src/parser.y"
2122
0
            { block_free(((*yyvaluep).blk)); }
2123
0
#line 2124 "src/parser.c"
2124
0
        break;
2125
2126
0
    case YYSYMBOL_Term: /* Term  */
2127
0
#line 38 "src/parser.y"
2128
0
            { block_free(((*yyvaluep).blk)); }
2129
0
#line 2130 "src/parser.c"
2130
0
        break;
2131
2132
0
    case YYSYMBOL_Args: /* Args  */
2133
0
#line 38 "src/parser.y"
2134
0
            { block_free(((*yyvaluep).blk)); }
2135
0
#line 2136 "src/parser.c"
2136
0
        break;
2137
2138
0
    case YYSYMBOL_Arg: /* Arg  */
2139
0
#line 38 "src/parser.y"
2140
0
            { block_free(((*yyvaluep).blk)); }
2141
0
#line 2142 "src/parser.c"
2142
0
        break;
2143
2144
0
    case YYSYMBOL_RepPatterns: /* RepPatterns  */
2145
0
#line 38 "src/parser.y"
2146
0
            { block_free(((*yyvaluep).blk)); }
2147
0
#line 2148 "src/parser.c"
2148
0
        break;
2149
2150
0
    case YYSYMBOL_Patterns: /* Patterns  */
2151
0
#line 38 "src/parser.y"
2152
0
            { block_free(((*yyvaluep).blk)); }
2153
0
#line 2154 "src/parser.c"
2154
0
        break;
2155
2156
0
    case YYSYMBOL_Pattern: /* Pattern  */
2157
0
#line 38 "src/parser.y"
2158
0
            { block_free(((*yyvaluep).blk)); }
2159
0
#line 2160 "src/parser.c"
2160
0
        break;
2161
2162
0
    case YYSYMBOL_ArrayPats: /* ArrayPats  */
2163
0
#line 38 "src/parser.y"
2164
0
            { block_free(((*yyvaluep).blk)); }
2165
0
#line 2166 "src/parser.c"
2166
0
        break;
2167
2168
0
    case YYSYMBOL_ObjPats: /* ObjPats  */
2169
0
#line 38 "src/parser.y"
2170
0
            { block_free(((*yyvaluep).blk)); }
2171
0
#line 2172 "src/parser.c"
2172
0
        break;
2173
2174
0
    case YYSYMBOL_ObjPat: /* ObjPat  */
2175
0
#line 38 "src/parser.y"
2176
0
            { block_free(((*yyvaluep).blk)); }
2177
0
#line 2178 "src/parser.c"
2178
0
        break;
2179
2180
0
    case YYSYMBOL_Keyword: /* Keyword  */
2181
0
#line 37 "src/parser.y"
2182
0
            { jv_free(((*yyvaluep).literal)); }
2183
0
#line 2184 "src/parser.c"
2184
0
        break;
2185
2186
0
    case YYSYMBOL_DictPairs: /* DictPairs  */
2187
0
#line 38 "src/parser.y"
2188
0
            { block_free(((*yyvaluep).blk)); }
2189
0
#line 2190 "src/parser.c"
2190
0
        break;
2191
2192
0
    case YYSYMBOL_DictPair: /* DictPair  */
2193
0
#line 38 "src/parser.y"
2194
0
            { block_free(((*yyvaluep).blk)); }
2195
0
#line 2196 "src/parser.c"
2196
0
        break;
2197
2198
0
    case YYSYMBOL_DictExpr: /* DictExpr  */
2199
0
#line 38 "src/parser.y"
2200
0
            { block_free(((*yyvaluep).blk)); }
2201
0
#line 2202 "src/parser.c"
2202
0
        break;
2203
2204
0
      default:
2205
0
        break;
2206
0
    }
2207
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
2208
0
}
2209
2210
2211
2212
2213
2214
2215
/*----------.
2216
| yyparse.  |
2217
`----------*/
2218
2219
int
2220
yyparse (block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr)
2221
0
{
2222
/* Lookahead token kind.  */
2223
0
int yychar;
2224
2225
2226
/* The semantic value of the lookahead symbol.  */
2227
/* Default value used for initialization, for pacifying older GCCs
2228
   or non-GCC compilers.  */
2229
0
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
2230
0
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
2231
2232
/* Location data for the lookahead symbol.  */
2233
0
static YYLTYPE yyloc_default
2234
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2235
  = { 1, 1, 1, 1 }
2236
# endif
2237
0
;
2238
0
YYLTYPE yylloc = yyloc_default;
2239
2240
    /* Number of syntax errors so far.  */
2241
0
    int yynerrs = 0;
2242
2243
0
    yy_state_fast_t yystate = 0;
2244
    /* Number of tokens to shift before error messages enabled.  */
2245
0
    int yyerrstatus = 0;
2246
2247
    /* Refer to the stacks through separate pointers, to allow yyoverflow
2248
       to reallocate them elsewhere.  */
2249
2250
    /* Their size.  */
2251
0
    YYPTRDIFF_T yystacksize = YYINITDEPTH;
2252
2253
    /* The state stack: array, bottom, top.  */
2254
0
    yy_state_t yyssa[YYINITDEPTH];
2255
0
    yy_state_t *yyss = yyssa;
2256
0
    yy_state_t *yyssp = yyss;
2257
2258
    /* The semantic value stack: array, bottom, top.  */
2259
0
    YYSTYPE yyvsa[YYINITDEPTH];
2260
0
    YYSTYPE *yyvs = yyvsa;
2261
0
    YYSTYPE *yyvsp = yyvs;
2262
2263
    /* The location stack: array, bottom, top.  */
2264
0
    YYLTYPE yylsa[YYINITDEPTH];
2265
0
    YYLTYPE *yyls = yylsa;
2266
0
    YYLTYPE *yylsp = yyls;
2267
2268
0
  int yyn;
2269
  /* The return value of yyparse.  */
2270
0
  int yyresult;
2271
  /* Lookahead symbol kind.  */
2272
0
  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
2273
  /* The variables used to return semantic value and location from the
2274
     action routines.  */
2275
0
  YYSTYPE yyval;
2276
0
  YYLTYPE yyloc;
2277
2278
  /* The locations where the error started and ended.  */
2279
0
  YYLTYPE yyerror_range[3];
2280
2281
  /* Buffer for error messages, and its allocated size.  */
2282
0
  char yymsgbuf[128];
2283
0
  char *yymsg = yymsgbuf;
2284
0
  YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
2285
2286
0
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
2287
2288
  /* The number of symbols on the RHS of the reduced rule.
2289
     Keep to zero when no symbol should be popped.  */
2290
0
  int yylen = 0;
2291
2292
0
  YYDPRINTF ((stderr, "Starting parse\n"));
2293
2294
0
  yychar = YYEMPTY; /* Cause a token to be read.  */
2295
2296
0
  yylsp[0] = yylloc;
2297
0
  goto yysetstate;
2298
2299
2300
/*------------------------------------------------------------.
2301
| yynewstate -- push a new state, which is found in yystate.  |
2302
`------------------------------------------------------------*/
2303
0
yynewstate:
2304
  /* In all cases, when you get here, the value and location stacks
2305
     have just been pushed.  So pushing a state here evens the stacks.  */
2306
0
  yyssp++;
2307
2308
2309
/*--------------------------------------------------------------------.
2310
| yysetstate -- set current state (the top of the stack) to yystate.  |
2311
`--------------------------------------------------------------------*/
2312
0
yysetstate:
2313
0
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2314
0
  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
2315
0
  YY_IGNORE_USELESS_CAST_BEGIN
2316
0
  *yyssp = YY_CAST (yy_state_t, yystate);
2317
0
  YY_IGNORE_USELESS_CAST_END
2318
0
  YY_STACK_PRINT (yyss, yyssp);
2319
2320
0
  if (yyss + yystacksize - 1 <= yyssp)
2321
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
2322
    YYNOMEM;
2323
#else
2324
0
    {
2325
      /* Get the current used size of the three stacks, in elements.  */
2326
0
      YYPTRDIFF_T yysize = yyssp - yyss + 1;
2327
2328
# if defined yyoverflow
2329
      {
2330
        /* Give user a chance to reallocate the stack.  Use copies of
2331
           these so that the &'s don't force the real ones into
2332
           memory.  */
2333
        yy_state_t *yyss1 = yyss;
2334
        YYSTYPE *yyvs1 = yyvs;
2335
        YYLTYPE *yyls1 = yyls;
2336
2337
        /* Each stack pointer address is followed by the size of the
2338
           data in use in that stack, in bytes.  This used to be a
2339
           conditional around just the two extra args, but that might
2340
           be undefined if yyoverflow is a macro.  */
2341
        yyoverflow (YY_("memory exhausted"),
2342
                    &yyss1, yysize * YYSIZEOF (*yyssp),
2343
                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
2344
                    &yyls1, yysize * YYSIZEOF (*yylsp),
2345
                    &yystacksize);
2346
        yyss = yyss1;
2347
        yyvs = yyvs1;
2348
        yyls = yyls1;
2349
      }
2350
# else /* defined YYSTACK_RELOCATE */
2351
      /* Extend the stack our own way.  */
2352
0
      if (YYMAXDEPTH <= yystacksize)
2353
0
        YYNOMEM;
2354
0
      yystacksize *= 2;
2355
0
      if (YYMAXDEPTH < yystacksize)
2356
0
        yystacksize = YYMAXDEPTH;
2357
2358
0
      {
2359
0
        yy_state_t *yyss1 = yyss;
2360
0
        union yyalloc *yyptr =
2361
0
          YY_CAST (union yyalloc *,
2362
0
                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
2363
0
        if (! yyptr)
2364
0
          YYNOMEM;
2365
0
        YYSTACK_RELOCATE (yyss_alloc, yyss);
2366
0
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2367
0
        YYSTACK_RELOCATE (yyls_alloc, yyls);
2368
0
#  undef YYSTACK_RELOCATE
2369
0
        if (yyss1 != yyssa)
2370
0
          YYSTACK_FREE (yyss1);
2371
0
      }
2372
0
# endif
2373
2374
0
      yyssp = yyss + yysize - 1;
2375
0
      yyvsp = yyvs + yysize - 1;
2376
0
      yylsp = yyls + yysize - 1;
2377
2378
0
      YY_IGNORE_USELESS_CAST_BEGIN
2379
0
      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
2380
0
                  YY_CAST (long, yystacksize)));
2381
0
      YY_IGNORE_USELESS_CAST_END
2382
2383
0
      if (yyss + yystacksize - 1 <= yyssp)
2384
0
        YYABORT;
2385
0
    }
2386
0
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
2387
2388
2389
0
  if (yystate == YYFINAL)
2390
0
    YYACCEPT;
2391
2392
0
  goto yybackup;
2393
2394
2395
/*-----------.
2396
| yybackup.  |
2397
`-----------*/
2398
0
yybackup:
2399
  /* Do appropriate processing given the current state.  Read a
2400
     lookahead token if we need one and don't already have one.  */
2401
2402
  /* First try to decide what to do without reference to lookahead token.  */
2403
0
  yyn = yypact[yystate];
2404
0
  if (yypact_value_is_default (yyn))
2405
0
    goto yydefault;
2406
2407
  /* Not known => get a lookahead token if don't already have one.  */
2408
2409
  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
2410
0
  if (yychar == YYEMPTY)
2411
0
    {
2412
0
      YYDPRINTF ((stderr, "Reading a token\n"));
2413
0
      yychar = yylex (&yylval, &yylloc, answer, errors, locations, lexer_param_ptr);
2414
0
    }
2415
2416
0
  if (yychar <= YYEOF)
2417
0
    {
2418
0
      yychar = YYEOF;
2419
0
      yytoken = YYSYMBOL_YYEOF;
2420
0
      YYDPRINTF ((stderr, "Now at end of input.\n"));
2421
0
    }
2422
0
  else if (yychar == YYerror)
2423
0
    {
2424
      /* The scanner already issued an error message, process directly
2425
         to error recovery.  But do not keep the error token as
2426
         lookahead, it is too special and may lead us to an endless
2427
         loop in error recovery. */
2428
0
      yychar = YYUNDEF;
2429
0
      yytoken = YYSYMBOL_YYerror;
2430
0
      yyerror_range[1] = yylloc;
2431
0
      goto yyerrlab1;
2432
0
    }
2433
0
  else
2434
0
    {
2435
0
      yytoken = YYTRANSLATE (yychar);
2436
0
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2437
0
    }
2438
2439
  /* If the proper action on seeing token YYTOKEN is to reduce or to
2440
     detect an error, take that action.  */
2441
0
  yyn += yytoken;
2442
0
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2443
0
    goto yydefault;
2444
0
  yyn = yytable[yyn];
2445
0
  if (yyn <= 0)
2446
0
    {
2447
0
      if (yytable_value_is_error (yyn))
2448
0
        goto yyerrlab;
2449
0
      yyn = -yyn;
2450
0
      goto yyreduce;
2451
0
    }
2452
2453
  /* Count tokens shifted since error; after three, turn off error
2454
     status.  */
2455
0
  if (yyerrstatus)
2456
0
    yyerrstatus--;
2457
2458
  /* Shift the lookahead token.  */
2459
0
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2460
0
  yystate = yyn;
2461
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2462
0
  *++yyvsp = yylval;
2463
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
2464
0
  *++yylsp = yylloc;
2465
2466
  /* Discard the shifted token.  */
2467
0
  yychar = YYEMPTY;
2468
0
  goto yynewstate;
2469
2470
2471
/*-----------------------------------------------------------.
2472
| yydefault -- do the default action for the current state.  |
2473
`-----------------------------------------------------------*/
2474
0
yydefault:
2475
0
  yyn = yydefact[yystate];
2476
0
  if (yyn == 0)
2477
0
    goto yyerrlab;
2478
0
  goto yyreduce;
2479
2480
2481
/*-----------------------------.
2482
| yyreduce -- do a reduction.  |
2483
`-----------------------------*/
2484
0
yyreduce:
2485
  /* yyn is the number of a rule to reduce with.  */
2486
0
  yylen = yyr2[yyn];
2487
2488
  /* If YYLEN is nonzero, implement the default value of the action:
2489
     '$$ = $1'.
2490
2491
     Otherwise, the following line sets YYVAL to garbage.
2492
     This behavior is undocumented and Bison
2493
     users should not rely upon it.  Assigning to YYVAL
2494
     unconditionally makes the parser a bit smaller, and it avoids a
2495
     GCC warning that YYVAL may be used uninitialized.  */
2496
0
  yyval = yyvsp[1-yylen];
2497
2498
  /* Default location. */
2499
0
  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
2500
0
  yyerror_range[1] = yyloc;
2501
0
  YY_REDUCE_PRINT (yyn);
2502
0
  switch (yyn)
2503
0
    {
2504
0
  case 2: /* TopLevel: Module Imports Query  */
2505
0
#line 282 "src/parser.y"
2506
0
                     {
2507
0
  *answer = BLOCK((yyvsp[-2].blk), (yyvsp[-1].blk), gen_op_simple(TOP), (yyvsp[0].blk));
2508
0
}
2509
0
#line 2510 "src/parser.c"
2510
0
    break;
2511
2512
0
  case 3: /* TopLevel: Module Imports FuncDefs  */
2513
0
#line 285 "src/parser.y"
2514
0
                        {
2515
0
  *answer = BLOCK((yyvsp[-2].blk), (yyvsp[-1].blk), (yyvsp[0].blk));
2516
0
}
2517
0
#line 2518 "src/parser.c"
2518
0
    break;
2519
2520
0
  case 4: /* Module: %empty  */
2521
0
#line 290 "src/parser.y"
2522
0
       {
2523
0
  (yyval.blk) = gen_noop();
2524
0
}
2525
0
#line 2526 "src/parser.c"
2526
0
    break;
2527
2528
0
  case 5: /* Module: "module" Query ';'  */
2529
0
#line 293 "src/parser.y"
2530
0
                   {
2531
0
  if (!block_is_const((yyvsp[-1].blk))) {
2532
0
    FAIL((yylsp[-1]), "Module metadata must be constant");
2533
0
    (yyval.blk) = gen_noop();
2534
0
    block_free((yyvsp[-1].blk));
2535
0
  } else if (block_const_kind((yyvsp[-1].blk)) != JV_KIND_OBJECT) {
2536
0
    FAIL((yylsp[-1]), "Module metadata must be an object");
2537
0
    (yyval.blk) = gen_noop();
2538
0
    block_free((yyvsp[-1].blk));
2539
0
  } else {
2540
0
    (yyval.blk) = gen_module((yyvsp[-1].blk));
2541
0
  }
2542
0
}
2543
0
#line 2544 "src/parser.c"
2544
0
    break;
2545
2546
0
  case 6: /* Imports: %empty  */
2547
0
#line 308 "src/parser.y"
2548
0
       {
2549
0
  (yyval.blk) = gen_noop();
2550
0
}
2551
0
#line 2552 "src/parser.c"
2552
0
    break;
2553
2554
0
  case 7: /* Imports: Import Imports  */
2555
0
#line 311 "src/parser.y"
2556
0
               {
2557
0
  (yyval.blk) = BLOCK((yyvsp[-1].blk), (yyvsp[0].blk));
2558
0
}
2559
0
#line 2560 "src/parser.c"
2560
0
    break;
2561
2562
0
  case 8: /* FuncDefs: %empty  */
2563
0
#line 316 "src/parser.y"
2564
0
       {
2565
0
  (yyval.blk) = gen_noop();
2566
0
}
2567
0
#line 2568 "src/parser.c"
2568
0
    break;
2569
2570
0
  case 9: /* FuncDefs: FuncDef FuncDefs  */
2571
0
#line 319 "src/parser.y"
2572
0
                 {
2573
0
  (yyval.blk) = block_join((yyvsp[-1].blk), (yyvsp[0].blk));
2574
0
}
2575
0
#line 2576 "src/parser.c"
2576
0
    break;
2577
2578
0
  case 10: /* Query: FuncDef Query  */
2579
0
#line 325 "src/parser.y"
2580
0
                            {
2581
0
  (yyval.blk) = block_bind_referenced((yyvsp[-1].blk), (yyvsp[0].blk), OP_IS_CALL_PSEUDO);
2582
0
}
2583
0
#line 2584 "src/parser.c"
2584
0
    break;
2585
2586
0
  case 11: /* Query: Expr "as" Patterns '|' Query  */
2587
0
#line 328 "src/parser.y"
2588
0
                             {
2589
0
  (yyval.blk) = gen_destructure((yyvsp[-4].blk), (yyvsp[-2].blk), (yyvsp[0].blk));
2590
0
}
2591
0
#line 2592 "src/parser.c"
2592
0
    break;
2593
2594
0
  case 12: /* Query: "label" BINDING '|' Query  */
2595
0
#line 331 "src/parser.y"
2596
0
                          {
2597
0
  jv v = jv_string_fmt("*label-%s", jv_string_value((yyvsp[-2].literal)));
2598
0
  (yyval.blk) = gen_location((yyloc), locations, gen_label(jv_string_value(v), (yyvsp[0].blk)));
2599
0
  jv_free((yyvsp[-2].literal));
2600
0
  jv_free(v);
2601
0
}
2602
0
#line 2603 "src/parser.c"
2603
0
    break;
2604
2605
0
  case 13: /* Query: Query '|' Query  */
2606
0
#line 337 "src/parser.y"
2607
0
                {
2608
0
  (yyval.blk) = block_join((yyvsp[-2].blk), (yyvsp[0].blk));
2609
0
}
2610
0
#line 2611 "src/parser.c"
2611
0
    break;
2612
2613
0
  case 14: /* Query: Query ',' Query  */
2614
0
#line 340 "src/parser.y"
2615
0
                {
2616
0
  (yyval.blk) = gen_both((yyvsp[-2].blk), (yyvsp[0].blk));
2617
0
}
2618
0
#line 2619 "src/parser.c"
2619
0
    break;
2620
2621
0
  case 15: /* Query: Expr  */
2622
0
#line 343 "src/parser.y"
2623
0
     {
2624
0
  (yyval.blk) = (yyvsp[0].blk);
2625
0
}
2626
0
#line 2627 "src/parser.c"
2627
0
    break;
2628
2629
0
  case 16: /* Expr: Expr "//" Expr  */
2630
0
#line 349 "src/parser.y"
2631
0
               {
2632
0
  (yyval.blk) = gen_definedor((yyvsp[-2].blk), (yyvsp[0].blk));
2633
0
}
2634
0
#line 2635 "src/parser.c"
2635
0
    break;
2636
2637
0
  case 17: /* Expr: Expr '=' Expr  */
2638
0
#line 352 "src/parser.y"
2639
0
              {
2640
0
  (yyval.blk) = gen_call("_assign", BLOCK(gen_lambda((yyvsp[-2].blk)), gen_lambda((yyvsp[0].blk))));
2641
0
}
2642
0
#line 2643 "src/parser.c"
2643
0
    break;
2644
2645
0
  case 18: /* Expr: Expr "or" Expr  */
2646
0
#line 355 "src/parser.y"
2647
0
               {
2648
0
  (yyval.blk) = gen_or((yyvsp[-2].blk), (yyvsp[0].blk));
2649
0
}
2650
0
#line 2651 "src/parser.c"
2651
0
    break;
2652
2653
0
  case 19: /* Expr: Expr "and" Expr  */
2654
0
#line 358 "src/parser.y"
2655
0
                {
2656
0
  (yyval.blk) = gen_and((yyvsp[-2].blk), (yyvsp[0].blk));
2657
0
}
2658
0
#line 2659 "src/parser.c"
2659
0
    break;
2660
2661
0
  case 20: /* Expr: Expr "//=" Expr  */
2662
0
#line 361 "src/parser.y"
2663
0
                {
2664
0
  (yyval.blk) = gen_definedor_assign((yyvsp[-2].blk), (yyvsp[0].blk));
2665
0
}
2666
0
#line 2667 "src/parser.c"
2667
0
    break;
2668
2669
0
  case 21: /* Expr: Expr "|=" Expr  */
2670
0
#line 364 "src/parser.y"
2671
0
               {
2672
0
  (yyval.blk) = gen_call("_modify", BLOCK(gen_lambda((yyvsp[-2].blk)), gen_lambda((yyvsp[0].blk))));
2673
0
}
2674
0
#line 2675 "src/parser.c"
2675
0
    break;
2676
2677
0
  case 22: /* Expr: Expr '+' Expr  */
2678
0
#line 367 "src/parser.y"
2679
0
              {
2680
0
  (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '+');
2681
0
}
2682
0
#line 2683 "src/parser.c"
2683
0
    break;
2684
2685
0
  case 23: /* Expr: Expr "+=" Expr  */
2686
0
#line 370 "src/parser.y"
2687
0
               {
2688
0
  (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '+');
2689
0
}
2690
0
#line 2691 "src/parser.c"
2691
0
    break;
2692
2693
0
  case 24: /* Expr: Expr '-' Expr  */
2694
0
#line 373 "src/parser.y"
2695
0
              {
2696
0
  (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '-');
2697
0
}
2698
0
#line 2699 "src/parser.c"
2699
0
    break;
2700
2701
0
  case 25: /* Expr: Expr "-=" Expr  */
2702
0
#line 376 "src/parser.y"
2703
0
               {
2704
0
  (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '-');
2705
0
}
2706
0
#line 2707 "src/parser.c"
2707
0
    break;
2708
2709
0
  case 26: /* Expr: Expr '*' Expr  */
2710
0
#line 379 "src/parser.y"
2711
0
              {
2712
0
  (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '*');
2713
0
}
2714
0
#line 2715 "src/parser.c"
2715
0
    break;
2716
2717
0
  case 27: /* Expr: Expr "*=" Expr  */
2718
0
#line 382 "src/parser.y"
2719
0
               {
2720
0
  (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '*');
2721
0
}
2722
0
#line 2723 "src/parser.c"
2723
0
    break;
2724
2725
0
  case 28: /* Expr: Expr '/' Expr  */
2726
0
#line 385 "src/parser.y"
2727
0
              {
2728
0
  (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '/');
2729
0
}
2730
0
#line 2731 "src/parser.c"
2731
0
    break;
2732
2733
0
  case 29: /* Expr: Expr '%' Expr  */
2734
0
#line 388 "src/parser.y"
2735
0
              {
2736
0
  (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '%');
2737
0
}
2738
0
#line 2739 "src/parser.c"
2739
0
    break;
2740
2741
0
  case 30: /* Expr: Expr "/=" Expr  */
2742
0
#line 391 "src/parser.y"
2743
0
               {
2744
0
  (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '/');
2745
0
}
2746
0
#line 2747 "src/parser.c"
2747
0
    break;
2748
2749
0
  case 31: /* Expr: Expr "%=" Expr  */
2750
0
#line 394 "src/parser.y"
2751
0
                 {
2752
0
  (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '%');
2753
0
}
2754
0
#line 2755 "src/parser.c"
2755
0
    break;
2756
2757
0
  case 32: /* Expr: Expr "==" Expr  */
2758
0
#line 397 "src/parser.y"
2759
0
               {
2760
0
  (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), EQ);
2761
0
}
2762
0
#line 2763 "src/parser.c"
2763
0
    break;
2764
2765
0
  case 33: /* Expr: Expr "!=" Expr  */
2766
0
#line 400 "src/parser.y"
2767
0
               {
2768
0
  (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), NEQ);
2769
0
}
2770
0
#line 2771 "src/parser.c"
2771
0
    break;
2772
2773
0
  case 34: /* Expr: Expr '<' Expr  */
2774
0
#line 403 "src/parser.y"
2775
0
              {
2776
0
  (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '<');
2777
0
}
2778
0
#line 2779 "src/parser.c"
2779
0
    break;
2780
2781
0
  case 35: /* Expr: Expr '>' Expr  */
2782
0
#line 406 "src/parser.y"
2783
0
              {
2784
0
  (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '>');
2785
0
}
2786
0
#line 2787 "src/parser.c"
2787
0
    break;
2788
2789
0
  case 36: /* Expr: Expr "<=" Expr  */
2790
0
#line 409 "src/parser.y"
2791
0
               {
2792
0
  (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), LESSEQ);
2793
0
}
2794
0
#line 2795 "src/parser.c"
2795
0
    break;
2796
2797
0
  case 37: /* Expr: Expr ">=" Expr  */
2798
0
#line 412 "src/parser.y"
2799
0
               {
2800
0
  (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), GREATEREQ);
2801
0
}
2802
0
#line 2803 "src/parser.c"
2803
0
    break;
2804
2805
0
  case 38: /* Expr: Term  */
2806
0
#line 415 "src/parser.y"
2807
0
                  {
2808
0
  (yyval.blk) = (yyvsp[0].blk);
2809
0
}
2810
0
#line 2811 "src/parser.c"
2811
0
    break;
2812
2813
0
  case 39: /* Import: ImportWhat ';'  */
2814
0
#line 421 "src/parser.y"
2815
0
               {
2816
0
  (yyval.blk) = (yyvsp[-1].blk);
2817
0
}
2818
0
#line 2819 "src/parser.c"
2819
0
    break;
2820
2821
0
  case 40: /* Import: ImportWhat Query ';'  */
2822
0
#line 424 "src/parser.y"
2823
0
                     {
2824
0
  if (!block_is_const((yyvsp[-1].blk))) {
2825
0
    FAIL((yylsp[-1]), "Module metadata must be constant");
2826
0
    (yyval.blk) = gen_noop();
2827
0
    block_free((yyvsp[-2].blk));
2828
0
    block_free((yyvsp[-1].blk));
2829
0
  } else if (block_const_kind((yyvsp[-1].blk)) != JV_KIND_OBJECT) {
2830
0
    FAIL((yylsp[-1]), "Module metadata must be an object");
2831
0
    (yyval.blk) = gen_noop();
2832
0
    block_free((yyvsp[-2].blk));
2833
0
    block_free((yyvsp[-1].blk));
2834
0
  } else {
2835
0
    (yyval.blk) = gen_import_meta((yyvsp[-2].blk), (yyvsp[-1].blk));
2836
0
  }
2837
0
}
2838
0
#line 2839 "src/parser.c"
2839
0
    break;
2840
2841
0
  case 41: /* ImportWhat: "import" ImportFrom "as" BINDING  */
2842
0
#line 441 "src/parser.y"
2843
0
                                 {
2844
0
  jv v = block_const((yyvsp[-2].blk));
2845
  // XXX Make gen_import take only blocks and the int is_data so we
2846
  // don't have to free so much stuff here
2847
0
  (yyval.blk) = gen_import(jv_string_value(v), jv_string_value((yyvsp[0].literal)), 1);
2848
0
  block_free((yyvsp[-2].blk));
2849
0
  jv_free((yyvsp[0].literal));
2850
0
  jv_free(v);
2851
0
}
2852
0
#line 2853 "src/parser.c"
2853
0
    break;
2854
2855
0
  case 42: /* ImportWhat: "import" ImportFrom "as" IDENT  */
2856
0
#line 450 "src/parser.y"
2857
0
                               {
2858
0
  jv v = block_const((yyvsp[-2].blk));
2859
0
  (yyval.blk) = gen_import(jv_string_value(v), jv_string_value((yyvsp[0].literal)), 0);
2860
0
  block_free((yyvsp[-2].blk));
2861
0
  jv_free((yyvsp[0].literal));
2862
0
  jv_free(v);
2863
0
}
2864
0
#line 2865 "src/parser.c"
2865
0
    break;
2866
2867
0
  case 43: /* ImportWhat: "include" ImportFrom  */
2868
0
#line 457 "src/parser.y"
2869
0
                     {
2870
0
  jv v = block_const((yyvsp[0].blk));
2871
0
  (yyval.blk) = gen_import(jv_string_value(v), NULL, 0);
2872
0
  block_free((yyvsp[0].blk));
2873
0
  jv_free(v);
2874
0
}
2875
0
#line 2876 "src/parser.c"
2876
0
    break;
2877
2878
0
  case 44: /* ImportFrom: String  */
2879
0
#line 465 "src/parser.y"
2880
0
       {
2881
0
  if (!block_is_const((yyvsp[0].blk))) {
2882
0
    FAIL((yylsp[0]), "Import path must be constant");
2883
0
    (yyval.blk) = gen_const(jv_string(""));
2884
0
    block_free((yyvsp[0].blk));
2885
0
  } else {
2886
0
    (yyval.blk) = (yyvsp[0].blk);
2887
0
  }
2888
0
}
2889
0
#line 2890 "src/parser.c"
2890
0
    break;
2891
2892
0
  case 45: /* FuncDef: "def" IDENT ':' Query ';'  */
2893
0
#line 476 "src/parser.y"
2894
0
                          {
2895
0
  (yyval.blk) = gen_function(jv_string_value((yyvsp[-3].literal)), gen_noop(), (yyvsp[-1].blk));
2896
0
  jv_free((yyvsp[-3].literal));
2897
0
}
2898
0
#line 2899 "src/parser.c"
2899
0
    break;
2900
2901
0
  case 46: /* FuncDef: "def" IDENT '(' Params ')' ':' Query ';'  */
2902
0
#line 481 "src/parser.y"
2903
0
                                         {
2904
0
  (yyval.blk) = gen_function(jv_string_value((yyvsp[-6].literal)), (yyvsp[-4].blk), (yyvsp[-1].blk));
2905
0
  jv_free((yyvsp[-6].literal));
2906
0
}
2907
0
#line 2908 "src/parser.c"
2908
0
    break;
2909
2910
0
  case 47: /* Params: Param  */
2911
0
#line 487 "src/parser.y"
2912
0
      {
2913
0
  (yyval.blk) = (yyvsp[0].blk);
2914
0
}
2915
0
#line 2916 "src/parser.c"
2916
0
    break;
2917
2918
0
  case 48: /* Params: Params ';' Param  */
2919
0
#line 490 "src/parser.y"
2920
0
                 {
2921
0
  (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk));
2922
0
}
2923
0
#line 2924 "src/parser.c"
2924
0
    break;
2925
2926
0
  case 49: /* Param: BINDING  */
2927
0
#line 495 "src/parser.y"
2928
0
        {
2929
0
  (yyval.blk) = gen_param_regular(jv_string_value((yyvsp[0].literal)));
2930
0
  jv_free((yyvsp[0].literal));
2931
0
}
2932
0
#line 2933 "src/parser.c"
2933
0
    break;
2934
2935
0
  case 50: /* Param: IDENT  */
2936
0
#line 499 "src/parser.y"
2937
0
      {
2938
0
  (yyval.blk) = gen_param(jv_string_value((yyvsp[0].literal)));
2939
0
  jv_free((yyvsp[0].literal));
2940
0
}
2941
0
#line 2942 "src/parser.c"
2942
0
    break;
2943
2944
0
  case 51: /* StringStart: FORMAT QQSTRING_START  */
2945
0
#line 506 "src/parser.y"
2946
0
                      {
2947
0
  (yyval.literal) = (yyvsp[-1].literal);
2948
0
}
2949
0
#line 2950 "src/parser.c"
2950
0
    break;
2951
2952
0
  case 52: /* StringStart: QQSTRING_START  */
2953
0
#line 509 "src/parser.y"
2954
0
               {
2955
0
  (yyval.literal) = jv_string("text");
2956
0
}
2957
0
#line 2958 "src/parser.c"
2958
0
    break;
2959
2960
0
  case 53: /* String: StringStart QQString QQSTRING_END  */
2961
0
#line 515 "src/parser.y"
2962
0
                                  {
2963
0
  (yyval.blk) = (yyvsp[-1].blk);
2964
0
  jv_free((yyvsp[-2].literal));
2965
0
}
2966
0
#line 2967 "src/parser.c"
2967
0
    break;
2968
2969
0
  case 54: /* QQString: %empty  */
2970
0
#line 522 "src/parser.y"
2971
0
       {
2972
0
  (yyval.blk) = gen_const(jv_string(""));
2973
0
}
2974
0
#line 2975 "src/parser.c"
2975
0
    break;
2976
2977
0
  case 55: /* QQString: QQString QQSTRING_TEXT  */
2978
0
#line 525 "src/parser.y"
2979
0
                       {
2980
0
  (yyval.blk) = gen_binop((yyvsp[-1].blk), gen_const((yyvsp[0].literal)), '+');
2981
0
}
2982
0
#line 2983 "src/parser.c"
2983
0
    break;
2984
2985
0
  case 56: /* QQString: QQString QQSTRING_INTERP_START Query QQSTRING_INTERP_END  */
2986
0
#line 528 "src/parser.y"
2987
0
                                                         {
2988
0
  (yyval.blk) = gen_binop((yyvsp[-3].blk), gen_format((yyvsp[-1].blk), jv_copy((yyvsp[-4].literal))), '+');
2989
0
}
2990
0
#line 2991 "src/parser.c"
2991
0
    break;
2992
2993
0
  case 57: /* ElseBody: "elif" Query "then" Query ElseBody  */
2994
0
#line 534 "src/parser.y"
2995
0
                                   {
2996
0
  (yyval.blk) = gen_cond((yyvsp[-3].blk), (yyvsp[-1].blk), (yyvsp[0].blk));
2997
0
}
2998
0
#line 2999 "src/parser.c"
2999
0
    break;
3000
3001
0
  case 58: /* ElseBody: "else" Query "end"  */
3002
0
#line 537 "src/parser.y"
3003
0
                   {
3004
0
  (yyval.blk) = (yyvsp[-1].blk);
3005
0
}
3006
0
#line 3007 "src/parser.c"
3007
0
    break;
3008
3009
0
  case 59: /* ElseBody: "end"  */
3010
0
#line 540 "src/parser.y"
3011
0
      {
3012
0
  (yyval.blk) = gen_noop();
3013
0
}
3014
0
#line 3015 "src/parser.c"
3015
0
    break;
3016
3017
0
  case 60: /* Term: '.'  */
3018
0
#line 546 "src/parser.y"
3019
0
    {
3020
0
  (yyval.blk) = gen_noop();
3021
0
}
3022
0
#line 3023 "src/parser.c"
3023
0
    break;
3024
3025
0
  case 61: /* Term: ".."  */
3026
0
#line 549 "src/parser.y"
3027
0
    {
3028
0
  (yyval.blk) = gen_call("recurse", gen_noop());
3029
0
}
3030
0
#line 3031 "src/parser.c"
3031
0
    break;
3032
3033
0
  case 62: /* Term: "break" BINDING  */
3034
0
#line 552 "src/parser.y"
3035
0
              {
3036
0
  jv v = jv_string_fmt("*label-%s", jv_string_value((yyvsp[0].literal)));     // impossible symbol
3037
0
  (yyval.blk) = gen_location((yyloc), locations,
3038
0
                    BLOCK(gen_op_unbound(LOADV, jv_string_value(v)),
3039
0
                    gen_call("error", gen_noop())));
3040
0
  jv_free(v);
3041
0
  jv_free((yyvsp[0].literal));
3042
0
}
3043
0
#line 3044 "src/parser.c"
3044
0
    break;
3045
3046
0
  case 63: /* Term: "break" error  */
3047
0
#line 560 "src/parser.y"
3048
0
            {
3049
0
  FAIL((yyloc), "break requires a label to break to");
3050
0
  (yyval.blk) = gen_noop();
3051
0
}
3052
0
#line 3053 "src/parser.c"
3053
0
    break;
3054
3055
0
  case 64: /* Term: Term FIELD '?'  */
3056
0
#line 564 "src/parser.y"
3057
0
               {
3058
0
  (yyval.blk) = gen_index_opt((yyvsp[-2].blk), gen_const((yyvsp[-1].literal)));
3059
0
}
3060
0
#line 3061 "src/parser.c"
3061
0
    break;
3062
3063
0
  case 65: /* Term: FIELD '?'  */
3064
0
#line 567 "src/parser.y"
3065
0
          {
3066
0
  (yyval.blk) = gen_index_opt(gen_noop(), gen_const((yyvsp[-1].literal)));
3067
0
}
3068
0
#line 3069 "src/parser.c"
3069
0
    break;
3070
3071
0
  case 66: /* Term: Term '.' String '?'  */
3072
0
#line 570 "src/parser.y"
3073
0
                    {
3074
0
  (yyval.blk) = gen_index_opt((yyvsp[-3].blk), (yyvsp[-1].blk));
3075
0
}
3076
0
#line 3077 "src/parser.c"
3077
0
    break;
3078
3079
0
  case 67: /* Term: '.' String '?'  */
3080
0
#line 573 "src/parser.y"
3081
0
               {
3082
0
  (yyval.blk) = gen_index_opt(gen_noop(), (yyvsp[-1].blk));
3083
0
}
3084
0
#line 3085 "src/parser.c"
3085
0
    break;
3086
3087
0
  case 68: /* Term: Term FIELD  */
3088
0
#line 576 "src/parser.y"
3089
0
                        {
3090
0
  (yyval.blk) = gen_index((yyvsp[-1].blk), gen_const((yyvsp[0].literal)));
3091
0
}
3092
0
#line 3093 "src/parser.c"
3093
0
    break;
3094
3095
0
  case 69: /* Term: FIELD  */
3096
0
#line 579 "src/parser.y"
3097
0
                   {
3098
0
  (yyval.blk) = gen_index(gen_noop(), gen_const((yyvsp[0].literal)));
3099
0
}
3100
0
#line 3101 "src/parser.c"
3101
0
    break;
3102
3103
0
  case 70: /* Term: Term '.' String  */
3104
0
#line 582 "src/parser.y"
3105
0
                             {
3106
0
  (yyval.blk) = gen_index((yyvsp[-2].blk), (yyvsp[0].blk));
3107
0
}
3108
0
#line 3109 "src/parser.c"
3109
0
    break;
3110
3111
0
  case 71: /* Term: '.' String  */
3112
0
#line 585 "src/parser.y"
3113
0
                        {
3114
0
  (yyval.blk) = gen_index(gen_noop(), (yyvsp[0].blk));
3115
0
}
3116
0
#line 3117 "src/parser.c"
3117
0
    break;
3118
3119
0
  case 72: /* Term: '.' error  */
3120
0
#line 588 "src/parser.y"
3121
0
          {
3122
0
  FAIL((yyloc), "try .[\"field\"] instead of .field for unusually named fields");
3123
0
  (yyval.blk) = gen_noop();
3124
0
}
3125
0
#line 3126 "src/parser.c"
3126
0
    break;
3127
3128
0
  case 73: /* Term: '.' IDENT error  */
3129
0
#line 592 "src/parser.y"
3130
0
                {
3131
0
  jv_free((yyvsp[-1].literal));
3132
0
  FAIL((yyloc), "try .[\"field\"] instead of .field for unusually named fields");
3133
0
  (yyval.blk) = gen_noop();
3134
0
}
3135
0
#line 3136 "src/parser.c"
3136
0
    break;
3137
3138
0
  case 74: /* Term: Term '[' Query ']' '?'  */
3139
0
#line 598 "src/parser.y"
3140
0
                       {
3141
0
  (yyval.blk) = gen_index_opt((yyvsp[-4].blk), (yyvsp[-2].blk));
3142
0
}
3143
0
#line 3144 "src/parser.c"
3144
0
    break;
3145
3146
0
  case 75: /* Term: Term '[' Query ']'  */
3147
0
#line 601 "src/parser.y"
3148
0
                                {
3149
0
  (yyval.blk) = gen_index((yyvsp[-3].blk), (yyvsp[-1].blk));
3150
0
}
3151
0
#line 3152 "src/parser.c"
3152
0
    break;
3153
3154
0
  case 76: /* Term: Term '.' '[' Query ']' '?'  */
3155
0
#line 604 "src/parser.y"
3156
0
                           {
3157
0
  (yyval.blk) = gen_index_opt((yyvsp[-5].blk), (yyvsp[-2].blk));
3158
0
}
3159
0
#line 3160 "src/parser.c"
3160
0
    break;
3161
3162
0
  case 77: /* Term: Term '.' '[' Query ']'  */
3163
0
#line 607 "src/parser.y"
3164
0
                                    {
3165
0
  (yyval.blk) = gen_index((yyvsp[-4].blk), (yyvsp[-1].blk));
3166
0
}
3167
0
#line 3168 "src/parser.c"
3168
0
    break;
3169
3170
0
  case 78: /* Term: Term '[' ']' '?'  */
3171
0
#line 610 "src/parser.y"
3172
0
                 {
3173
0
  (yyval.blk) = block_join((yyvsp[-3].blk), gen_op_simple(EACH_OPT));
3174
0
}
3175
0
#line 3176 "src/parser.c"
3176
0
    break;
3177
3178
0
  case 79: /* Term: Term '[' ']'  */
3179
0
#line 613 "src/parser.y"
3180
0
                          {
3181
0
  (yyval.blk) = block_join((yyvsp[-2].blk), gen_op_simple(EACH));
3182
0
}
3183
0
#line 3184 "src/parser.c"
3184
0
    break;
3185
3186
0
  case 80: /* Term: Term '.' '[' ']' '?'  */
3187
0
#line 616 "src/parser.y"
3188
0
                     {
3189
0
  (yyval.blk) = block_join((yyvsp[-4].blk), gen_op_simple(EACH_OPT));
3190
0
}
3191
0
#line 3192 "src/parser.c"
3192
0
    break;
3193
3194
0
  case 81: /* Term: Term '.' '[' ']'  */
3195
0
#line 619 "src/parser.y"
3196
0
                              {
3197
0
  (yyval.blk) = block_join((yyvsp[-3].blk), gen_op_simple(EACH));
3198
0
}
3199
0
#line 3200 "src/parser.c"
3200
0
    break;
3201
3202
0
  case 82: /* Term: Term '[' Query ':' Query ']' '?'  */
3203
0
#line 622 "src/parser.y"
3204
0
                                 {
3205
0
  (yyval.blk) = gen_slice_index((yyvsp[-6].blk), (yyvsp[-4].blk), (yyvsp[-2].blk), INDEX_OPT);
3206
0
}
3207
0
#line 3208 "src/parser.c"
3208
0
    break;
3209
3210
0
  case 83: /* Term: Term '[' Query ':' ']' '?'  */
3211
0
#line 625 "src/parser.y"
3212
0
                           {
3213
0
  (yyval.blk) = gen_slice_index((yyvsp[-5].blk), (yyvsp[-3].blk), gen_const(jv_null()), INDEX_OPT);
3214
0
}
3215
0
#line 3216 "src/parser.c"
3216
0
    break;
3217
3218
0
  case 84: /* Term: Term '[' ':' Query ']' '?'  */
3219
0
#line 628 "src/parser.y"
3220
0
                           {
3221
0
  (yyval.blk) = gen_slice_index((yyvsp[-5].blk), gen_const(jv_null()), (yyvsp[-2].blk), INDEX_OPT);
3222
0
}
3223
0
#line 3224 "src/parser.c"
3224
0
    break;
3225
3226
0
  case 85: /* Term: Term '[' Query ':' Query ']'  */
3227
0
#line 631 "src/parser.y"
3228
0
                                          {
3229
0
  (yyval.blk) = gen_slice_index((yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk), INDEX);
3230
0
}
3231
0
#line 3232 "src/parser.c"
3232
0
    break;
3233
3234
0
  case 86: /* Term: Term '[' Query ':' ']'  */
3235
0
#line 634 "src/parser.y"
3236
0
                                    {
3237
0
  (yyval.blk) = gen_slice_index((yyvsp[-4].blk), (yyvsp[-2].blk), gen_const(jv_null()), INDEX);
3238
0
}
3239
0
#line 3240 "src/parser.c"
3240
0
    break;
3241
3242
0
  case 87: /* Term: Term '[' ':' Query ']'  */
3243
0
#line 637 "src/parser.y"
3244
0
                                    {
3245
0
  (yyval.blk) = gen_slice_index((yyvsp[-4].blk), gen_const(jv_null()), (yyvsp[-1].blk), INDEX);
3246
0
}
3247
0
#line 3248 "src/parser.c"
3248
0
    break;
3249
3250
0
  case 88: /* Term: Term '?'  */
3251
0
#line 640 "src/parser.y"
3252
0
         {
3253
0
  (yyval.blk) = gen_try((yyvsp[-1].blk), gen_op_simple(BACKTRACK));
3254
0
}
3255
0
#line 3256 "src/parser.c"
3256
0
    break;
3257
3258
0
  case 89: /* Term: LITERAL  */
3259
0
#line 643 "src/parser.y"
3260
0
        {
3261
0
  (yyval.blk) = gen_const((yyvsp[0].literal));
3262
0
}
3263
0
#line 3264 "src/parser.c"
3264
0
    break;
3265
3266
0
  case 90: /* Term: String  */
3267
0
#line 646 "src/parser.y"
3268
0
       {
3269
0
  (yyval.blk) = (yyvsp[0].blk);
3270
0
}
3271
0
#line 3272 "src/parser.c"
3272
0
    break;
3273
3274
0
  case 91: /* Term: FORMAT  */
3275
0
#line 649 "src/parser.y"
3276
0
       {
3277
0
  (yyval.blk) = gen_format(gen_noop(), (yyvsp[0].literal));
3278
0
}
3279
0
#line 3280 "src/parser.c"
3280
0
    break;
3281
3282
0
  case 92: /* Term: '-' Term  */
3283
0
#line 652 "src/parser.y"
3284
0
         {
3285
0
  (yyval.blk) = BLOCK((yyvsp[0].blk), gen_call("_negate", gen_noop()));
3286
0
}
3287
0
#line 3288 "src/parser.c"
3288
0
    break;
3289
3290
0
  case 93: /* Term: '(' Query ')'  */
3291
0
#line 655 "src/parser.y"
3292
0
              {
3293
0
  (yyval.blk) = (yyvsp[-1].blk);
3294
0
}
3295
0
#line 3296 "src/parser.c"
3296
0
    break;
3297
3298
0
  case 94: /* Term: '[' Query ']'  */
3299
0
#line 658 "src/parser.y"
3300
0
              {
3301
0
  (yyval.blk) = gen_collect((yyvsp[-1].blk));
3302
0
}
3303
0
#line 3304 "src/parser.c"
3304
0
    break;
3305
3306
0
  case 95: /* Term: '[' ']'  */
3307
0
#line 661 "src/parser.y"
3308
0
        {
3309
0
  (yyval.blk) = gen_const(jv_array());
3310
0
}
3311
0
#line 3312 "src/parser.c"
3312
0
    break;
3313
3314
0
  case 96: /* Term: '{' DictPairs '}'  */
3315
0
#line 664 "src/parser.y"
3316
0
                  {
3317
0
  block o = gen_const_object((yyvsp[-1].blk));
3318
0
  if (o.first != NULL)
3319
0
    (yyval.blk) = o;
3320
0
  else
3321
0
    (yyval.blk) = BLOCK(gen_subexp(gen_const(jv_object())), (yyvsp[-1].blk), gen_op_simple(POP));
3322
0
}
3323
0
#line 3324 "src/parser.c"
3324
0
    break;
3325
3326
0
  case 97: /* Term: "reduce" Expr "as" Patterns '(' Query ';' Query ')'  */
3327
0
#line 671 "src/parser.y"
3328
0
                                                    {
3329
0
  (yyval.blk) = gen_reduce((yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk));
3330
0
}
3331
0
#line 3332 "src/parser.c"
3332
0
    break;
3333
3334
0
  case 98: /* Term: "foreach" Expr "as" Patterns '(' Query ';' Query ';' Query ')'  */
3335
0
#line 674 "src/parser.y"
3336
0
                                                               {
3337
0
  (yyval.blk) = gen_foreach((yyvsp[-9].blk), (yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk));
3338
0
}
3339
0
#line 3340 "src/parser.c"
3340
0
    break;
3341
3342
0
  case 99: /* Term: "foreach" Expr "as" Patterns '(' Query ';' Query ')'  */
3343
0
#line 677 "src/parser.y"
3344
0
                                                     {
3345
0
  (yyval.blk) = gen_foreach((yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk), gen_noop());
3346
0
}
3347
0
#line 3348 "src/parser.c"
3348
0
    break;
3349
3350
0
  case 100: /* Term: "if" Query "then" Query ElseBody  */
3351
0
#line 680 "src/parser.y"
3352
0
                                 {
3353
0
  (yyval.blk) = gen_cond((yyvsp[-3].blk), (yyvsp[-1].blk), (yyvsp[0].blk));
3354
0
}
3355
0
#line 3356 "src/parser.c"
3356
0
    break;
3357
3358
0
  case 101: /* Term: "if" Query "then" error  */
3359
0
#line 683 "src/parser.y"
3360
0
                        {
3361
0
  FAIL((yyloc), "Possibly unterminated 'if' statement");
3362
0
  (yyval.blk) = (yyvsp[-2].blk);
3363
0
}
3364
0
#line 3365 "src/parser.c"
3365
0
    break;
3366
3367
0
  case 102: /* Term: "try" Expr "catch" Expr  */
3368
0
#line 687 "src/parser.y"
3369
0
                        {
3370
0
  (yyval.blk) = gen_try((yyvsp[-2].blk), (yyvsp[0].blk));
3371
0
}
3372
0
#line 3373 "src/parser.c"
3373
0
    break;
3374
3375
0
  case 103: /* Term: "try" Expr "catch" error  */
3376
0
#line 690 "src/parser.y"
3377
0
                         {
3378
0
  FAIL((yyloc), "Possibly unterminated 'try' statement");
3379
0
  (yyval.blk) = (yyvsp[-2].blk);
3380
0
}
3381
0
#line 3382 "src/parser.c"
3382
0
    break;
3383
3384
0
  case 104: /* Term: "try" Expr  */
3385
0
#line 694 "src/parser.y"
3386
0
           {
3387
0
  (yyval.blk) = gen_try((yyvsp[0].blk), gen_op_simple(BACKTRACK));
3388
0
}
3389
0
#line 3390 "src/parser.c"
3390
0
    break;
3391
3392
0
  case 105: /* Term: '$' '$' '$' BINDING  */
3393
0
#line 712 "src/parser.y"
3394
0
                    {
3395
0
  (yyval.blk) = gen_location((yyloc), locations, gen_op_unbound(LOADVN, jv_string_value((yyvsp[0].literal))));
3396
0
  jv_free((yyvsp[0].literal));
3397
0
}
3398
0
#line 3399 "src/parser.c"
3399
0
    break;
3400
3401
0
  case 106: /* Term: BINDING  */
3402
0
#line 716 "src/parser.y"
3403
0
        {
3404
0
  (yyval.blk) = gen_location((yyloc), locations, gen_op_unbound(LOADV, jv_string_value((yyvsp[0].literal))));
3405
0
  jv_free((yyvsp[0].literal));
3406
0
}
3407
0
#line 3408 "src/parser.c"
3408
0
    break;
3409
3410
0
  case 107: /* Term: "$__loc__"  */
3411
0
#line 720 "src/parser.y"
3412
0
           {
3413
0
  (yyval.blk) = gen_loc_object(&(yyloc), locations);
3414
0
}
3415
0
#line 3416 "src/parser.c"
3416
0
    break;
3417
3418
0
  case 108: /* Term: IDENT  */
3419
0
#line 723 "src/parser.y"
3420
0
      {
3421
0
  const char *s = jv_string_value((yyvsp[0].literal));
3422
0
  if (strcmp(s, "false") == 0)
3423
0
    (yyval.blk) = gen_const(jv_false());
3424
0
  else if (strcmp(s, "true") == 0)
3425
0
    (yyval.blk) = gen_const(jv_true());
3426
0
  else if (strcmp(s, "null") == 0)
3427
0
    (yyval.blk) = gen_const(jv_null());
3428
0
  else
3429
0
    (yyval.blk) = gen_location((yyloc), locations, gen_call(s, gen_noop()));
3430
0
  jv_free((yyvsp[0].literal));
3431
0
}
3432
0
#line 3433 "src/parser.c"
3433
0
    break;
3434
3435
0
  case 109: /* Term: IDENT '(' Args ')'  */
3436
0
#line 735 "src/parser.y"
3437
0
                   {
3438
0
  (yyval.blk) = gen_call(jv_string_value((yyvsp[-3].literal)), (yyvsp[-1].blk));
3439
0
  (yyval.blk) = gen_location((yylsp[-3]), locations, (yyval.blk));
3440
0
  jv_free((yyvsp[-3].literal));
3441
0
}
3442
0
#line 3443 "src/parser.c"
3443
0
    break;
3444
3445
0
  case 110: /* Term: '(' error ')'  */
3446
0
#line 740 "src/parser.y"
3447
0
              { (yyval.blk) = gen_noop(); }
3448
0
#line 3449 "src/parser.c"
3449
0
    break;
3450
3451
0
  case 111: /* Term: '[' error ']'  */
3452
0
#line 741 "src/parser.y"
3453
0
              { (yyval.blk) = gen_noop(); }
3454
0
#line 3455 "src/parser.c"
3455
0
    break;
3456
3457
0
  case 112: /* Term: Term '[' error ']'  */
3458
0
#line 742 "src/parser.y"
3459
0
                   { (yyval.blk) = (yyvsp[-3].blk); }
3460
0
#line 3461 "src/parser.c"
3461
0
    break;
3462
3463
0
  case 113: /* Term: '{' error '}'  */
3464
0
#line 743 "src/parser.y"
3465
0
              { (yyval.blk) = gen_noop(); }
3466
0
#line 3467 "src/parser.c"
3467
0
    break;
3468
3469
0
  case 114: /* Args: Arg  */
3470
0
#line 746 "src/parser.y"
3471
0
    {
3472
0
  (yyval.blk) = (yyvsp[0].blk);
3473
0
}
3474
0
#line 3475 "src/parser.c"
3475
0
    break;
3476
3477
0
  case 115: /* Args: Args ';' Arg  */
3478
0
#line 749 "src/parser.y"
3479
0
             {
3480
0
  (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk));
3481
0
}
3482
0
#line 3483 "src/parser.c"
3483
0
    break;
3484
3485
0
  case 116: /* Arg: Query  */
3486
0
#line 754 "src/parser.y"
3487
0
      {
3488
0
  (yyval.blk) = gen_lambda((yyvsp[0].blk));
3489
0
}
3490
0
#line 3491 "src/parser.c"
3491
0
    break;
3492
3493
0
  case 117: /* RepPatterns: RepPatterns "?//" Pattern  */
3494
0
#line 759 "src/parser.y"
3495
0
                          {
3496
0
  (yyval.blk) = BLOCK((yyvsp[-2].blk), gen_destructure_alt((yyvsp[0].blk)));
3497
0
}
3498
0
#line 3499 "src/parser.c"
3499
0
    break;
3500
3501
0
  case 118: /* RepPatterns: Pattern  */
3502
0
#line 762 "src/parser.y"
3503
0
        {
3504
0
  (yyval.blk) = gen_destructure_alt((yyvsp[0].blk));
3505
0
}
3506
0
#line 3507 "src/parser.c"
3507
0
    break;
3508
3509
0
  case 119: /* Patterns: RepPatterns "?//" Pattern  */
3510
0
#line 767 "src/parser.y"
3511
0
                          {
3512
0
  (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk));
3513
0
}
3514
0
#line 3515 "src/parser.c"
3515
0
    break;
3516
3517
0
  case 120: /* Patterns: Pattern  */
3518
0
#line 770 "src/parser.y"
3519
0
        {
3520
0
  (yyval.blk) = (yyvsp[0].blk);
3521
0
}
3522
0
#line 3523 "src/parser.c"
3523
0
    break;
3524
3525
0
  case 121: /* Pattern: BINDING  */
3526
0
#line 775 "src/parser.y"
3527
0
        {
3528
0
  (yyval.blk) = gen_op_unbound(STOREV, jv_string_value((yyvsp[0].literal)));
3529
0
  jv_free((yyvsp[0].literal));
3530
0
}
3531
0
#line 3532 "src/parser.c"
3532
0
    break;
3533
3534
0
  case 122: /* Pattern: '[' ArrayPats ']'  */
3535
0
#line 779 "src/parser.y"
3536
0
                  {
3537
0
  (yyval.blk) = BLOCK((yyvsp[-1].blk), gen_op_simple(POP));
3538
0
}
3539
0
#line 3540 "src/parser.c"
3540
0
    break;
3541
3542
0
  case 123: /* Pattern: '{' ObjPats '}'  */
3543
0
#line 782 "src/parser.y"
3544
0
                {
3545
0
  (yyval.blk) = BLOCK((yyvsp[-1].blk), gen_op_simple(POP));
3546
0
}
3547
0
#line 3548 "src/parser.c"
3548
0
    break;
3549
3550
0
  case 124: /* ArrayPats: Pattern  */
3551
0
#line 787 "src/parser.y"
3552
0
        {
3553
0
  (yyval.blk) = gen_array_matcher(gen_noop(), (yyvsp[0].blk));
3554
0
}
3555
0
#line 3556 "src/parser.c"
3556
0
    break;
3557
3558
0
  case 125: /* ArrayPats: ArrayPats ',' Pattern  */
3559
0
#line 790 "src/parser.y"
3560
0
                      {
3561
0
  (yyval.blk) = gen_array_matcher((yyvsp[-2].blk), (yyvsp[0].blk));
3562
0
}
3563
0
#line 3564 "src/parser.c"
3564
0
    break;
3565
3566
0
  case 126: /* ObjPats: ObjPat  */
3567
0
#line 795 "src/parser.y"
3568
0
       {
3569
0
  (yyval.blk) = (yyvsp[0].blk);
3570
0
}
3571
0
#line 3572 "src/parser.c"
3572
0
    break;
3573
3574
0
  case 127: /* ObjPats: ObjPats ',' ObjPat  */
3575
0
#line 798 "src/parser.y"
3576
0
                   {
3577
0
  (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk));
3578
0
}
3579
0
#line 3580 "src/parser.c"
3580
0
    break;
3581
3582
0
  case 128: /* ObjPat: BINDING  */
3583
0
#line 803 "src/parser.y"
3584
0
        {
3585
0
  (yyval.blk) = gen_object_matcher(gen_const((yyvsp[0].literal)), gen_op_unbound(STOREV, jv_string_value((yyvsp[0].literal))));
3586
0
}
3587
0
#line 3588 "src/parser.c"
3588
0
    break;
3589
3590
0
  case 129: /* ObjPat: BINDING ':' Pattern  */
3591
0
#line 806 "src/parser.y"
3592
0
                    {
3593
0
  (yyval.blk) = gen_object_matcher(gen_const((yyvsp[-2].literal)), BLOCK(gen_op_simple(DUP), gen_op_unbound(STOREV, jv_string_value((yyvsp[-2].literal))), (yyvsp[0].blk)));
3594
0
}
3595
0
#line 3596 "src/parser.c"
3596
0
    break;
3597
3598
0
  case 130: /* ObjPat: IDENT ':' Pattern  */
3599
0
#line 809 "src/parser.y"
3600
0
                  {
3601
0
  (yyval.blk) = gen_object_matcher(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk));
3602
0
}
3603
0
#line 3604 "src/parser.c"
3604
0
    break;
3605
3606
0
  case 131: /* ObjPat: Keyword ':' Pattern  */
3607
0
#line 812 "src/parser.y"
3608
0
                    {
3609
0
  (yyval.blk) = gen_object_matcher(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk));
3610
0
}
3611
0
#line 3612 "src/parser.c"
3612
0
    break;
3613
3614
0
  case 132: /* ObjPat: String ':' Pattern  */
3615
0
#line 815 "src/parser.y"
3616
0
                   {
3617
0
  (yyval.blk) = gen_object_matcher((yyvsp[-2].blk), (yyvsp[0].blk));
3618
0
}
3619
0
#line 3620 "src/parser.c"
3620
0
    break;
3621
3622
0
  case 133: /* ObjPat: '(' Query ')' ':' Pattern  */
3623
0
#line 818 "src/parser.y"
3624
0
                          {
3625
0
  jv msg = check_object_key((yyvsp[-3].blk));
3626
0
  if (jv_is_valid(msg)) {
3627
0
    FAIL((yylsp[-3]), jv_string_value(msg));
3628
0
  }
3629
0
  jv_free(msg);
3630
0
  (yyval.blk) = gen_object_matcher((yyvsp[-3].blk), (yyvsp[0].blk));
3631
0
}
3632
0
#line 3633 "src/parser.c"
3633
0
    break;
3634
3635
0
  case 134: /* ObjPat: error ':' Pattern  */
3636
0
#line 826 "src/parser.y"
3637
0
                  {
3638
0
  FAIL((yyloc), "May need parentheses around object key expression");
3639
0
  (yyval.blk) = (yyvsp[0].blk);
3640
0
}
3641
0
#line 3642 "src/parser.c"
3642
0
    break;
3643
3644
0
  case 135: /* Keyword: "as"  */
3645
0
#line 832 "src/parser.y"
3646
0
     {
3647
0
  (yyval.literal) = jv_string("as");
3648
0
}
3649
0
#line 3650 "src/parser.c"
3650
0
    break;
3651
3652
0
  case 136: /* Keyword: "def"  */
3653
0
#line 835 "src/parser.y"
3654
0
      {
3655
0
  (yyval.literal) = jv_string("def");
3656
0
}
3657
0
#line 3658 "src/parser.c"
3658
0
    break;
3659
3660
0
  case 137: /* Keyword: "module"  */
3661
0
#line 838 "src/parser.y"
3662
0
         {
3663
0
  (yyval.literal) = jv_string("module");
3664
0
}
3665
0
#line 3666 "src/parser.c"
3666
0
    break;
3667
3668
0
  case 138: /* Keyword: "import"  */
3669
0
#line 841 "src/parser.y"
3670
0
         {
3671
0
  (yyval.literal) = jv_string("import");
3672
0
}
3673
0
#line 3674 "src/parser.c"
3674
0
    break;
3675
3676
0
  case 139: /* Keyword: "include"  */
3677
0
#line 844 "src/parser.y"
3678
0
          {
3679
0
  (yyval.literal) = jv_string("include");
3680
0
}
3681
0
#line 3682 "src/parser.c"
3682
0
    break;
3683
3684
0
  case 140: /* Keyword: "if"  */
3685
0
#line 847 "src/parser.y"
3686
0
     {
3687
0
  (yyval.literal) = jv_string("if");
3688
0
}
3689
0
#line 3690 "src/parser.c"
3690
0
    break;
3691
3692
0
  case 141: /* Keyword: "then"  */
3693
0
#line 850 "src/parser.y"
3694
0
       {
3695
0
  (yyval.literal) = jv_string("then");
3696
0
}
3697
0
#line 3698 "src/parser.c"
3698
0
    break;
3699
3700
0
  case 142: /* Keyword: "else"  */
3701
0
#line 853 "src/parser.y"
3702
0
       {
3703
0
  (yyval.literal) = jv_string("else");
3704
0
}
3705
0
#line 3706 "src/parser.c"
3706
0
    break;
3707
3708
0
  case 143: /* Keyword: "elif"  */
3709
0
#line 856 "src/parser.y"
3710
0
       {
3711
0
  (yyval.literal) = jv_string("elif");
3712
0
}
3713
0
#line 3714 "src/parser.c"
3714
0
    break;
3715
3716
0
  case 144: /* Keyword: "reduce"  */
3717
0
#line 859 "src/parser.y"
3718
0
         {
3719
0
  (yyval.literal) = jv_string("reduce");
3720
0
}
3721
0
#line 3722 "src/parser.c"
3722
0
    break;
3723
3724
0
  case 145: /* Keyword: "foreach"  */
3725
0
#line 862 "src/parser.y"
3726
0
          {
3727
0
  (yyval.literal) = jv_string("foreach");
3728
0
}
3729
0
#line 3730 "src/parser.c"
3730
0
    break;
3731
3732
0
  case 146: /* Keyword: "end"  */
3733
0
#line 865 "src/parser.y"
3734
0
      {
3735
0
  (yyval.literal) = jv_string("end");
3736
0
}
3737
0
#line 3738 "src/parser.c"
3738
0
    break;
3739
3740
0
  case 147: /* Keyword: "and"  */
3741
0
#line 868 "src/parser.y"
3742
0
      {
3743
0
  (yyval.literal) = jv_string("and");
3744
0
}
3745
0
#line 3746 "src/parser.c"
3746
0
    break;
3747
3748
0
  case 148: /* Keyword: "or"  */
3749
0
#line 871 "src/parser.y"
3750
0
     {
3751
0
  (yyval.literal) = jv_string("or");
3752
0
}
3753
0
#line 3754 "src/parser.c"
3754
0
    break;
3755
3756
0
  case 149: /* Keyword: "try"  */
3757
0
#line 874 "src/parser.y"
3758
0
      {
3759
0
  (yyval.literal) = jv_string("try");
3760
0
}
3761
0
#line 3762 "src/parser.c"
3762
0
    break;
3763
3764
0
  case 150: /* Keyword: "catch"  */
3765
0
#line 877 "src/parser.y"
3766
0
        {
3767
0
  (yyval.literal) = jv_string("catch");
3768
0
}
3769
0
#line 3770 "src/parser.c"
3770
0
    break;
3771
3772
0
  case 151: /* Keyword: "label"  */
3773
0
#line 880 "src/parser.y"
3774
0
        {
3775
0
  (yyval.literal) = jv_string("label");
3776
0
}
3777
0
#line 3778 "src/parser.c"
3778
0
    break;
3779
3780
0
  case 152: /* Keyword: "break"  */
3781
0
#line 883 "src/parser.y"
3782
0
        {
3783
0
  (yyval.literal) = jv_string("break");
3784
0
}
3785
0
#line 3786 "src/parser.c"
3786
0
    break;
3787
3788
0
  case 153: /* DictPairs: %empty  */
3789
0
#line 889 "src/parser.y"
3790
0
       {
3791
0
  (yyval.blk) = gen_noop();
3792
0
}
3793
0
#line 3794 "src/parser.c"
3794
0
    break;
3795
3796
0
  case 154: /* DictPairs: DictPair  */
3797
0
#line 892 "src/parser.y"
3798
0
         {
3799
0
  (yyval.blk) = (yyvsp[0].blk);
3800
0
}
3801
0
#line 3802 "src/parser.c"
3802
0
    break;
3803
3804
0
  case 155: /* DictPairs: DictPair ',' DictPairs  */
3805
0
#line 895 "src/parser.y"
3806
0
                       {
3807
0
  (yyval.blk) = block_join((yyvsp[-2].blk), (yyvsp[0].blk));
3808
0
}
3809
0
#line 3810 "src/parser.c"
3810
0
    break;
3811
3812
0
  case 156: /* DictPair: IDENT ':' DictExpr  */
3813
0
#line 900 "src/parser.y"
3814
0
                   {
3815
0
  (yyval.blk) = gen_dictpair(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk));
3816
0
}
3817
0
#line 3818 "src/parser.c"
3818
0
    break;
3819
3820
0
  case 157: /* DictPair: Keyword ':' DictExpr  */
3821
0
#line 903 "src/parser.y"
3822
0
                     {
3823
0
  (yyval.blk) = gen_dictpair(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk));
3824
0
}
3825
0
#line 3826 "src/parser.c"
3826
0
    break;
3827
3828
0
  case 158: /* DictPair: String ':' DictExpr  */
3829
0
#line 906 "src/parser.y"
3830
0
                    {
3831
0
  (yyval.blk) = gen_dictpair((yyvsp[-2].blk), (yyvsp[0].blk));
3832
0
}
3833
0
#line 3834 "src/parser.c"
3834
0
    break;
3835
3836
0
  case 159: /* DictPair: String  */
3837
0
#line 909 "src/parser.y"
3838
0
       {
3839
0
  (yyval.blk) = gen_dictpair((yyvsp[0].blk), BLOCK(gen_op_simple(POP), gen_op_simple(DUP2),
3840
0
                              gen_op_simple(DUP2), gen_op_simple(INDEX)));
3841
0
}
3842
0
#line 3843 "src/parser.c"
3843
0
    break;
3844
3845
0
  case 160: /* DictPair: BINDING ':' DictExpr  */
3846
0
#line 913 "src/parser.y"
3847
0
                     {
3848
0
  (yyval.blk) = gen_dictpair(gen_location((yyloc), locations, gen_op_unbound(LOADV, jv_string_value((yyvsp[-2].literal)))),
3849
0
                    (yyvsp[0].blk));
3850
0
  jv_free((yyvsp[-2].literal));
3851
0
}
3852
0
#line 3853 "src/parser.c"
3853
0
    break;
3854
3855
0
  case 161: /* DictPair: BINDING  */
3856
0
#line 918 "src/parser.y"
3857
0
        {
3858
0
  (yyval.blk) = gen_dictpair(gen_const((yyvsp[0].literal)),
3859
0
                    gen_location((yyloc), locations, gen_op_unbound(LOADV, jv_string_value((yyvsp[0].literal)))));
3860
0
}
3861
0
#line 3862 "src/parser.c"
3862
0
    break;
3863
3864
0
  case 162: /* DictPair: IDENT  */
3865
0
#line 922 "src/parser.y"
3866
0
      {
3867
0
  (yyval.blk) = gen_dictpair(gen_const(jv_copy((yyvsp[0].literal))),
3868
0
                    gen_index(gen_noop(), gen_const((yyvsp[0].literal))));
3869
0
}
3870
0
#line 3871 "src/parser.c"
3871
0
    break;
3872
3873
0
  case 163: /* DictPair: "$__loc__"  */
3874
0
#line 926 "src/parser.y"
3875
0
           {
3876
0
  (yyval.blk) = gen_dictpair(gen_const(jv_string("__loc__")),
3877
0
                    gen_loc_object(&(yyloc), locations));
3878
0
}
3879
0
#line 3880 "src/parser.c"
3880
0
    break;
3881
3882
0
  case 164: /* DictPair: Keyword  */
3883
0
#line 930 "src/parser.y"
3884
0
        {
3885
0
  (yyval.blk) = gen_dictpair(gen_const(jv_copy((yyvsp[0].literal))),
3886
0
                    gen_index(gen_noop(), gen_const((yyvsp[0].literal))));
3887
0
}
3888
0
#line 3889 "src/parser.c"
3889
0
    break;
3890
3891
0
  case 165: /* DictPair: '(' Query ')' ':' DictExpr  */
3892
0
#line 934 "src/parser.y"
3893
0
                           {
3894
0
  jv msg = check_object_key((yyvsp[-3].blk));
3895
0
  if (jv_is_valid(msg)) {
3896
0
    FAIL((yylsp[-3]), jv_string_value(msg));
3897
0
  }
3898
0
  jv_free(msg);
3899
0
  (yyval.blk) = gen_dictpair((yyvsp[-3].blk), (yyvsp[0].blk));
3900
0
}
3901
0
#line 3902 "src/parser.c"
3902
0
    break;
3903
3904
0
  case 166: /* DictPair: error ':' DictExpr  */
3905
0
#line 942 "src/parser.y"
3906
0
                   {
3907
0
  FAIL((yylsp[-2]), "May need parentheses around object key expression");
3908
0
  (yyval.blk) = (yyvsp[0].blk);
3909
0
}
3910
0
#line 3911 "src/parser.c"
3911
0
    break;
3912
3913
0
  case 167: /* DictExpr: DictExpr '|' DictExpr  */
3914
0
#line 948 "src/parser.y"
3915
0
                      {
3916
0
  (yyval.blk) = block_join((yyvsp[-2].blk), (yyvsp[0].blk));
3917
0
}
3918
0
#line 3919 "src/parser.c"
3919
0
    break;
3920
3921
0
  case 168: /* DictExpr: Expr  */
3922
0
#line 951 "src/parser.y"
3923
0
     {
3924
0
  (yyval.blk) = (yyvsp[0].blk);
3925
0
}
3926
0
#line 3927 "src/parser.c"
3927
0
    break;
3928
3929
3930
0
#line 3931 "src/parser.c"
3931
3932
0
      default: break;
3933
0
    }
3934
  /* User semantic actions sometimes alter yychar, and that requires
3935
     that yytoken be updated with the new translation.  We take the
3936
     approach of translating immediately before every use of yytoken.
3937
     One alternative is translating here after every semantic action,
3938
     but that translation would be missed if the semantic action invokes
3939
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
3940
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
3941
     incorrect destructor might then be invoked immediately.  In the
3942
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
3943
     to an incorrect destructor call or verbose syntax error message
3944
     before the lookahead is translated.  */
3945
0
  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
3946
3947
0
  YYPOPSTACK (yylen);
3948
0
  yylen = 0;
3949
3950
0
  *++yyvsp = yyval;
3951
0
  *++yylsp = yyloc;
3952
3953
  /* Now 'shift' the result of the reduction.  Determine what state
3954
     that goes to, based on the state we popped back to and the rule
3955
     number reduced by.  */
3956
0
  {
3957
0
    const int yylhs = yyr1[yyn] - YYNTOKENS;
3958
0
    const int yyi = yypgoto[yylhs] + *yyssp;
3959
0
    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
3960
0
               ? yytable[yyi]
3961
0
               : yydefgoto[yylhs]);
3962
0
  }
3963
3964
0
  goto yynewstate;
3965
3966
3967
/*--------------------------------------.
3968
| yyerrlab -- here on detecting error.  |
3969
`--------------------------------------*/
3970
0
yyerrlab:
3971
  /* Make sure we have latest lookahead translation.  See comments at
3972
     user semantic actions for why this is necessary.  */
3973
0
  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
3974
  /* If not already recovering from an error, report this error.  */
3975
0
  if (!yyerrstatus)
3976
0
    {
3977
0
      ++yynerrs;
3978
0
      {
3979
0
        yypcontext_t yyctx
3980
0
          = {yyssp, yytoken, &yylloc};
3981
0
        char const *yymsgp = YY_("syntax error");
3982
0
        int yysyntax_error_status;
3983
0
        yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
3984
0
        if (yysyntax_error_status == 0)
3985
0
          yymsgp = yymsg;
3986
0
        else if (yysyntax_error_status == -1)
3987
0
          {
3988
0
            if (yymsg != yymsgbuf)
3989
0
              YYSTACK_FREE (yymsg);
3990
0
            yymsg = YY_CAST (char *,
3991
0
                             YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
3992
0
            if (yymsg)
3993
0
              {
3994
0
                yysyntax_error_status
3995
0
                  = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
3996
0
                yymsgp = yymsg;
3997
0
              }
3998
0
            else
3999
0
              {
4000
0
                yymsg = yymsgbuf;
4001
0
                yymsg_alloc = sizeof yymsgbuf;
4002
0
                yysyntax_error_status = YYENOMEM;
4003
0
              }
4004
0
          }
4005
0
        yyerror (&yylloc, answer, errors, locations, lexer_param_ptr, yymsgp);
4006
0
        if (yysyntax_error_status == YYENOMEM)
4007
0
          YYNOMEM;
4008
0
      }
4009
0
    }
4010
4011
0
  yyerror_range[1] = yylloc;
4012
0
  if (yyerrstatus == 3)
4013
0
    {
4014
      /* If just tried and failed to reuse lookahead token after an
4015
         error, discard it.  */
4016
4017
0
      if (yychar <= YYEOF)
4018
0
        {
4019
          /* Return failure if at end of input.  */
4020
0
          if (yychar == YYEOF)
4021
0
            YYABORT;
4022
0
        }
4023
0
      else
4024
0
        {
4025
0
          yydestruct ("Error: discarding",
4026
0
                      yytoken, &yylval, &yylloc, answer, errors, locations, lexer_param_ptr);
4027
0
          yychar = YYEMPTY;
4028
0
        }
4029
0
    }
4030
4031
  /* Else will try to reuse lookahead token after shifting the error
4032
     token.  */
4033
0
  goto yyerrlab1;
4034
4035
4036
/*---------------------------------------------------.
4037
| yyerrorlab -- error raised explicitly by YYERROR.  |
4038
`---------------------------------------------------*/
4039
0
yyerrorlab:
4040
  /* Pacify compilers when the user code never invokes YYERROR and the
4041
     label yyerrorlab therefore never appears in user code.  */
4042
0
  if (0)
4043
0
    YYERROR;
4044
0
  ++yynerrs;
4045
4046
  /* Do not reclaim the symbols of the rule whose action triggered
4047
     this YYERROR.  */
4048
0
  YYPOPSTACK (yylen);
4049
0
  yylen = 0;
4050
0
  YY_STACK_PRINT (yyss, yyssp);
4051
0
  yystate = *yyssp;
4052
0
  goto yyerrlab1;
4053
4054
4055
/*-------------------------------------------------------------.
4056
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
4057
`-------------------------------------------------------------*/
4058
0
yyerrlab1:
4059
0
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
4060
4061
  /* Pop stack until we find a state that shifts the error token.  */
4062
0
  for (;;)
4063
0
    {
4064
0
      yyn = yypact[yystate];
4065
0
      if (!yypact_value_is_default (yyn))
4066
0
        {
4067
0
          yyn += YYSYMBOL_YYerror;
4068
0
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
4069
0
            {
4070
0
              yyn = yytable[yyn];
4071
0
              if (0 < yyn)
4072
0
                break;
4073
0
            }
4074
0
        }
4075
4076
      /* Pop the current state because it cannot handle the error token.  */
4077
0
      if (yyssp == yyss)
4078
0
        YYABORT;
4079
4080
0
      yyerror_range[1] = *yylsp;
4081
0
      yydestruct ("Error: popping",
4082
0
                  YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp, answer, errors, locations, lexer_param_ptr);
4083
0
      YYPOPSTACK (1);
4084
0
      yystate = *yyssp;
4085
0
      YY_STACK_PRINT (yyss, yyssp);
4086
0
    }
4087
4088
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
4089
0
  *++yyvsp = yylval;
4090
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
4091
4092
0
  yyerror_range[2] = yylloc;
4093
0
  ++yylsp;
4094
0
  YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);
4095
4096
  /* Shift the error token.  */
4097
0
  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
4098
4099
0
  yystate = yyn;
4100
0
  goto yynewstate;
4101
4102
4103
/*-------------------------------------.
4104
| yyacceptlab -- YYACCEPT comes here.  |
4105
`-------------------------------------*/
4106
0
yyacceptlab:
4107
0
  yyresult = 0;
4108
0
  goto yyreturnlab;
4109
4110
4111
/*-----------------------------------.
4112
| yyabortlab -- YYABORT comes here.  |
4113
`-----------------------------------*/
4114
0
yyabortlab:
4115
0
  yyresult = 1;
4116
0
  goto yyreturnlab;
4117
4118
4119
/*-----------------------------------------------------------.
4120
| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
4121
`-----------------------------------------------------------*/
4122
0
yyexhaustedlab:
4123
0
  yyerror (&yylloc, answer, errors, locations, lexer_param_ptr, YY_("memory exhausted"));
4124
0
  yyresult = 2;
4125
0
  goto yyreturnlab;
4126
4127
4128
/*----------------------------------------------------------.
4129
| yyreturnlab -- parsing is finished, clean up and return.  |
4130
`----------------------------------------------------------*/
4131
0
yyreturnlab:
4132
0
  if (yychar != YYEMPTY)
4133
0
    {
4134
      /* Make sure we have latest lookahead translation.  See comments at
4135
         user semantic actions for why this is necessary.  */
4136
0
      yytoken = YYTRANSLATE (yychar);
4137
0
      yydestruct ("Cleanup: discarding lookahead",
4138
0
                  yytoken, &yylval, &yylloc, answer, errors, locations, lexer_param_ptr);
4139
0
    }
4140
  /* Do not reclaim the symbols of the rule whose action triggered
4141
     this YYABORT or YYACCEPT.  */
4142
0
  YYPOPSTACK (yylen);
4143
0
  YY_STACK_PRINT (yyss, yyssp);
4144
0
  while (yyssp != yyss)
4145
0
    {
4146
0
      yydestruct ("Cleanup: popping",
4147
0
                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp, answer, errors, locations, lexer_param_ptr);
4148
0
      YYPOPSTACK (1);
4149
0
    }
4150
0
#ifndef yyoverflow
4151
0
  if (yyss != yyssa)
4152
0
    YYSTACK_FREE (yyss);
4153
0
#endif
4154
0
  if (yymsg != yymsgbuf)
4155
0
    YYSTACK_FREE (yymsg);
4156
0
  return yyresult;
4157
0
}
4158
4159
#line 954 "src/parser.y"
4160
4161
4162
0
int jq_parse(struct locfile* locations, block* answer) {
4163
0
  struct lexer_param scanner;
4164
0
  YY_BUFFER_STATE buf;
4165
0
  jq_yylex_init_extra(0, &scanner.lexer);
4166
0
  buf = jq_yy_scan_bytes(locations->data, locations->length, scanner.lexer);
4167
0
  int errors = 0;
4168
0
  *answer = gen_noop();
4169
0
  yyparse(answer, &errors, locations, &scanner);
4170
0
  jq_yy_delete_buffer(buf, scanner.lexer);
4171
0
  jq_yylex_destroy(scanner.lexer);
4172
0
  if (errors > 0) {
4173
0
    block_free(*answer);
4174
0
    *answer = gen_noop();
4175
0
  }
4176
0
  return errors;
4177
0
}
4178
4179
0
int jq_parse_library(struct locfile* locations, block* answer) {
4180
0
  int errs = jq_parse(locations, answer);
4181
0
  if (errs) return errs;
4182
0
  if (block_has_main(*answer)) {
4183
0
    locfile_locate(locations, UNKNOWN_LOCATION, "jq: error: library should only have function definitions, not a main expression");
4184
0
    return 1;
4185
0
  }
4186
0
  assert(block_has_only_binders_and_imports(*answer, OP_IS_CALL_PSEUDO));
4187
0
  return 0;
4188
0
}