Coverage Report

Created: 2026-06-10 08:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/augeas/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
/* Substitute the variable and function names.  */
68
#define yyparse         augl_parse
69
0
#define yylex           augl_lex
70
0
#define yyerror         augl_error
71
0
#define yydebug         augl_debug
72
0
#define yynerrs         augl_nerrs
73
74
/* First part of user prologue.  */
75
#line 1 "parser.y"
76
77
78
#include <config.h>
79
80
#include "internal.h"
81
#include "syntax.h"
82
#include "list.h"
83
#include "errcode.h"
84
#include <stdio.h>
85
86
/* Work around a problem on FreeBSD where Bison looks for _STDLIB_H
87
 * to see if stdlib.h has been included, but the system includes
88
 * use _STDLIB_H_
89
 */
90
#if HAVE_STDLIB_H && ! defined _STDLIB_H
91
#  include <stdlib.h>
92
#  define _STDLIB_H 1
93
#endif
94
95
#define YYDEBUG 1
96
97
int augl_parse_file(struct augeas *aug, const char *name, struct term **term);
98
99
typedef void *yyscan_t;
100
typedef struct info YYLTYPE;
101
#define YYLTYPE_IS_DECLARED 1
102
/* The lack of reference counting on filename is intentional */
103
# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
104
0
  do {                                                                  \
105
0
    (Current).filename = augl_get_info(scanner)->filename;              \
106
0
    (Current).error = augl_get_info(scanner)->error;                    \
107
0
    if (N) {                                                            \
108
0
        (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;          \
109
0
        (Current).first_column = YYRHSLOC (Rhs, 1).first_column;        \
110
0
        (Current).last_line    = YYRHSLOC (Rhs, N).last_line;           \
111
0
        (Current).last_column  = YYRHSLOC (Rhs, N).last_column;         \
112
0
    } else {                                                            \
113
0
      (Current).first_line   = (Current).last_line   =                  \
114
0
      YYRHSLOC (Rhs, 0).last_line;                                    \
115
0
    (Current).first_column = (Current).last_column =                  \
116
0
      YYRHSLOC (Rhs, 0).last_column;                                  \
117
0
    }                                                                   \
118
0
  } while (0)
119
120
#line 121 "parser.c"
121
122
# ifndef YY_CAST
123
#  ifdef __cplusplus
124
#   define YY_CAST(Type, Val) static_cast<Type> (Val)
125
#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
126
#  else
127
0
#   define YY_CAST(Type, Val) ((Type) (Val))
128
#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
129
#  endif
130
# endif
131
# ifndef YY_NULLPTR
132
#  if defined __cplusplus
133
#   if 201103L <= __cplusplus
134
#    define YY_NULLPTR nullptr
135
#   else
136
#    define YY_NULLPTR 0
137
#   endif
138
#  else
139
0
#   define YY_NULLPTR ((void*)0)
140
#  endif
141
# endif
142
143
/* Use api.header.include to #include this header
144
   instead of duplicating it here.  */
145
#ifndef YY_AUGL_PARSER_H_INCLUDED
146
# define YY_AUGL_PARSER_H_INCLUDED
147
/* Debug traces.  */
148
#ifndef YYDEBUG
149
# define YYDEBUG 0
150
#endif
151
#if YYDEBUG
152
extern int augl_debug;
153
#endif
154
155
/* Token kinds.  */
156
#ifndef YYTOKENTYPE
157
# define YYTOKENTYPE
158
  enum yytokentype
159
  {
160
    YYEMPTY = -2,
161
    YYEOF = 0,                     /* "end of file"  */
162
    YYerror = 256,                 /* error  */
163
    YYUNDEF = 257,                 /* "invalid token"  */
164
    DQUOTED = 258,                 /* DQUOTED  */
165
    REGEXP = 259,                  /* REGEXP  */
166
    LIDENT = 260,                  /* LIDENT  */
167
    UIDENT = 261,                  /* UIDENT  */
168
    QIDENT = 262,                  /* QIDENT  */
169
    ARROW = 263,                   /* ARROW  */
170
    KW_MODULE = 264,               /* KW_MODULE  */
171
    KW_AUTOLOAD = 265,             /* KW_AUTOLOAD  */
172
    KW_LET = 266,                  /* KW_LET  */
173
    KW_LET_REC = 267,              /* KW_LET_REC  */
174
    KW_IN = 268,                   /* KW_IN  */
175
    KW_STRING = 269,               /* KW_STRING  */
176
    KW_REGEXP = 270,               /* KW_REGEXP  */
177
    KW_LENS = 271,                 /* KW_LENS  */
178
    KW_TEST = 272,                 /* KW_TEST  */
179
    KW_GET = 273,                  /* KW_GET  */
180
    KW_PUT = 274,                  /* KW_PUT  */
181
    KW_AFTER = 275                 /* KW_AFTER  */
182
  };
183
  typedef enum yytokentype yytoken_kind_t;
184
#endif
185
/* Token kinds.  */
186
0
#define YYEMPTY -2
187
0
#define YYEOF 0
188
0
#define YYerror 256
189
0
#define YYUNDEF 257
190
#define DQUOTED 258
191
#define REGEXP 259
192
#define LIDENT 260
193
#define UIDENT 261
194
#define QIDENT 262
195
#define ARROW 263
196
#define KW_MODULE 264
197
#define KW_AUTOLOAD 265
198
#define KW_LET 266
199
#define KW_LET_REC 267
200
#define KW_IN 268
201
#define KW_STRING 269
202
#define KW_REGEXP 270
203
#define KW_LENS 271
204
#define KW_TEST 272
205
#define KW_GET 273
206
#define KW_PUT 274
207
#define KW_AFTER 275
208
209
/* Value type.  */
210
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
211
union YYSTYPE
212
{
213
#line 89 "parser.y"
214
215
  struct term    *term;
216
  struct type    *type;
217
  struct ident   *ident;
218
  struct tree    *tree;
219
  char           *string;
220
  struct {
221
    int             nocase;
222
    char           *pattern;
223
  } regexp;
224
  int            intval;
225
  enum quant_tag quant;
226
227
#line 228 "parser.c"
228
229
};
230
typedef union YYSTYPE YYSTYPE;
231
# define YYSTYPE_IS_TRIVIAL 1
232
# define YYSTYPE_IS_DECLARED 1
233
#endif
234
235
/* Location type.  */
236
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
237
typedef struct YYLTYPE YYLTYPE;
238
struct YYLTYPE
239
{
240
  int first_line;
241
  int first_column;
242
  int last_line;
243
  int last_column;
244
};
245
# define YYLTYPE_IS_DECLARED 1
246
# define YYLTYPE_IS_TRIVIAL 1
247
#endif
248
249
250
251
252
int augl_parse (struct term **term, yyscan_t scanner);
253
254
/* "%code provides" blocks.  */
255
#line 46 "parser.y"
256
257
#include "info.h"
258
259
/* Track custom scanner state */
260
struct state {
261
  struct info *info;
262
  unsigned int comment_depth;
263
};
264
265
266
#line 267 "parser.c"
267
268
#endif /* !YY_AUGL_PARSER_H_INCLUDED  */
269
/* Symbol kind.  */
270
enum yysymbol_kind_t
271
{
272
  YYSYMBOL_YYEMPTY = -2,
273
  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
274
  YYSYMBOL_YYerror = 1,                    /* error  */
275
  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
276
  YYSYMBOL_DQUOTED = 3,                    /* DQUOTED  */
277
  YYSYMBOL_REGEXP = 4,                     /* REGEXP  */
278
  YYSYMBOL_LIDENT = 5,                     /* LIDENT  */
279
  YYSYMBOL_UIDENT = 6,                     /* UIDENT  */
280
  YYSYMBOL_QIDENT = 7,                     /* QIDENT  */
281
  YYSYMBOL_ARROW = 8,                      /* ARROW  */
282
  YYSYMBOL_KW_MODULE = 9,                  /* KW_MODULE  */
283
  YYSYMBOL_KW_AUTOLOAD = 10,               /* KW_AUTOLOAD  */
284
  YYSYMBOL_KW_LET = 11,                    /* KW_LET  */
285
  YYSYMBOL_KW_LET_REC = 12,                /* KW_LET_REC  */
286
  YYSYMBOL_KW_IN = 13,                     /* KW_IN  */
287
  YYSYMBOL_KW_STRING = 14,                 /* KW_STRING  */
288
  YYSYMBOL_KW_REGEXP = 15,                 /* KW_REGEXP  */
289
  YYSYMBOL_KW_LENS = 16,                   /* KW_LENS  */
290
  YYSYMBOL_KW_TEST = 17,                   /* KW_TEST  */
291
  YYSYMBOL_KW_GET = 18,                    /* KW_GET  */
292
  YYSYMBOL_KW_PUT = 19,                    /* KW_PUT  */
293
  YYSYMBOL_KW_AFTER = 20,                  /* KW_AFTER  */
294
  YYSYMBOL_21_ = 21,                       /* '='  */
295
  YYSYMBOL_22_ = 22,                       /* '?'  */
296
  YYSYMBOL_23_ = 23,                       /* '*'  */
297
  YYSYMBOL_24_ = 24,                       /* ';'  */
298
  YYSYMBOL_25_ = 25,                       /* '|'  */
299
  YYSYMBOL_26_ = 26,                       /* '-'  */
300
  YYSYMBOL_27_ = 27,                       /* '.'  */
301
  YYSYMBOL_28_ = 28,                       /* '('  */
302
  YYSYMBOL_29_ = 29,                       /* ')'  */
303
  YYSYMBOL_30_ = 30,                       /* '['  */
304
  YYSYMBOL_31_ = 31,                       /* ']'  */
305
  YYSYMBOL_32_ = 32,                       /* '+'  */
306
  YYSYMBOL_33_ = 33,                       /* ':'  */
307
  YYSYMBOL_34_ = 34,                       /* '{'  */
308
  YYSYMBOL_35_ = 35,                       /* '}'  */
309
  YYSYMBOL_YYACCEPT = 36,                  /* $accept  */
310
  YYSYMBOL_start = 37,                     /* start  */
311
  YYSYMBOL_autoload = 38,                  /* autoload  */
312
  YYSYMBOL_decls = 39,                     /* decls  */
313
  YYSYMBOL_test_exp = 40,                  /* test_exp  */
314
  YYSYMBOL_test_special_res = 41,          /* test_special_res  */
315
  YYSYMBOL_exp = 42,                       /* exp  */
316
  YYSYMBOL_composeexp = 43,                /* composeexp  */
317
  YYSYMBOL_unionexp = 44,                  /* unionexp  */
318
  YYSYMBOL_minusexp = 45,                  /* minusexp  */
319
  YYSYMBOL_catexp = 46,                    /* catexp  */
320
  YYSYMBOL_appexp = 47,                    /* appexp  */
321
  YYSYMBOL_aexp = 48,                      /* aexp  */
322
  YYSYMBOL_rexp = 49,                      /* rexp  */
323
  YYSYMBOL_rep = 50,                       /* rep  */
324
  YYSYMBOL_qid = 51,                       /* qid  */
325
  YYSYMBOL_param_list = 52,                /* param_list  */
326
  YYSYMBOL_param = 53,                     /* param  */
327
  YYSYMBOL_id = 54,                        /* id  */
328
  YYSYMBOL_type = 55,                      /* type  */
329
  YYSYMBOL_atype = 56,                     /* atype  */
330
  YYSYMBOL_tree_const = 57,                /* tree_const  */
331
  YYSYMBOL_tree_const2 = 58,               /* tree_const2  */
332
  YYSYMBOL_tree_branch = 59,               /* tree_branch  */
333
  YYSYMBOL_tree_label = 60                 /* tree_label  */
334
};
335
typedef enum yysymbol_kind_t yysymbol_kind_t;
336
337
338
/* Second part of user prologue.  */
339
#line 114 "parser.y"
340
341
/* Lexer */
342
extern int augl_lex (YYSTYPE * yylval_param,struct info * yylloc_param ,yyscan_t yyscanner);
343
int augl_init_lexer(struct state *state, yyscan_t * scanner);
344
void augl_close_lexer(yyscan_t *scanner);
345
int augl_lex_destroy (yyscan_t yyscanner );
346
int augl_get_lineno (yyscan_t yyscanner );
347
int augl_get_column  (yyscan_t yyscanner);
348
struct info *augl_get_info(yyscan_t yyscanner);
349
char *augl_get_text (yyscan_t yyscanner );
350
351
static void augl_error(struct info *locp, struct term **term,
352
                       yyscan_t scanner, const char *s);
353
354
/* TERM construction */
355
 static struct info *clone_info(struct info *locp);
356
 static struct term *make_module(char *ident, char *autoload,
357
                                 struct term *decls,
358
                                 struct info *locp);
359
360
 static struct term *make_bind(char *ident, struct term *params,
361
                             struct term *exp, struct term *decls,
362
                             struct info *locp);
363
 static struct term *make_bind_rec(char *ident, struct term *exp,
364
                                   struct term *decls, struct info *locp);
365
 static struct term *make_let(char *ident, struct term *params,
366
                              struct term *exp, struct term *body,
367
                              struct info *locp);
368
 static struct term *make_binop(enum term_tag tag,
369
                               struct term *left, struct term *right,
370
                               struct info *locp);
371
 static struct term *make_unop(enum term_tag tag,
372
                              struct term *exp, struct info *locp);
373
 static struct term *make_ident(char *qname, struct info *locp);
374
 static struct term *make_unit_term(struct info *locp);
375
 static struct term *make_string_term(char *value, struct info *locp);
376
 static struct term *make_regexp_term(char *pattern,
377
                                      int nocase, struct info *locp);
378
 static struct term *make_rep(struct term *exp, enum quant_tag quant,
379
                             struct info *locp);
380
381
 static struct term *make_get_test(struct term *lens, struct term *arg,
382
                                   struct info *info);
383
 static struct term *make_put_test(struct term *lens, struct term *arg,
384
                                   struct term *cmds, struct info *info);
385
 static struct term *make_test(struct term *test, struct term *result,
386
                               enum test_result_tag tr_tag,
387
                               struct term *decls, struct info *locp);
388
 static struct term *make_tree_value(struct tree *, struct info*);
389
 static struct tree *tree_concat(struct tree *, struct tree *);
390
391
#define LOC_MERGE(a, b, c)                                              \
392
0
 do {                                                                   \
393
0
   (a).filename     = (b).filename;                                     \
394
0
   (a).first_line   = (b).first_line;                                   \
395
0
   (a).first_column = (b).first_column;                                 \
396
0
   (a).last_line    = (c).last_line;                                    \
397
0
   (a).last_column  = (c).last_column;                                  \
398
0
   (a).error        = (b).error;                                        \
399
0
 } while(0);
400
401
402
#line 403 "parser.c"
403
404
405
#ifdef short
406
# undef short
407
#endif
408
409
/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
410
   <limits.h> and (if available) <stdint.h> are included
411
   so that the code can choose integer types of a good width.  */
412
413
#ifndef __PTRDIFF_MAX__
414
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
415
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
416
#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
417
#  define YY_STDINT_H
418
# endif
419
#endif
420
421
/* Narrow types that promote to a signed type and that can represent a
422
   signed or unsigned integer of at least N bits.  In tables they can
423
   save space and decrease cache pressure.  Promoting to a signed type
424
   helps avoid bugs in integer arithmetic.  */
425
426
#ifdef __INT_LEAST8_MAX__
427
typedef __INT_LEAST8_TYPE__ yytype_int8;
428
#elif defined YY_STDINT_H
429
typedef int_least8_t yytype_int8;
430
#else
431
typedef signed char yytype_int8;
432
#endif
433
434
#ifdef __INT_LEAST16_MAX__
435
typedef __INT_LEAST16_TYPE__ yytype_int16;
436
#elif defined YY_STDINT_H
437
typedef int_least16_t yytype_int16;
438
#else
439
typedef short yytype_int16;
440
#endif
441
442
/* Work around bug in HP-UX 11.23, which defines these macros
443
   incorrectly for preprocessor constants.  This workaround can likely
444
   be removed in 2023, as HPE has promised support for HP-UX 11.23
445
   (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
446
   <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
447
#ifdef __hpux
448
# undef UINT_LEAST8_MAX
449
# undef UINT_LEAST16_MAX
450
# define UINT_LEAST8_MAX 255
451
# define UINT_LEAST16_MAX 65535
452
#endif
453
454
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
455
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
456
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
457
       && UINT_LEAST8_MAX <= INT_MAX)
458
typedef uint_least8_t yytype_uint8;
459
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
460
typedef unsigned char yytype_uint8;
461
#else
462
typedef short yytype_uint8;
463
#endif
464
465
#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
466
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
467
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
468
       && UINT_LEAST16_MAX <= INT_MAX)
469
typedef uint_least16_t yytype_uint16;
470
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
471
typedef unsigned short yytype_uint16;
472
#else
473
typedef int yytype_uint16;
474
#endif
475
476
#ifndef YYPTRDIFF_T
477
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
478
0
#  define YYPTRDIFF_T __PTRDIFF_TYPE__
479
#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
480
# elif defined PTRDIFF_MAX
481
#  ifndef ptrdiff_t
482
#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
483
#  endif
484
#  define YYPTRDIFF_T ptrdiff_t
485
#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
486
# else
487
#  define YYPTRDIFF_T long
488
#  define YYPTRDIFF_MAXIMUM LONG_MAX
489
# endif
490
#endif
491
492
#ifndef YYSIZE_T
493
# ifdef __SIZE_TYPE__
494
#  define YYSIZE_T __SIZE_TYPE__
495
# elif defined size_t
496
#  define YYSIZE_T size_t
497
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
498
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
499
#  define YYSIZE_T size_t
500
# else
501
#  define YYSIZE_T unsigned
502
# endif
503
#endif
504
505
#define YYSIZE_MAXIMUM                                  \
506
0
  YY_CAST (YYPTRDIFF_T,                                 \
507
           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
508
            ? YYPTRDIFF_MAXIMUM                         \
509
            : YY_CAST (YYSIZE_T, -1)))
510
511
0
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
512
513
514
/* Stored state numbers (used for stacks). */
515
typedef yytype_int8 yy_state_t;
516
517
/* State numbers in computations.  */
518
typedef int yy_state_fast_t;
519
520
#ifndef YY_
521
# if defined YYENABLE_NLS && YYENABLE_NLS
522
#  if ENABLE_NLS
523
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
524
#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
525
#  endif
526
# endif
527
# ifndef YY_
528
0
#  define YY_(Msgid) Msgid
529
# endif
530
#endif
531
532
533
#ifndef YY_ATTRIBUTE_PURE
534
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
535
#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
536
# else
537
#  define YY_ATTRIBUTE_PURE
538
# endif
539
#endif
540
541
#ifndef YY_ATTRIBUTE_UNUSED
542
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
543
#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
544
# else
545
#  define YY_ATTRIBUTE_UNUSED
546
# endif
547
#endif
548
549
/* Suppress unused-variable warnings by "using" E.  */
550
#if ! defined lint || defined __GNUC__
551
0
# define YY_USE(E) ((void) (E))
552
#else
553
# define YY_USE(E) /* empty */
554
#endif
555
556
/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
557
#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
558
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
559
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
560
    _Pragma ("GCC diagnostic push")                                     \
561
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
562
# else
563
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
564
    _Pragma ("GCC diagnostic push")                                     \
565
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
566
    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
567
# endif
568
# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
569
    _Pragma ("GCC diagnostic pop")
570
#else
571
0
# define YY_INITIAL_VALUE(Value) Value
572
#endif
573
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
574
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
575
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
576
#endif
577
#ifndef YY_INITIAL_VALUE
578
# define YY_INITIAL_VALUE(Value) /* Nothing. */
579
#endif
580
581
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
582
# define YY_IGNORE_USELESS_CAST_BEGIN                          \
583
    _Pragma ("GCC diagnostic push")                            \
584
    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
585
# define YY_IGNORE_USELESS_CAST_END            \
586
    _Pragma ("GCC diagnostic pop")
587
#endif
588
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
589
# define YY_IGNORE_USELESS_CAST_BEGIN
590
# define YY_IGNORE_USELESS_CAST_END
591
#endif
592
593
594
0
#define YY_ASSERT(E) ((void) (0 && (E)))
595
596
#if 1
597
598
/* The parser invokes alloca or malloc; define the necessary symbols.  */
599
600
# ifdef YYSTACK_USE_ALLOCA
601
#  if YYSTACK_USE_ALLOCA
602
#   ifdef __GNUC__
603
#    define YYSTACK_ALLOC __builtin_alloca
604
#   elif defined __BUILTIN_VA_ARG_INCR
605
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
606
#   elif defined _AIX
607
#    define YYSTACK_ALLOC __alloca
608
#   elif defined _MSC_VER
609
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
610
#    define alloca _alloca
611
#   else
612
#    define YYSTACK_ALLOC alloca
613
#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
614
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
615
      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
616
#     ifndef EXIT_SUCCESS
617
#      define EXIT_SUCCESS 0
618
#     endif
619
#    endif
620
#   endif
621
#  endif
622
# endif
623
624
# ifdef YYSTACK_ALLOC
625
   /* Pacify GCC's 'empty if-body' warning.  */
626
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
627
#  ifndef YYSTACK_ALLOC_MAXIMUM
628
    /* The OS might guarantee only one guard page at the bottom of the stack,
629
       and a page size can be as small as 4096 bytes.  So we cannot safely
630
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
631
       to allow for a few compiler-allocated temporary stack slots.  */
632
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
633
#  endif
634
# else
635
#  define YYSTACK_ALLOC YYMALLOC
636
0
#  define YYSTACK_FREE YYFREE
637
#  ifndef YYSTACK_ALLOC_MAXIMUM
638
0
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
639
#  endif
640
#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
641
       && ! ((defined YYMALLOC || defined malloc) \
642
             && (defined YYFREE || defined free)))
643
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
644
#   ifndef EXIT_SUCCESS
645
#    define EXIT_SUCCESS 0
646
#   endif
647
#  endif
648
#  ifndef YYMALLOC
649
#   define YYMALLOC malloc
650
#   if ! defined malloc && ! defined EXIT_SUCCESS
651
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
652
#   endif
653
#  endif
654
#  ifndef YYFREE
655
0
#   define YYFREE free
656
#   if ! defined free && ! defined EXIT_SUCCESS
657
void free (void *); /* INFRINGES ON USER NAME SPACE */
658
#   endif
659
#  endif
660
# endif
661
#endif /* 1 */
662
663
#if (! defined yyoverflow \
664
     && (! defined __cplusplus \
665
         || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
666
             && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
667
668
/* A type that is properly aligned for any stack member.  */
669
union yyalloc
670
{
671
  yy_state_t yyss_alloc;
672
  YYSTYPE yyvs_alloc;
673
  YYLTYPE yyls_alloc;
674
};
675
676
/* The size of the maximum gap between one aligned stack and the next.  */
677
0
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
678
679
/* The size of an array large to enough to hold all stacks, each with
680
   N elements.  */
681
# define YYSTACK_BYTES(N) \
682
     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
683
             + YYSIZEOF (YYLTYPE)) \
684
      + 2 * YYSTACK_GAP_MAXIMUM)
685
686
# define YYCOPY_NEEDED 1
687
688
/* Relocate STACK from its old location to the new one.  The
689
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
690
   elements in the stack, and YYPTR gives the new location of the
691
   stack.  Advance YYPTR to a properly aligned location for the next
692
   stack.  */
693
# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
694
0
    do                                                                  \
695
0
      {                                                                 \
696
0
        YYPTRDIFF_T yynewbytes;                                         \
697
0
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
698
0
        Stack = &yyptr->Stack_alloc;                                    \
699
0
        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
700
0
        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
701
0
      }                                                                 \
702
0
    while (0)
703
704
#endif
705
706
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
707
/* Copy COUNT objects from SRC to DST.  The source and destination do
708
   not overlap.  */
709
# ifndef YYCOPY
710
#  if defined __GNUC__ && 1 < __GNUC__
711
#   define YYCOPY(Dst, Src, Count) \
712
0
      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
713
#  else
714
#   define YYCOPY(Dst, Src, Count)              \
715
      do                                        \
716
        {                                       \
717
          YYPTRDIFF_T yyi;                      \
718
          for (yyi = 0; yyi < (Count); yyi++)   \
719
            (Dst)[yyi] = (Src)[yyi];            \
720
        }                                       \
721
      while (0)
722
#  endif
723
# endif
724
#endif /* !YYCOPY_NEEDED */
725
726
/* YYFINAL -- State number of the termination state.  */
727
0
#define YYFINAL  4
728
/* YYLAST -- Last index in YYTABLE.  */
729
0
#define YYLAST   129
730
731
/* YYNTOKENS -- Number of terminals.  */
732
0
#define YYNTOKENS  36
733
/* YYNNTS -- Number of nonterminals.  */
734
#define YYNNTS  25
735
/* YYNRULES -- Number of rules.  */
736
#define YYNRULES  61
737
/* YYNSTATES -- Number of states.  */
738
#define YYNSTATES  113
739
740
/* YYMAXUTOK -- Last valid token kind.  */
741
0
#define YYMAXUTOK   275
742
743
744
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
745
   as returned by yylex, with out-of-bounds checking.  */
746
#define YYTRANSLATE(YYX)                                \
747
0
  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
748
0
   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
749
0
   : YYSYMBOL_YYUNDEF)
750
751
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
752
   as returned by yylex.  */
753
static const yytype_int8 yytranslate[] =
754
{
755
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
756
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
757
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
758
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
759
      28,    29,    23,    32,     2,    26,    27,     2,     2,     2,
760
       2,     2,     2,     2,     2,     2,     2,     2,    33,    24,
761
       2,    21,     2,    22,     2,     2,     2,     2,     2,     2,
762
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
763
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
764
       2,    30,     2,    31,     2,     2,     2,     2,     2,     2,
765
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
766
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
767
       2,     2,     2,    34,    25,    35,     2,     2,     2,     2,
768
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
769
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
770
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
771
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
772
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
773
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
774
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
775
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
776
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
777
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
778
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
779
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
780
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
781
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
782
      15,    16,    17,    18,    19,    20
783
};
784
785
#if YYDEBUG
786
/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
787
static const yytype_int16 yyrline[] =
788
{
789
       0,   179,   179,   182,   185,   187,   192,   197,   202,   208,
790
     212,   214,   217,   219,   223,   228,   230,   232,   235,   237,
791
     239,   242,   244,   247,   249,   252,   254,   257,   259,   261,
792
     263,   265,   267,   270,   272,   275,   277,   279,   282,   284,
793
     286,   288,   291,   294,   296,   299,   301,   303,   306,   308,
794
     311,   313,   315,   317,   320,   322,   325,   330,   332,   336,
795
     340,   342
796
};
797
#endif
798
799
/** Accessing symbol of state STATE.  */
800
0
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
801
802
#if 1
803
/* The user-facing name of the symbol whose (internal) number is
804
   YYSYMBOL.  No bounds checking.  */
805
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
806
807
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
808
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
809
static const char *const yytname[] =
810
{
811
  "\"end of file\"", "error", "\"invalid token\"", "DQUOTED", "REGEXP",
812
  "LIDENT", "UIDENT", "QIDENT", "ARROW", "KW_MODULE", "KW_AUTOLOAD",
813
  "KW_LET", "KW_LET_REC", "KW_IN", "KW_STRING", "KW_REGEXP", "KW_LENS",
814
  "KW_TEST", "KW_GET", "KW_PUT", "KW_AFTER", "'='", "'?'", "'*'", "';'",
815
  "'|'", "'-'", "'.'", "'('", "')'", "'['", "']'", "'+'", "':'", "'{'",
816
  "'}'", "$accept", "start", "autoload", "decls", "test_exp",
817
  "test_special_res", "exp", "composeexp", "unionexp", "minusexp",
818
  "catexp", "appexp", "aexp", "rexp", "rep", "qid", "param_list", "param",
819
  "id", "type", "atype", "tree_const", "tree_const2", "tree_branch",
820
  "tree_label", YY_NULLPTR
821
};
822
823
static const char *
824
yysymbol_name (yysymbol_kind_t yysymbol)
825
0
{
826
0
  return yytname[yysymbol];
827
0
}
828
#endif
829
830
0
#define YYPACT_NINF (-90)
831
832
#define yypact_value_is_default(Yyn) \
833
0
  ((Yyn) == YYPACT_NINF)
834
835
#define YYTABLE_NINF (-1)
836
837
#define yytable_value_is_error(Yyn) \
838
0
  0
839
840
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
841
   STATE-NUM.  */
842
static const yytype_int8 yypact[] =
843
{
844
      -1,     8,    16,    -4,   -90,    14,    26,    53,   -90,    27,
845
      29,    92,   -90,    11,    25,   -90,   -90,   -90,   -90,   -90,
846
     -90,    50,    55,    28,    -6,   -90,     1,    30,    11,    55,
847
      38,   -90,    44,    34,    52,    57,    51,    59,    92,    49,
848
     -90,    64,    56,    22,    55,    92,   -90,   -90,   -90,    60,
849
      55,   -90,    53,    11,   -90,    65,    80,   -90,    87,    92,
850
      92,    92,   -90,   -90,   -90,   -90,   -90,    44,   -90,   -90,
851
     -90,    53,    53,   -90,    82,    -5,    53,   -90,    83,   -90,
852
     100,    73,    57,    51,    59,    92,    74,   -90,   -90,    55,
853
     -90,   -90,   -90,    -5,    79,   104,   -90,    55,   -90,    44,
854
     -90,   -90,    84,   -90,    -5,   101,    73,    81,   -90,   -90,
855
      55,   -90,   -90
856
};
857
858
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
859
   Performed when YYTABLE does not specify something else to do.  Zero
860
   means the default is an error.  */
861
static const yytype_int8 yydefact[] =
862
{
863
       0,     0,     0,     0,     1,     4,     0,     9,     3,     0,
864
       0,     0,     2,    43,     0,    28,    29,    38,    39,    40,
865
      41,     0,     0,     0,     0,    27,     0,     0,    43,     0,
866
       0,    32,    61,     0,    15,    17,    19,    22,    24,    34,
867
      26,    20,     0,     0,     0,     0,    45,    46,    47,     0,
868
       0,    42,     9,    43,    60,     0,    57,    30,     0,     0,
869
       0,     0,    25,    37,    35,    36,    33,    61,    31,    12,
870
      13,     9,     9,    10,     0,     0,     9,     6,     0,    55,
871
       0,    58,    16,    18,    21,    23,     0,     8,     7,     0,
872
      50,    51,    52,     0,     0,    49,     5,     0,    57,    61,
873
      54,    11,     0,    44,     0,     0,    59,     0,    53,    48,
874
       0,    56,    14
875
};
876
877
/* YYPGOTO[NTERM-NUM].  */
878
static const yytype_int8 yypgoto[] =
879
{
880
     -90,   -90,   -90,   -34,   -90,   -90,   -22,   -90,    61,    66,
881
      58,    62,    -9,   -37,   -90,   -90,   -23,   -90,   -90,   -89,
882
     -90,   -90,    31,   -64,   -90
883
};
884
885
/* YYDEFGOTO[NTERM-NUM].  */
886
static const yytype_int8 yydefgoto[] =
887
{
888
       0,     2,     7,    12,    23,    71,    33,    34,    35,    36,
889
      37,    38,    39,    40,    66,    25,    27,    28,    49,    94,
890
      95,    41,    81,    55,    56
891
};
892
893
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
894
   positive, shift that token.  If negative, reduce the rule whose
895
   number is the opposite.  If YYTABLE_NINF, syntax error.  */
896
static const yytype_int8 yytable[] =
897
{
898
      42,    62,    24,    86,   102,    51,    46,    52,     1,    90,
899
      91,    92,    44,    45,     3,   109,     4,     5,    77,    47,
900
      48,    72,    73,    93,     6,    15,    16,    17,    76,    18,
901
      78,     8,    13,    30,    14,   107,    74,    87,    88,    26,
902
      19,    20,    96,    53,    69,    70,    29,    54,    62,    43,
903
      21,    50,    22,    15,    16,    17,    32,    18,    15,    16,
904
      17,    30,    18,    57,     9,    10,    30,   101,    19,    20,
905
      11,    63,    64,    19,    20,   105,    58,    60,    21,    31,
906
      22,    65,    59,    21,    32,    22,    61,    68,   112,    32,
907
      15,    16,    17,    75,    18,    15,    16,    17,    67,    18,
908
      79,    80,    89,    98,    97,    19,    20,    99,   103,   100,
909
      19,    20,   104,   108,   110,    21,   111,    22,    84,    82,
910
      21,    32,    22,    85,     0,    83,     0,     0,     0,   106
911
};
912
913
static const yytype_int8 yycheck[] =
914
{
915
      22,    38,    11,    67,    93,    28,     5,    29,     9,    14,
916
      15,    16,    18,    19,     6,   104,     0,    21,    52,    18,
917
      19,    43,    44,    28,    10,     3,     4,     5,    50,     7,
918
      53,     5,     5,    11,     5,    99,    45,    71,    72,    28,
919
      18,    19,    76,     5,    22,    23,    21,     3,    85,    21,
920
      28,    21,    30,     3,     4,     5,    34,     7,     3,     4,
921
       5,    11,     7,    29,    11,    12,    11,    89,    18,    19,
922
      17,    22,    23,    18,    19,    97,    24,    26,    28,    29,
923
      30,    32,    25,    28,    34,    30,    27,    31,   110,    34,
924
       3,     4,     5,    33,     7,     3,     4,     5,    34,     7,
925
      35,    21,    20,     3,    21,    18,    19,    34,    29,    35,
926
      18,    19,     8,    29,    13,    28,    35,    30,    60,    58,
927
      28,    34,    30,    61,    -1,    59,    -1,    -1,    -1,    98
928
};
929
930
/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
931
   state STATE-NUM.  */
932
static const yytype_int8 yystos[] =
933
{
934
       0,     9,    37,     6,     0,    21,    10,    38,     5,    11,
935
      12,    17,    39,     5,     5,     3,     4,     5,     7,    18,
936
      19,    28,    30,    40,    48,    51,    28,    52,    53,    21,
937
      11,    29,    34,    42,    43,    44,    45,    46,    47,    48,
938
      49,    57,    42,    21,    18,    19,     5,    18,    19,    54,
939
      21,    52,    42,     5,     3,    59,    60,    29,    24,    25,
940
      26,    27,    49,    22,    23,    32,    50,    34,    31,    22,
941
      23,    41,    42,    42,    48,    33,    42,    39,    52,    35,
942
      21,    58,    44,    45,    46,    47,    59,    39,    39,    20,
943
      14,    15,    16,    28,    55,    56,    39,    21,     3,    34,
944
      35,    42,    55,    29,     8,    42,    58,    59,    29,    55,
945
      13,    35,    42
946
};
947
948
/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
949
static const yytype_int8 yyr1[] =
950
{
951
       0,    36,    37,    38,    38,    39,    39,    39,    39,    39,
952
      40,    40,    41,    41,    42,    42,    43,    43,    44,    44,
953
      44,    45,    45,    46,    46,    47,    47,    48,    48,    48,
954
      48,    48,    48,    49,    49,    50,    50,    50,    51,    51,
955
      51,    51,    52,    52,    53,    54,    54,    54,    55,    55,
956
      56,    56,    56,    56,    57,    57,    58,    58,    59,    59,
957
      60,    60
958
};
959
960
/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
961
static const yytype_int8 yyr2[] =
962
{
963
       0,     2,     5,     2,     0,     6,     5,     5,     5,     0,
964
       3,     5,     1,     1,     7,     1,     3,     1,     3,     1,
965
       1,     3,     1,     3,     1,     2,     1,     1,     1,     1,
966
       3,     3,     2,     2,     1,     1,     1,     1,     1,     1,
967
       1,     1,     2,     0,     5,     1,     1,     1,     3,     1,
968
       1,     1,     1,     3,     4,     3,     4,     0,     2,     4,
969
       1,     0
970
};
971
972
973
enum { YYENOMEM = -2 };
974
975
#define yyerrok         (yyerrstatus = 0)
976
#define yyclearin       (yychar = YYEMPTY)
977
978
0
#define YYACCEPT        goto yyacceptlab
979
0
#define YYABORT         goto yyabortlab
980
0
#define YYERROR         goto yyerrorlab
981
0
#define YYNOMEM         goto yyexhaustedlab
982
983
984
#define YYRECOVERING()  (!!yyerrstatus)
985
986
#define YYBACKUP(Token, Value)                                    \
987
  do                                                              \
988
    if (yychar == YYEMPTY)                                        \
989
      {                                                           \
990
        yychar = (Token);                                         \
991
        yylval = (Value);                                         \
992
        YYPOPSTACK (yylen);                                       \
993
        yystate = *yyssp;                                         \
994
        goto yybackup;                                            \
995
      }                                                           \
996
    else                                                          \
997
      {                                                           \
998
        yyerror (&yylloc, term, scanner, YY_("syntax error: cannot back up")); \
999
        YYERROR;                                                  \
1000
      }                                                           \
1001
  while (0)
1002
1003
/* Backward compatibility with an undocumented macro.
1004
   Use YYerror or YYUNDEF. */
1005
#define YYERRCODE YYUNDEF
1006
1007
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1008
   If N is 0, then set CURRENT to the empty location which ends
1009
   the previous symbol: RHS[0] (always defined).  */
1010
1011
#ifndef YYLLOC_DEFAULT
1012
# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
1013
    do                                                                  \
1014
      if (N)                                                            \
1015
        {                                                               \
1016
          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
1017
          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
1018
          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
1019
          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
1020
        }                                                               \
1021
      else                                                              \
1022
        {                                                               \
1023
          (Current).first_line   = (Current).last_line   =              \
1024
            YYRHSLOC (Rhs, 0).last_line;                                \
1025
          (Current).first_column = (Current).last_column =              \
1026
            YYRHSLOC (Rhs, 0).last_column;                              \
1027
        }                                                               \
1028
    while (0)
1029
#endif
1030
1031
0
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1032
1033
1034
/* Enable debugging if requested.  */
1035
#if YYDEBUG
1036
1037
# ifndef YYFPRINTF
1038
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1039
0
#  define YYFPRINTF fprintf
1040
# endif
1041
1042
0
# define YYDPRINTF(Args)                        \
1043
0
do {                                            \
1044
0
  if (yydebug)                                  \
1045
0
    YYFPRINTF Args;                             \
1046
0
} while (0)
1047
1048
1049
/* YYLOCATION_PRINT -- Print the location on the stream.
1050
   This macro was not mandated originally: define only if we know
1051
   we won't break user code: when these are the locations we know.  */
1052
1053
# ifndef YYLOCATION_PRINT
1054
1055
#  if defined YY_LOCATION_PRINT
1056
1057
   /* Temporary convenience wrapper in case some people defined the
1058
      undocumented and private YY_LOCATION_PRINT macros.  */
1059
#   define YYLOCATION_PRINT(File, Loc)  YY_LOCATION_PRINT(File, *(Loc))
1060
1061
#  elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1062
1063
/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
1064
1065
YY_ATTRIBUTE_UNUSED
1066
static int
1067
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
1068
{
1069
  int res = 0;
1070
  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
1071
  if (0 <= yylocp->first_line)
1072
    {
1073
      res += YYFPRINTF (yyo, "%d", yylocp->first_line);
1074
      if (0 <= yylocp->first_column)
1075
        res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
1076
    }
1077
  if (0 <= yylocp->last_line)
1078
    {
1079
      if (yylocp->first_line < yylocp->last_line)
1080
        {
1081
          res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
1082
          if (0 <= end_col)
1083
            res += YYFPRINTF (yyo, ".%d", end_col);
1084
        }
1085
      else if (0 <= end_col && yylocp->first_column < end_col)
1086
        res += YYFPRINTF (yyo, "-%d", end_col);
1087
    }
1088
  return res;
1089
}
1090
1091
#   define YYLOCATION_PRINT  yy_location_print_
1092
1093
    /* Temporary convenience wrapper in case some people defined the
1094
       undocumented and private YY_LOCATION_PRINT macros.  */
1095
#   define YY_LOCATION_PRINT(File, Loc)  YYLOCATION_PRINT(File, &(Loc))
1096
1097
#  else
1098
1099
0
#   define YYLOCATION_PRINT(File, Loc) ((void) 0)
1100
    /* Temporary convenience wrapper in case some people defined the
1101
       undocumented and private YY_LOCATION_PRINT macros.  */
1102
#   define YY_LOCATION_PRINT  YYLOCATION_PRINT
1103
1104
#  endif
1105
# endif /* !defined YYLOCATION_PRINT */
1106
1107
1108
0
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
1109
0
do {                                                                      \
1110
0
  if (yydebug)                                                            \
1111
0
    {                                                                     \
1112
0
      YYFPRINTF (stderr, "%s ", Title);                                   \
1113
0
      yy_symbol_print (stderr,                                            \
1114
0
                  Kind, Value, Location, term, scanner); \
1115
0
      YYFPRINTF (stderr, "\n");                                           \
1116
0
    }                                                                     \
1117
0
} while (0)
1118
1119
1120
/*-----------------------------------.
1121
| Print this symbol's value on YYO.  |
1122
`-----------------------------------*/
1123
1124
static void
1125
yy_symbol_value_print (FILE *yyo,
1126
                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct term **term, yyscan_t scanner)
1127
0
{
1128
0
  FILE *yyoutput = yyo;
1129
0
  YY_USE (yyoutput);
1130
0
  YY_USE (yylocationp);
1131
0
  YY_USE (term);
1132
0
  YY_USE (scanner);
1133
0
  if (!yyvaluep)
1134
0
    return;
1135
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1136
0
  YY_USE (yykind);
1137
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
1138
0
}
1139
1140
1141
/*---------------------------.
1142
| Print this symbol on YYO.  |
1143
`---------------------------*/
1144
1145
static void
1146
yy_symbol_print (FILE *yyo,
1147
                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct term **term, yyscan_t scanner)
1148
0
{
1149
0
  YYFPRINTF (yyo, "%s %s (",
1150
0
             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1151
1152
0
  YYLOCATION_PRINT (yyo, yylocationp);
1153
0
  YYFPRINTF (yyo, ": ");
1154
0
  yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, term, scanner);
1155
0
  YYFPRINTF (yyo, ")");
1156
0
}
1157
1158
/*------------------------------------------------------------------.
1159
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1160
| TOP (included).                                                   |
1161
`------------------------------------------------------------------*/
1162
1163
static void
1164
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1165
0
{
1166
0
  YYFPRINTF (stderr, "Stack now");
1167
0
  for (; yybottom <= yytop; yybottom++)
1168
0
    {
1169
0
      int yybot = *yybottom;
1170
0
      YYFPRINTF (stderr, " %d", yybot);
1171
0
    }
1172
0
  YYFPRINTF (stderr, "\n");
1173
0
}
1174
1175
0
# define YY_STACK_PRINT(Bottom, Top)                            \
1176
0
do {                                                            \
1177
0
  if (yydebug)                                                  \
1178
0
    yy_stack_print ((Bottom), (Top));                           \
1179
0
} while (0)
1180
1181
1182
/*------------------------------------------------.
1183
| Report that the YYRULE is going to be reduced.  |
1184
`------------------------------------------------*/
1185
1186
static void
1187
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp,
1188
                 int yyrule, struct term **term, yyscan_t scanner)
1189
0
{
1190
0
  int yylno = yyrline[yyrule];
1191
0
  int yynrhs = yyr2[yyrule];
1192
0
  int yyi;
1193
0
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1194
0
             yyrule - 1, yylno);
1195
  /* The symbols being reduced.  */
1196
0
  for (yyi = 0; yyi < yynrhs; yyi++)
1197
0
    {
1198
0
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
1199
0
      yy_symbol_print (stderr,
1200
0
                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1201
0
                       &yyvsp[(yyi + 1) - (yynrhs)],
1202
0
                       &(yylsp[(yyi + 1) - (yynrhs)]), term, scanner);
1203
0
      YYFPRINTF (stderr, "\n");
1204
0
    }
1205
0
}
1206
1207
0
# define YY_REDUCE_PRINT(Rule)          \
1208
0
do {                                    \
1209
0
  if (yydebug)                          \
1210
0
    yy_reduce_print (yyssp, yyvsp, yylsp, Rule, term, scanner); \
1211
0
} while (0)
1212
1213
/* Nonzero means print parse trace.  It is left uninitialized so that
1214
   multiple parsers can coexist.  */
1215
int yydebug;
1216
#else /* !YYDEBUG */
1217
# define YYDPRINTF(Args) ((void) 0)
1218
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1219
# define YY_STACK_PRINT(Bottom, Top)
1220
# define YY_REDUCE_PRINT(Rule)
1221
#endif /* !YYDEBUG */
1222
1223
1224
/* YYINITDEPTH -- initial size of the parser's stacks.  */
1225
#ifndef YYINITDEPTH
1226
0
# define YYINITDEPTH 200
1227
#endif
1228
1229
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1230
   if the built-in stack extension method is used).
1231
1232
   Do not make this value too large; the results are undefined if
1233
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1234
   evaluated with infinite-precision integer arithmetic.  */
1235
1236
#ifndef YYMAXDEPTH
1237
0
# define YYMAXDEPTH 10000
1238
#endif
1239
1240
1241
/* Context of a parse error.  */
1242
typedef struct
1243
{
1244
  yy_state_t *yyssp;
1245
  yysymbol_kind_t yytoken;
1246
  YYLTYPE *yylloc;
1247
} yypcontext_t;
1248
1249
/* Put in YYARG at most YYARGN of the expected tokens given the
1250
   current YYCTX, and return the number of tokens stored in YYARG.  If
1251
   YYARG is null, return the number of expected tokens (guaranteed to
1252
   be less than YYNTOKENS).  Return YYENOMEM on memory exhaustion.
1253
   Return 0 if there are more than YYARGN expected tokens, yet fill
1254
   YYARG up to YYARGN. */
1255
static int
1256
yypcontext_expected_tokens (const yypcontext_t *yyctx,
1257
                            yysymbol_kind_t yyarg[], int yyargn)
1258
0
{
1259
  /* Actual size of YYARG. */
1260
0
  int yycount = 0;
1261
0
  int yyn = yypact[+*yyctx->yyssp];
1262
0
  if (!yypact_value_is_default (yyn))
1263
0
    {
1264
      /* Start YYX at -YYN if negative to avoid negative indexes in
1265
         YYCHECK.  In other words, skip the first -YYN actions for
1266
         this state because they are default actions.  */
1267
0
      int yyxbegin = yyn < 0 ? -yyn : 0;
1268
      /* Stay within bounds of both yycheck and yytname.  */
1269
0
      int yychecklim = YYLAST - yyn + 1;
1270
0
      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1271
0
      int yyx;
1272
0
      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1273
0
        if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
1274
0
            && !yytable_value_is_error (yytable[yyx + yyn]))
1275
0
          {
1276
0
            if (!yyarg)
1277
0
              ++yycount;
1278
0
            else if (yycount == yyargn)
1279
0
              return 0;
1280
0
            else
1281
0
              yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
1282
0
          }
1283
0
    }
1284
0
  if (yyarg && yycount == 0 && 0 < yyargn)
1285
0
    yyarg[0] = YYSYMBOL_YYEMPTY;
1286
0
  return yycount;
1287
0
}
1288
1289
1290
1291
1292
#ifndef yystrlen
1293
# if defined __GLIBC__ && defined _STRING_H
1294
0
#  define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1295
# else
1296
/* Return the length of YYSTR.  */
1297
static YYPTRDIFF_T
1298
yystrlen (const char *yystr)
1299
{
1300
  YYPTRDIFF_T yylen;
1301
  for (yylen = 0; yystr[yylen]; yylen++)
1302
    continue;
1303
  return yylen;
1304
}
1305
# endif
1306
#endif
1307
1308
#ifndef yystpcpy
1309
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1310
0
#  define yystpcpy stpcpy
1311
# else
1312
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1313
   YYDEST.  */
1314
static char *
1315
yystpcpy (char *yydest, const char *yysrc)
1316
{
1317
  char *yyd = yydest;
1318
  const char *yys = yysrc;
1319
1320
  while ((*yyd++ = *yys++) != '\0')
1321
    continue;
1322
1323
  return yyd - 1;
1324
}
1325
# endif
1326
#endif
1327
1328
#ifndef yytnamerr
1329
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1330
   quotes and backslashes, so that it's suitable for yyerror.  The
1331
   heuristic is that double-quoting is unnecessary unless the string
1332
   contains an apostrophe, a comma, or backslash (other than
1333
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1334
   null, do not copy; instead, return the length of what the result
1335
   would have been.  */
1336
static YYPTRDIFF_T
1337
yytnamerr (char *yyres, const char *yystr)
1338
0
{
1339
0
  if (*yystr == '"')
1340
0
    {
1341
0
      YYPTRDIFF_T yyn = 0;
1342
0
      char const *yyp = yystr;
1343
0
      for (;;)
1344
0
        switch (*++yyp)
1345
0
          {
1346
0
          case '\'':
1347
0
          case ',':
1348
0
            goto do_not_strip_quotes;
1349
1350
0
          case '\\':
1351
0
            if (*++yyp != '\\')
1352
0
              goto do_not_strip_quotes;
1353
0
            else
1354
0
              goto append;
1355
1356
0
          append:
1357
0
          default:
1358
0
            if (yyres)
1359
0
              yyres[yyn] = *yyp;
1360
0
            yyn++;
1361
0
            break;
1362
1363
0
          case '"':
1364
0
            if (yyres)
1365
0
              yyres[yyn] = '\0';
1366
0
            return yyn;
1367
0
          }
1368
0
    do_not_strip_quotes: ;
1369
0
    }
1370
1371
0
  if (yyres)
1372
0
    return yystpcpy (yyres, yystr) - yyres;
1373
0
  else
1374
0
    return yystrlen (yystr);
1375
0
}
1376
#endif
1377
1378
1379
static int
1380
yy_syntax_error_arguments (const yypcontext_t *yyctx,
1381
                           yysymbol_kind_t yyarg[], int yyargn)
1382
0
{
1383
  /* Actual size of YYARG. */
1384
0
  int yycount = 0;
1385
  /* There are many possibilities here to consider:
1386
     - If this state is a consistent state with a default action, then
1387
       the only way this function was invoked is if the default action
1388
       is an error action.  In that case, don't check for expected
1389
       tokens because there are none.
1390
     - The only way there can be no lookahead present (in yychar) is if
1391
       this state is a consistent state with a default action.  Thus,
1392
       detecting the absence of a lookahead is sufficient to determine
1393
       that there is no unexpected or expected token to report.  In that
1394
       case, just report a simple "syntax error".
1395
     - Don't assume there isn't a lookahead just because this state is a
1396
       consistent state with a default action.  There might have been a
1397
       previous inconsistent state, consistent state with a non-default
1398
       action, or user semantic action that manipulated yychar.
1399
     - Of course, the expected token list depends on states to have
1400
       correct lookahead information, and it depends on the parser not
1401
       to perform extra reductions after fetching a lookahead from the
1402
       scanner and before detecting a syntax error.  Thus, state merging
1403
       (from LALR or IELR) and default reductions corrupt the expected
1404
       token list.  However, the list is correct for canonical LR with
1405
       one exception: it will still contain any token that will not be
1406
       accepted due to an error action in a later state.
1407
  */
1408
0
  if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
1409
0
    {
1410
0
      int yyn;
1411
0
      if (yyarg)
1412
0
        yyarg[yycount] = yyctx->yytoken;
1413
0
      ++yycount;
1414
0
      yyn = yypcontext_expected_tokens (yyctx,
1415
0
                                        yyarg ? yyarg + 1 : yyarg, yyargn - 1);
1416
0
      if (yyn == YYENOMEM)
1417
0
        return YYENOMEM;
1418
0
      else
1419
0
        yycount += yyn;
1420
0
    }
1421
0
  return yycount;
1422
0
}
1423
1424
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1425
   about the unexpected token YYTOKEN for the state stack whose top is
1426
   YYSSP.
1427
1428
   Return 0 if *YYMSG was successfully written.  Return -1 if *YYMSG is
1429
   not large enough to hold the message.  In that case, also set
1430
   *YYMSG_ALLOC to the required number of bytes.  Return YYENOMEM if the
1431
   required number of bytes is too large to store.  */
1432
static int
1433
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1434
                const yypcontext_t *yyctx)
1435
0
{
1436
0
  enum { YYARGS_MAX = 5 };
1437
  /* Internationalized format string. */
1438
0
  const char *yyformat = YY_NULLPTR;
1439
  /* Arguments of yyformat: reported tokens (one for the "unexpected",
1440
     one per "expected"). */
1441
0
  yysymbol_kind_t yyarg[YYARGS_MAX];
1442
  /* Cumulated lengths of YYARG.  */
1443
0
  YYPTRDIFF_T yysize = 0;
1444
1445
  /* Actual size of YYARG. */
1446
0
  int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1447
0
  if (yycount == YYENOMEM)
1448
0
    return YYENOMEM;
1449
1450
0
  switch (yycount)
1451
0
    {
1452
0
#define YYCASE_(N, S)                       \
1453
0
      case N:                               \
1454
0
        yyformat = S;                       \
1455
0
        break
1456
0
    default: /* Avoid compiler warnings. */
1457
0
      YYCASE_(0, YY_("syntax error"));
1458
0
      YYCASE_(1, YY_("syntax error, unexpected %s"));
1459
0
      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1460
0
      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1461
0
      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1462
0
      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1463
0
#undef YYCASE_
1464
0
    }
1465
1466
  /* Compute error message size.  Don't count the "%s"s, but reserve
1467
     room for the terminator.  */
1468
0
  yysize = yystrlen (yyformat) - 2 * yycount + 1;
1469
0
  {
1470
0
    int yyi;
1471
0
    for (yyi = 0; yyi < yycount; ++yyi)
1472
0
      {
1473
0
        YYPTRDIFF_T yysize1
1474
0
          = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
1475
0
        if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1476
0
          yysize = yysize1;
1477
0
        else
1478
0
          return YYENOMEM;
1479
0
      }
1480
0
  }
1481
1482
0
  if (*yymsg_alloc < yysize)
1483
0
    {
1484
0
      *yymsg_alloc = 2 * yysize;
1485
0
      if (! (yysize <= *yymsg_alloc
1486
0
             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1487
0
        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1488
0
      return -1;
1489
0
    }
1490
1491
  /* Avoid sprintf, as that infringes on the user's name space.
1492
     Don't have undefined behavior even if the translation
1493
     produced a string with the wrong number of "%s"s.  */
1494
0
  {
1495
0
    char *yyp = *yymsg;
1496
0
    int yyi = 0;
1497
0
    while ((*yyp = *yyformat) != '\0')
1498
0
      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1499
0
        {
1500
0
          yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
1501
0
          yyformat += 2;
1502
0
        }
1503
0
      else
1504
0
        {
1505
0
          ++yyp;
1506
0
          ++yyformat;
1507
0
        }
1508
0
  }
1509
0
  return 0;
1510
0
}
1511
1512
1513
/*-----------------------------------------------.
1514
| Release the memory associated to this symbol.  |
1515
`-----------------------------------------------*/
1516
1517
static void
1518
yydestruct (const char *yymsg,
1519
            yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, struct term **term, yyscan_t scanner)
1520
0
{
1521
0
  YY_USE (yyvaluep);
1522
0
  YY_USE (yylocationp);
1523
0
  YY_USE (term);
1524
0
  YY_USE (scanner);
1525
0
  if (!yymsg)
1526
0
    yymsg = "Deleting";
1527
0
  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1528
1529
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1530
0
  YY_USE (yykind);
1531
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
1532
0
}
1533
1534
1535
1536
1537
1538
1539
/*----------.
1540
| yyparse.  |
1541
`----------*/
1542
1543
int
1544
yyparse (struct term **term, yyscan_t scanner)
1545
0
{
1546
/* Lookahead token kind.  */
1547
0
int yychar;
1548
1549
1550
/* The semantic value of the lookahead symbol.  */
1551
/* Default value used for initialization, for pacifying older GCCs
1552
   or non-GCC compilers.  */
1553
0
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1554
0
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1555
1556
/* Location data for the lookahead symbol.  */
1557
0
static YYLTYPE yyloc_default
1558
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1559
  = { 1, 1, 1, 1 }
1560
# endif
1561
0
;
1562
0
YYLTYPE yylloc = yyloc_default;
1563
1564
    /* Number of syntax errors so far.  */
1565
0
    int yynerrs = 0;
1566
1567
0
    yy_state_fast_t yystate = 0;
1568
    /* Number of tokens to shift before error messages enabled.  */
1569
0
    int yyerrstatus = 0;
1570
1571
    /* Refer to the stacks through separate pointers, to allow yyoverflow
1572
       to reallocate them elsewhere.  */
1573
1574
    /* Their size.  */
1575
0
    YYPTRDIFF_T yystacksize = YYINITDEPTH;
1576
1577
    /* The state stack: array, bottom, top.  */
1578
0
    yy_state_t yyssa[YYINITDEPTH];
1579
0
    yy_state_t *yyss = yyssa;
1580
0
    yy_state_t *yyssp = yyss;
1581
1582
    /* The semantic value stack: array, bottom, top.  */
1583
0
    YYSTYPE yyvsa[YYINITDEPTH];
1584
0
    YYSTYPE *yyvs = yyvsa;
1585
0
    YYSTYPE *yyvsp = yyvs;
1586
1587
    /* The location stack: array, bottom, top.  */
1588
0
    YYLTYPE yylsa[YYINITDEPTH];
1589
0
    YYLTYPE *yyls = yylsa;
1590
0
    YYLTYPE *yylsp = yyls;
1591
1592
0
  int yyn;
1593
  /* The return value of yyparse.  */
1594
0
  int yyresult;
1595
  /* Lookahead symbol kind.  */
1596
0
  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1597
  /* The variables used to return semantic value and location from the
1598
     action routines.  */
1599
0
  YYSTYPE yyval;
1600
0
  YYLTYPE yyloc;
1601
1602
  /* The locations where the error started and ended.  */
1603
0
  YYLTYPE yyerror_range[3];
1604
1605
  /* Buffer for error messages, and its allocated size.  */
1606
0
  char yymsgbuf[128];
1607
0
  char *yymsg = yymsgbuf;
1608
0
  YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1609
1610
0
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1611
1612
  /* The number of symbols on the RHS of the reduced rule.
1613
     Keep to zero when no symbol should be popped.  */
1614
0
  int yylen = 0;
1615
1616
0
  YYDPRINTF ((stderr, "Starting parse\n"));
1617
1618
0
  yychar = YYEMPTY; /* Cause a token to be read.  */
1619
1620
1621
/* User initialization code.  */
1622
0
#line 66 "parser.y"
1623
0
{
1624
0
  yylloc.first_line   = 1;
1625
0
  yylloc.first_column = 0;
1626
0
  yylloc.last_line    = 1;
1627
0
  yylloc.last_column  = 0;
1628
0
  yylloc.filename     = augl_get_info(scanner)->filename;
1629
0
  yylloc.error        = augl_get_info(scanner)->error;
1630
0
}
1631
1632
0
#line 1633 "parser.c"
1633
1634
0
  yylsp[0] = yylloc;
1635
0
  goto yysetstate;
1636
1637
1638
/*------------------------------------------------------------.
1639
| yynewstate -- push a new state, which is found in yystate.  |
1640
`------------------------------------------------------------*/
1641
0
yynewstate:
1642
  /* In all cases, when you get here, the value and location stacks
1643
     have just been pushed.  So pushing a state here evens the stacks.  */
1644
0
  yyssp++;
1645
1646
1647
/*--------------------------------------------------------------------.
1648
| yysetstate -- set current state (the top of the stack) to yystate.  |
1649
`--------------------------------------------------------------------*/
1650
0
yysetstate:
1651
0
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1652
0
  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1653
0
  YY_IGNORE_USELESS_CAST_BEGIN
1654
0
  *yyssp = YY_CAST (yy_state_t, yystate);
1655
0
  YY_IGNORE_USELESS_CAST_END
1656
0
  YY_STACK_PRINT (yyss, yyssp);
1657
1658
0
  if (yyss + yystacksize - 1 <= yyssp)
1659
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1660
    YYNOMEM;
1661
#else
1662
0
    {
1663
      /* Get the current used size of the three stacks, in elements.  */
1664
0
      YYPTRDIFF_T yysize = yyssp - yyss + 1;
1665
1666
# if defined yyoverflow
1667
      {
1668
        /* Give user a chance to reallocate the stack.  Use copies of
1669
           these so that the &'s don't force the real ones into
1670
           memory.  */
1671
        yy_state_t *yyss1 = yyss;
1672
        YYSTYPE *yyvs1 = yyvs;
1673
        YYLTYPE *yyls1 = yyls;
1674
1675
        /* Each stack pointer address is followed by the size of the
1676
           data in use in that stack, in bytes.  This used to be a
1677
           conditional around just the two extra args, but that might
1678
           be undefined if yyoverflow is a macro.  */
1679
        yyoverflow (YY_("memory exhausted"),
1680
                    &yyss1, yysize * YYSIZEOF (*yyssp),
1681
                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
1682
                    &yyls1, yysize * YYSIZEOF (*yylsp),
1683
                    &yystacksize);
1684
        yyss = yyss1;
1685
        yyvs = yyvs1;
1686
        yyls = yyls1;
1687
      }
1688
# else /* defined YYSTACK_RELOCATE */
1689
      /* Extend the stack our own way.  */
1690
0
      if (YYMAXDEPTH <= yystacksize)
1691
0
        YYNOMEM;
1692
0
      yystacksize *= 2;
1693
0
      if (YYMAXDEPTH < yystacksize)
1694
0
        yystacksize = YYMAXDEPTH;
1695
1696
0
      {
1697
0
        yy_state_t *yyss1 = yyss;
1698
0
        union yyalloc *yyptr =
1699
0
          YY_CAST (union yyalloc *,
1700
0
                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1701
0
        if (! yyptr)
1702
0
          YYNOMEM;
1703
0
        YYSTACK_RELOCATE (yyss_alloc, yyss);
1704
0
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1705
0
        YYSTACK_RELOCATE (yyls_alloc, yyls);
1706
0
#  undef YYSTACK_RELOCATE
1707
0
        if (yyss1 != yyssa)
1708
0
          YYSTACK_FREE (yyss1);
1709
0
      }
1710
0
# endif
1711
1712
0
      yyssp = yyss + yysize - 1;
1713
0
      yyvsp = yyvs + yysize - 1;
1714
0
      yylsp = yyls + yysize - 1;
1715
1716
0
      YY_IGNORE_USELESS_CAST_BEGIN
1717
0
      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1718
0
                  YY_CAST (long, yystacksize)));
1719
0
      YY_IGNORE_USELESS_CAST_END
1720
1721
0
      if (yyss + yystacksize - 1 <= yyssp)
1722
0
        YYABORT;
1723
0
    }
1724
0
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1725
1726
1727
0
  if (yystate == YYFINAL)
1728
0
    YYACCEPT;
1729
1730
0
  goto yybackup;
1731
1732
1733
/*-----------.
1734
| yybackup.  |
1735
`-----------*/
1736
0
yybackup:
1737
  /* Do appropriate processing given the current state.  Read a
1738
     lookahead token if we need one and don't already have one.  */
1739
1740
  /* First try to decide what to do without reference to lookahead token.  */
1741
0
  yyn = yypact[yystate];
1742
0
  if (yypact_value_is_default (yyn))
1743
0
    goto yydefault;
1744
1745
  /* Not known => get a lookahead token if don't already have one.  */
1746
1747
  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
1748
0
  if (yychar == YYEMPTY)
1749
0
    {
1750
0
      YYDPRINTF ((stderr, "Reading a token\n"));
1751
0
      yychar = yylex (&yylval, &yylloc, scanner);
1752
0
    }
1753
1754
0
  if (yychar <= YYEOF)
1755
0
    {
1756
0
      yychar = YYEOF;
1757
0
      yytoken = YYSYMBOL_YYEOF;
1758
0
      YYDPRINTF ((stderr, "Now at end of input.\n"));
1759
0
    }
1760
0
  else if (yychar == YYerror)
1761
0
    {
1762
      /* The scanner already issued an error message, process directly
1763
         to error recovery.  But do not keep the error token as
1764
         lookahead, it is too special and may lead us to an endless
1765
         loop in error recovery. */
1766
0
      yychar = YYUNDEF;
1767
0
      yytoken = YYSYMBOL_YYerror;
1768
0
      yyerror_range[1] = yylloc;
1769
0
      goto yyerrlab1;
1770
0
    }
1771
0
  else
1772
0
    {
1773
0
      yytoken = YYTRANSLATE (yychar);
1774
0
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1775
0
    }
1776
1777
  /* If the proper action on seeing token YYTOKEN is to reduce or to
1778
     detect an error, take that action.  */
1779
0
  yyn += yytoken;
1780
0
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1781
0
    goto yydefault;
1782
0
  yyn = yytable[yyn];
1783
0
  if (yyn <= 0)
1784
0
    {
1785
0
      if (yytable_value_is_error (yyn))
1786
0
        goto yyerrlab;
1787
0
      yyn = -yyn;
1788
0
      goto yyreduce;
1789
0
    }
1790
1791
  /* Count tokens shifted since error; after three, turn off error
1792
     status.  */
1793
0
  if (yyerrstatus)
1794
0
    yyerrstatus--;
1795
1796
  /* Shift the lookahead token.  */
1797
0
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1798
0
  yystate = yyn;
1799
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1800
0
  *++yyvsp = yylval;
1801
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
1802
0
  *++yylsp = yylloc;
1803
1804
  /* Discard the shifted token.  */
1805
0
  yychar = YYEMPTY;
1806
0
  goto yynewstate;
1807
1808
1809
/*-----------------------------------------------------------.
1810
| yydefault -- do the default action for the current state.  |
1811
`-----------------------------------------------------------*/
1812
0
yydefault:
1813
0
  yyn = yydefact[yystate];
1814
0
  if (yyn == 0)
1815
0
    goto yyerrlab;
1816
0
  goto yyreduce;
1817
1818
1819
/*-----------------------------.
1820
| yyreduce -- do a reduction.  |
1821
`-----------------------------*/
1822
0
yyreduce:
1823
  /* yyn is the number of a rule to reduce with.  */
1824
0
  yylen = yyr2[yyn];
1825
1826
  /* If YYLEN is nonzero, implement the default value of the action:
1827
     '$$ = $1'.
1828
1829
     Otherwise, the following line sets YYVAL to garbage.
1830
     This behavior is undocumented and Bison
1831
     users should not rely upon it.  Assigning to YYVAL
1832
     unconditionally makes the parser a bit smaller, and it avoids a
1833
     GCC warning that YYVAL may be used uninitialized.  */
1834
0
  yyval = yyvsp[1-yylen];
1835
1836
  /* Default location. */
1837
0
  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1838
0
  yyerror_range[1] = yyloc;
1839
0
  YY_REDUCE_PRINT (yyn);
1840
0
  switch (yyn)
1841
0
    {
1842
0
  case 2: /* start: KW_MODULE UIDENT '=' autoload decls  */
1843
0
#line 180 "parser.y"
1844
0
       { (*term) = make_module((yyvsp[-3].string), (yyvsp[-1].string), (yyvsp[0].term), &(yylsp[-4])); }
1845
0
#line 1846 "parser.c"
1846
0
    break;
1847
1848
0
  case 3: /* autoload: KW_AUTOLOAD LIDENT  */
1849
0
#line 183 "parser.y"
1850
0
          { (yyval.string) = (yyvsp[0].string); }
1851
0
#line 1852 "parser.c"
1852
0
    break;
1853
1854
0
  case 4: /* autoload: %empty  */
1855
0
#line 185 "parser.y"
1856
0
          { (yyval.string) = NULL; }
1857
0
#line 1858 "parser.c"
1858
0
    break;
1859
1860
0
  case 5: /* decls: KW_LET LIDENT param_list '=' exp decls  */
1861
0
#line 188 "parser.y"
1862
0
       {
1863
0
         LOC_MERGE((yylsp[-5]), (yylsp[-5]), (yylsp[-1]));
1864
0
         (yyval.term) = make_bind((yyvsp[-4].string), (yyvsp[-3].term), (yyvsp[-1].term), (yyvsp[0].term), &(yylsp[-5]));
1865
0
       }
1866
0
#line 1867 "parser.c"
1867
0
    break;
1868
1869
0
  case 6: /* decls: KW_LET_REC LIDENT '=' exp decls  */
1870
0
#line 193 "parser.y"
1871
0
       {
1872
0
         LOC_MERGE((yylsp[-4]), (yylsp[-4]), (yylsp[-1]));
1873
0
         (yyval.term) = make_bind_rec((yyvsp[-3].string), (yyvsp[-1].term), (yyvsp[0].term), &(yylsp[-4]));
1874
0
       }
1875
0
#line 1876 "parser.c"
1876
0
    break;
1877
1878
0
  case 7: /* decls: KW_TEST test_exp '=' exp decls  */
1879
0
#line 198 "parser.y"
1880
0
       {
1881
0
         LOC_MERGE((yylsp[-4]), (yylsp[-4]), (yylsp[-1]));
1882
0
         (yyval.term) = make_test((yyvsp[-3].term), (yyvsp[-1].term), TR_CHECK, (yyvsp[0].term), &(yylsp[-4]));
1883
0
       }
1884
0
#line 1885 "parser.c"
1885
0
    break;
1886
1887
0
  case 8: /* decls: KW_TEST test_exp '=' test_special_res decls  */
1888
0
#line 203 "parser.y"
1889
0
       {
1890
0
         LOC_MERGE((yylsp[-4]), (yylsp[-4]), (yylsp[-1]));
1891
0
         (yyval.term) = make_test((yyvsp[-3].term), NULL, (yyvsp[-1].intval), (yyvsp[0].term), &(yylsp[-4]));
1892
0
       }
1893
0
#line 1894 "parser.c"
1894
0
    break;
1895
1896
0
  case 9: /* decls: %empty  */
1897
0
#line 208 "parser.y"
1898
0
       { (yyval.term) = NULL; }
1899
0
#line 1900 "parser.c"
1900
0
    break;
1901
1902
0
  case 10: /* test_exp: aexp KW_GET exp  */
1903
0
#line 213 "parser.y"
1904
0
          { (yyval.term) = make_get_test((yyvsp[-2].term), (yyvsp[0].term), &(yyloc)); }
1905
0
#line 1906 "parser.c"
1906
0
    break;
1907
1908
0
  case 11: /* test_exp: aexp KW_PUT aexp KW_AFTER exp  */
1909
0
#line 215 "parser.y"
1910
0
          { (yyval.term) = make_put_test((yyvsp[-4].term), (yyvsp[-2].term), (yyvsp[0].term), &(yyloc)); }
1911
0
#line 1912 "parser.c"
1912
0
    break;
1913
1914
0
  case 12: /* test_special_res: '?'  */
1915
0
#line 218 "parser.y"
1916
0
                  { (yyval.intval) = TR_PRINT; }
1917
0
#line 1918 "parser.c"
1918
0
    break;
1919
1920
0
  case 13: /* test_special_res: '*'  */
1921
0
#line 220 "parser.y"
1922
0
                  { (yyval.intval) = TR_EXN; }
1923
0
#line 1924 "parser.c"
1924
0
    break;
1925
1926
0
  case 14: /* exp: KW_LET LIDENT param_list '=' exp KW_IN exp  */
1927
0
#line 224 "parser.y"
1928
0
     {
1929
0
       LOC_MERGE((yylsp[-6]), (yylsp[-6]), (yylsp[-1]));
1930
0
       (yyval.term) = make_let((yyvsp[-5].string), (yyvsp[-4].term), (yyvsp[-2].term), (yyvsp[0].term), &(yylsp[-6]));
1931
0
     }
1932
0
#line 1933 "parser.c"
1933
0
    break;
1934
1935
0
  case 16: /* composeexp: composeexp ';' unionexp  */
1936
0
#line 231 "parser.y"
1937
0
     { (yyval.term) = make_binop(A_COMPOSE, (yyvsp[-2].term), (yyvsp[0].term), &(yyloc)); }
1938
0
#line 1939 "parser.c"
1939
0
    break;
1940
1941
0
  case 17: /* composeexp: unionexp  */
1942
0
#line 233 "parser.y"
1943
0
     { (yyval.term) = (yyvsp[0].term); }
1944
0
#line 1945 "parser.c"
1945
0
    break;
1946
1947
0
  case 18: /* unionexp: unionexp '|' minusexp  */
1948
0
#line 236 "parser.y"
1949
0
     { (yyval.term) = make_binop(A_UNION, (yyvsp[-2].term), (yyvsp[0].term), &(yyloc)); }
1950
0
#line 1951 "parser.c"
1951
0
    break;
1952
1953
0
  case 19: /* unionexp: minusexp  */
1954
0
#line 238 "parser.y"
1955
0
     { (yyval.term) = (yyvsp[0].term); }
1956
0
#line 1957 "parser.c"
1957
0
    break;
1958
1959
0
  case 20: /* unionexp: tree_const  */
1960
0
#line 240 "parser.y"
1961
0
     { (yyval.term) = make_tree_value((yyvsp[0].tree), &(yylsp[0])); }
1962
0
#line 1963 "parser.c"
1963
0
    break;
1964
1965
0
  case 21: /* minusexp: minusexp '-' catexp  */
1966
0
#line 243 "parser.y"
1967
0
     { (yyval.term) = make_binop(A_MINUS, (yyvsp[-2].term), (yyvsp[0].term), &(yyloc)); }
1968
0
#line 1969 "parser.c"
1969
0
    break;
1970
1971
0
  case 22: /* minusexp: catexp  */
1972
0
#line 245 "parser.y"
1973
0
     { (yyval.term) = (yyvsp[0].term); }
1974
0
#line 1975 "parser.c"
1975
0
    break;
1976
1977
0
  case 23: /* catexp: catexp '.' appexp  */
1978
0
#line 248 "parser.y"
1979
0
{ (yyval.term) = make_binop(A_CONCAT, (yyvsp[-2].term), (yyvsp[0].term), &(yyloc)); }
1980
0
#line 1981 "parser.c"
1981
0
    break;
1982
1983
0
  case 24: /* catexp: appexp  */
1984
0
#line 250 "parser.y"
1985
0
{ (yyval.term) = (yyvsp[0].term); }
1986
0
#line 1987 "parser.c"
1987
0
    break;
1988
1989
0
  case 25: /* appexp: appexp rexp  */
1990
0
#line 253 "parser.y"
1991
0
        { (yyval.term) = make_binop(A_APP, (yyvsp[-1].term), (yyvsp[0].term), &(yyloc)); }
1992
0
#line 1993 "parser.c"
1993
0
    break;
1994
1995
0
  case 26: /* appexp: rexp  */
1996
0
#line 255 "parser.y"
1997
0
        { (yyval.term) = (yyvsp[0].term); }
1998
0
#line 1999 "parser.c"
1999
0
    break;
2000
2001
0
  case 27: /* aexp: qid  */
2002
0
#line 258 "parser.y"
2003
0
      { (yyval.term) = make_ident((yyvsp[0].string), &(yylsp[0])); }
2004
0
#line 2005 "parser.c"
2005
0
    break;
2006
2007
0
  case 28: /* aexp: DQUOTED  */
2008
0
#line 260 "parser.y"
2009
0
      { (yyval.term) = make_string_term((yyvsp[0].string), &(yylsp[0])); }
2010
0
#line 2011 "parser.c"
2011
0
    break;
2012
2013
0
  case 29: /* aexp: REGEXP  */
2014
0
#line 262 "parser.y"
2015
0
      { (yyval.term) = make_regexp_term((yyvsp[0].regexp).pattern, (yyvsp[0].regexp).nocase, &(yylsp[0])); }
2016
0
#line 2017 "parser.c"
2017
0
    break;
2018
2019
0
  case 30: /* aexp: '(' exp ')'  */
2020
0
#line 264 "parser.y"
2021
0
      { (yyval.term) = (yyvsp[-1].term); }
2022
0
#line 2023 "parser.c"
2023
0
    break;
2024
2025
0
  case 31: /* aexp: '[' exp ']'  */
2026
0
#line 266 "parser.y"
2027
0
      { (yyval.term) = make_unop(A_BRACKET, (yyvsp[-1].term), &(yyloc)); }
2028
0
#line 2029 "parser.c"
2029
0
    break;
2030
2031
0
  case 32: /* aexp: '(' ')'  */
2032
0
#line 268 "parser.y"
2033
0
      { (yyval.term) = make_unit_term(&(yyloc)); }
2034
0
#line 2035 "parser.c"
2035
0
    break;
2036
2037
0
  case 33: /* rexp: aexp rep  */
2038
0
#line 271 "parser.y"
2039
0
      { (yyval.term) = make_rep((yyvsp[-1].term), (yyvsp[0].quant), &(yyloc)); }
2040
0
#line 2041 "parser.c"
2041
0
    break;
2042
2043
0
  case 34: /* rexp: aexp  */
2044
0
#line 273 "parser.y"
2045
0
      { (yyval.term) = (yyvsp[0].term); }
2046
0
#line 2047 "parser.c"
2047
0
    break;
2048
2049
0
  case 35: /* rep: '*'  */
2050
0
#line 276 "parser.y"
2051
0
     { (yyval.quant) = Q_STAR; }
2052
0
#line 2053 "parser.c"
2053
0
    break;
2054
2055
0
  case 36: /* rep: '+'  */
2056
0
#line 278 "parser.y"
2057
0
     { (yyval.quant) = Q_PLUS; }
2058
0
#line 2059 "parser.c"
2059
0
    break;
2060
2061
0
  case 37: /* rep: '?'  */
2062
0
#line 280 "parser.y"
2063
0
     { (yyval.quant) = Q_MAYBE; }
2064
0
#line 2065 "parser.c"
2065
0
    break;
2066
2067
0
  case 38: /* qid: LIDENT  */
2068
0
#line 283 "parser.y"
2069
0
     { (yyval.string) = (yyvsp[0].string); }
2070
0
#line 2071 "parser.c"
2071
0
    break;
2072
2073
0
  case 39: /* qid: QIDENT  */
2074
0
#line 285 "parser.y"
2075
0
     { (yyval.string) = (yyvsp[0].string); }
2076
0
#line 2077 "parser.c"
2077
0
    break;
2078
2079
0
  case 40: /* qid: KW_GET  */
2080
0
#line 287 "parser.y"
2081
0
     { (yyval.string) = strdup("get"); }
2082
0
#line 2083 "parser.c"
2083
0
    break;
2084
2085
0
  case 41: /* qid: KW_PUT  */
2086
0
#line 289 "parser.y"
2087
0
     { (yyval.string) = strdup("put"); }
2088
0
#line 2089 "parser.c"
2089
0
    break;
2090
2091
0
  case 42: /* param_list: param param_list  */
2092
0
#line 292 "parser.y"
2093
0
            { (yyval.term) = (yyvsp[0].term); list_cons((yyval.term), (yyvsp[-1].term)); }
2094
0
#line 2095 "parser.c"
2095
0
    break;
2096
2097
0
  case 43: /* param_list: %empty  */
2098
0
#line 294 "parser.y"
2099
0
            { (yyval.term) = NULL; }
2100
0
#line 2101 "parser.c"
2101
0
    break;
2102
2103
0
  case 44: /* param: '(' id ':' type ')'  */
2104
0
#line 297 "parser.y"
2105
0
       { (yyval.term) = make_param((yyvsp[-3].string), (yyvsp[-1].type), clone_info(&(yylsp[-4]))); }
2106
0
#line 2107 "parser.c"
2107
0
    break;
2108
2109
0
  case 45: /* id: LIDENT  */
2110
0
#line 300 "parser.y"
2111
0
    { (yyval.string) = (yyvsp[0].string); }
2112
0
#line 2113 "parser.c"
2113
0
    break;
2114
2115
0
  case 46: /* id: KW_GET  */
2116
0
#line 302 "parser.y"
2117
0
    { (yyval.string) = strdup("get"); }
2118
0
#line 2119 "parser.c"
2119
0
    break;
2120
2121
0
  case 47: /* id: KW_PUT  */
2122
0
#line 304 "parser.y"
2123
0
    { (yyval.string) = strdup("put"); }
2124
0
#line 2125 "parser.c"
2125
0
    break;
2126
2127
0
  case 48: /* type: atype ARROW type  */
2128
0
#line 307 "parser.y"
2129
0
      { (yyval.type) = make_arrow_type((yyvsp[-2].type), (yyvsp[0].type)); }
2130
0
#line 2131 "parser.c"
2131
0
    break;
2132
2133
0
  case 49: /* type: atype  */
2134
0
#line 309 "parser.y"
2135
0
      { (yyval.type) = (yyvsp[0].type); }
2136
0
#line 2137 "parser.c"
2137
0
    break;
2138
2139
0
  case 50: /* atype: KW_STRING  */
2140
0
#line 312 "parser.y"
2141
0
       { (yyval.type) = make_base_type(T_STRING); }
2142
0
#line 2143 "parser.c"
2143
0
    break;
2144
2145
0
  case 51: /* atype: KW_REGEXP  */
2146
0
#line 314 "parser.y"
2147
0
       { (yyval.type) = make_base_type(T_REGEXP); }
2148
0
#line 2149 "parser.c"
2149
0
    break;
2150
2151
0
  case 52: /* atype: KW_LENS  */
2152
0
#line 316 "parser.y"
2153
0
       { (yyval.type) = make_base_type(T_LENS); }
2154
0
#line 2155 "parser.c"
2155
0
    break;
2156
2157
0
  case 53: /* atype: '(' type ')'  */
2158
0
#line 318 "parser.y"
2159
0
       { (yyval.type) = (yyvsp[-1].type); }
2160
0
#line 2161 "parser.c"
2161
0
    break;
2162
2163
0
  case 54: /* tree_const: tree_const '{' tree_branch '}'  */
2164
0
#line 321 "parser.y"
2165
0
            { (yyval.tree) = tree_concat((yyvsp[-3].tree), (yyvsp[-1].tree)); }
2166
0
#line 2167 "parser.c"
2167
0
    break;
2168
2169
0
  case 55: /* tree_const: '{' tree_branch '}'  */
2170
0
#line 323 "parser.y"
2171
0
            { (yyval.tree) = tree_concat((yyvsp[-1].tree), NULL); }
2172
0
#line 2173 "parser.c"
2173
0
    break;
2174
2175
0
  case 56: /* tree_const2: tree_const2 '{' tree_branch '}'  */
2176
0
#line 326 "parser.y"
2177
0
            {
2178
0
              (yyval.tree) = tree_concat((yyvsp[-3].tree), (yyvsp[-1].tree));
2179
0
            }
2180
0
#line 2181 "parser.c"
2181
0
    break;
2182
2183
0
  case 57: /* tree_const2: %empty  */
2184
0
#line 330 "parser.y"
2185
0
            { (yyval.tree) = NULL; }
2186
0
#line 2187 "parser.c"
2187
0
    break;
2188
2189
0
  case 58: /* tree_branch: tree_label tree_const2  */
2190
0
#line 333 "parser.y"
2191
0
             {
2192
0
               (yyval.tree) = make_tree((yyvsp[-1].string), NULL, NULL, (yyvsp[0].tree));
2193
0
             }
2194
0
#line 2195 "parser.c"
2195
0
    break;
2196
2197
0
  case 59: /* tree_branch: tree_label '=' DQUOTED tree_const2  */
2198
0
#line 337 "parser.y"
2199
0
             {
2200
0
               (yyval.tree) = make_tree((yyvsp[-3].string), (yyvsp[-1].string), NULL, (yyvsp[0].tree));
2201
0
             }
2202
0
#line 2203 "parser.c"
2203
0
    break;
2204
2205
0
  case 61: /* tree_label: %empty  */
2206
0
#line 342 "parser.y"
2207
0
            { (yyval.string) = NULL; }
2208
0
#line 2209 "parser.c"
2209
0
    break;
2210
2211
2212
0
#line 2213 "parser.c"
2213
2214
0
      default: break;
2215
0
    }
2216
  /* User semantic actions sometimes alter yychar, and that requires
2217
     that yytoken be updated with the new translation.  We take the
2218
     approach of translating immediately before every use of yytoken.
2219
     One alternative is translating here after every semantic action,
2220
     but that translation would be missed if the semantic action invokes
2221
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2222
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
2223
     incorrect destructor might then be invoked immediately.  In the
2224
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
2225
     to an incorrect destructor call or verbose syntax error message
2226
     before the lookahead is translated.  */
2227
0
  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
2228
2229
0
  YYPOPSTACK (yylen);
2230
0
  yylen = 0;
2231
2232
0
  *++yyvsp = yyval;
2233
0
  *++yylsp = yyloc;
2234
2235
  /* Now 'shift' the result of the reduction.  Determine what state
2236
     that goes to, based on the state we popped back to and the rule
2237
     number reduced by.  */
2238
0
  {
2239
0
    const int yylhs = yyr1[yyn] - YYNTOKENS;
2240
0
    const int yyi = yypgoto[yylhs] + *yyssp;
2241
0
    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2242
0
               ? yytable[yyi]
2243
0
               : yydefgoto[yylhs]);
2244
0
  }
2245
2246
0
  goto yynewstate;
2247
2248
2249
/*--------------------------------------.
2250
| yyerrlab -- here on detecting error.  |
2251
`--------------------------------------*/
2252
0
yyerrlab:
2253
  /* Make sure we have latest lookahead translation.  See comments at
2254
     user semantic actions for why this is necessary.  */
2255
0
  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
2256
  /* If not already recovering from an error, report this error.  */
2257
0
  if (!yyerrstatus)
2258
0
    {
2259
0
      ++yynerrs;
2260
0
      {
2261
0
        yypcontext_t yyctx
2262
0
          = {yyssp, yytoken, &yylloc};
2263
0
        char const *yymsgp = YY_("syntax error");
2264
0
        int yysyntax_error_status;
2265
0
        yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
2266
0
        if (yysyntax_error_status == 0)
2267
0
          yymsgp = yymsg;
2268
0
        else if (yysyntax_error_status == -1)
2269
0
          {
2270
0
            if (yymsg != yymsgbuf)
2271
0
              YYSTACK_FREE (yymsg);
2272
0
            yymsg = YY_CAST (char *,
2273
0
                             YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
2274
0
            if (yymsg)
2275
0
              {
2276
0
                yysyntax_error_status
2277
0
                  = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
2278
0
                yymsgp = yymsg;
2279
0
              }
2280
0
            else
2281
0
              {
2282
0
                yymsg = yymsgbuf;
2283
0
                yymsg_alloc = sizeof yymsgbuf;
2284
0
                yysyntax_error_status = YYENOMEM;
2285
0
              }
2286
0
          }
2287
0
        yyerror (&yylloc, term, scanner, yymsgp);
2288
0
        if (yysyntax_error_status == YYENOMEM)
2289
0
          YYNOMEM;
2290
0
      }
2291
0
    }
2292
2293
0
  yyerror_range[1] = yylloc;
2294
0
  if (yyerrstatus == 3)
2295
0
    {
2296
      /* If just tried and failed to reuse lookahead token after an
2297
         error, discard it.  */
2298
2299
0
      if (yychar <= YYEOF)
2300
0
        {
2301
          /* Return failure if at end of input.  */
2302
0
          if (yychar == YYEOF)
2303
0
            YYABORT;
2304
0
        }
2305
0
      else
2306
0
        {
2307
0
          yydestruct ("Error: discarding",
2308
0
                      yytoken, &yylval, &yylloc, term, scanner);
2309
0
          yychar = YYEMPTY;
2310
0
        }
2311
0
    }
2312
2313
  /* Else will try to reuse lookahead token after shifting the error
2314
     token.  */
2315
0
  goto yyerrlab1;
2316
2317
2318
/*---------------------------------------------------.
2319
| yyerrorlab -- error raised explicitly by YYERROR.  |
2320
`---------------------------------------------------*/
2321
0
yyerrorlab:
2322
  /* Pacify compilers when the user code never invokes YYERROR and the
2323
     label yyerrorlab therefore never appears in user code.  */
2324
0
  if (0)
2325
0
    YYERROR;
2326
0
  ++yynerrs;
2327
2328
  /* Do not reclaim the symbols of the rule whose action triggered
2329
     this YYERROR.  */
2330
0
  YYPOPSTACK (yylen);
2331
0
  yylen = 0;
2332
0
  YY_STACK_PRINT (yyss, yyssp);
2333
0
  yystate = *yyssp;
2334
0
  goto yyerrlab1;
2335
2336
2337
/*-------------------------------------------------------------.
2338
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
2339
`-------------------------------------------------------------*/
2340
0
yyerrlab1:
2341
0
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2342
2343
  /* Pop stack until we find a state that shifts the error token.  */
2344
0
  for (;;)
2345
0
    {
2346
0
      yyn = yypact[yystate];
2347
0
      if (!yypact_value_is_default (yyn))
2348
0
        {
2349
0
          yyn += YYSYMBOL_YYerror;
2350
0
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2351
0
            {
2352
0
              yyn = yytable[yyn];
2353
0
              if (0 < yyn)
2354
0
                break;
2355
0
            }
2356
0
        }
2357
2358
      /* Pop the current state because it cannot handle the error token.  */
2359
0
      if (yyssp == yyss)
2360
0
        YYABORT;
2361
2362
0
      yyerror_range[1] = *yylsp;
2363
0
      yydestruct ("Error: popping",
2364
0
                  YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp, term, scanner);
2365
0
      YYPOPSTACK (1);
2366
0
      yystate = *yyssp;
2367
0
      YY_STACK_PRINT (yyss, yyssp);
2368
0
    }
2369
2370
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2371
0
  *++yyvsp = yylval;
2372
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
2373
2374
0
  yyerror_range[2] = yylloc;
2375
0
  ++yylsp;
2376
0
  YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);
2377
2378
  /* Shift the error token.  */
2379
0
  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2380
2381
0
  yystate = yyn;
2382
0
  goto yynewstate;
2383
2384
2385
/*-------------------------------------.
2386
| yyacceptlab -- YYACCEPT comes here.  |
2387
`-------------------------------------*/
2388
0
yyacceptlab:
2389
0
  yyresult = 0;
2390
0
  goto yyreturnlab;
2391
2392
2393
/*-----------------------------------.
2394
| yyabortlab -- YYABORT comes here.  |
2395
`-----------------------------------*/
2396
0
yyabortlab:
2397
0
  yyresult = 1;
2398
0
  goto yyreturnlab;
2399
2400
2401
/*-----------------------------------------------------------.
2402
| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
2403
`-----------------------------------------------------------*/
2404
0
yyexhaustedlab:
2405
0
  yyerror (&yylloc, term, scanner, YY_("memory exhausted"));
2406
0
  yyresult = 2;
2407
0
  goto yyreturnlab;
2408
2409
2410
/*----------------------------------------------------------.
2411
| yyreturnlab -- parsing is finished, clean up and return.  |
2412
`----------------------------------------------------------*/
2413
0
yyreturnlab:
2414
0
  if (yychar != YYEMPTY)
2415
0
    {
2416
      /* Make sure we have latest lookahead translation.  See comments at
2417
         user semantic actions for why this is necessary.  */
2418
0
      yytoken = YYTRANSLATE (yychar);
2419
0
      yydestruct ("Cleanup: discarding lookahead",
2420
0
                  yytoken, &yylval, &yylloc, term, scanner);
2421
0
    }
2422
  /* Do not reclaim the symbols of the rule whose action triggered
2423
     this YYABORT or YYACCEPT.  */
2424
0
  YYPOPSTACK (yylen);
2425
0
  YY_STACK_PRINT (yyss, yyssp);
2426
0
  while (yyssp != yyss)
2427
0
    {
2428
0
      yydestruct ("Cleanup: popping",
2429
0
                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp, term, scanner);
2430
0
      YYPOPSTACK (1);
2431
0
    }
2432
0
#ifndef yyoverflow
2433
0
  if (yyss != yyssa)
2434
0
    YYSTACK_FREE (yyss);
2435
0
#endif
2436
0
  if (yymsg != yymsgbuf)
2437
0
    YYSTACK_FREE (yymsg);
2438
0
  return yyresult;
2439
0
}
2440
2441
#line 343 "parser.y"
2442
2443
2444
int augl_parse_file(struct augeas *aug, const char *name,
2445
0
                    struct term **term) {
2446
0
  yyscan_t          scanner;
2447
0
  struct state      state;
2448
0
  struct string  *sname = NULL;
2449
0
  struct info    info;
2450
0
  int result = -1;
2451
0
  int r;
2452
2453
0
  *term = NULL;
2454
2455
0
  r = make_ref(sname);
2456
0
  ERR_NOMEM(r < 0, aug);
2457
2458
0
  sname->str = strdup(name);
2459
0
  ERR_NOMEM(sname->str == NULL, aug);
2460
2461
0
  MEMZERO(&info, 1);
2462
0
  info.ref = UINT_MAX;
2463
0
  info.filename = sname;
2464
0
  info.error = aug->error;
2465
2466
0
  MEMZERO(&state, 1);
2467
0
  state.info = &info;
2468
0
  state.comment_depth = 0;
2469
2470
0
  if (augl_init_lexer(&state, &scanner) < 0) {
2471
0
    augl_error(&info, term, NULL, "file not found");
2472
0
    goto error;
2473
0
  }
2474
2475
0
  yydebug = getenv("YYDEBUG") != NULL;
2476
0
  r = augl_parse(term, scanner);
2477
0
  augl_close_lexer(scanner);
2478
0
  augl_lex_destroy(scanner);
2479
0
  if (r == 1) {
2480
0
    augl_error(&info, term, NULL, "syntax error");
2481
0
    goto error;
2482
0
  } else if (r == 2) {
2483
0
    augl_error(&info, term, NULL, "parser ran out of memory");
2484
0
    ERR_NOMEM(1, aug);
2485
0
  }
2486
0
  result = 0;
2487
2488
0
 error:
2489
0
  unref(sname, string);
2490
  // free TERM
2491
0
  return result;
2492
0
}
2493
2494
// FIXME: Nothing here checks for alloc errors.
2495
0
static struct info *clone_info(struct info *locp) {
2496
0
  struct info *info;
2497
0
  make_ref(info);
2498
0
  info->filename     = ref(locp->filename);
2499
0
  info->first_line   = locp->first_line;
2500
0
  info->first_column = locp->first_column;
2501
0
  info->last_line    = locp->last_line;
2502
0
  info->last_column  = locp->last_column;
2503
0
  info->error        = locp->error;
2504
0
  return info;
2505
0
}
2506
2507
0
static struct term *make_term_locp(enum term_tag tag, struct info *locp) {
2508
0
  struct info *info = clone_info(locp);
2509
0
  return make_term(tag, info);
2510
0
}
2511
2512
static struct term *make_module(char *ident, char *autoload,
2513
                                struct term *decls,
2514
0
                                struct info *locp) {
2515
0
  struct term *term = make_term_locp(A_MODULE, locp);
2516
0
  term->mname = ident;
2517
0
  term->autoload = autoload;
2518
0
  term->decls = decls;
2519
0
  return term;
2520
0
}
2521
2522
static struct term *make_bind(char *ident, struct term *params,
2523
                              struct term *exp, struct term *decls,
2524
0
                              struct info *locp) {
2525
0
  struct term *term = make_term_locp(A_BIND, locp);
2526
0
  if (params != NULL)
2527
0
    exp = build_func(params, exp);
2528
2529
0
  term->bname = ident;
2530
0
  term->exp = exp;
2531
0
  list_cons(decls, term);
2532
0
  return decls;
2533
0
}
2534
2535
static struct term *make_bind_rec(char *ident, struct term *exp,
2536
0
                                  struct term *decls, struct info *locp) {
2537
  /* Desugar let rec IDENT = EXP as
2538
   *  let IDENT =
2539
   *    let RLENS = (lns_make_rec) in
2540
   *    lns_check_rec ((lambda IDENT: EXP) RLENS) RLENS
2541
   * where RLENS is a brandnew recursive lens.
2542
   *
2543
   * That only works since we know that 'let rec' is only defined for lenses,
2544
   * not general purposes functions, i.e. we know that IDENT has type 'lens'
2545
   *
2546
   * The point of all this is that we make it possible to put a recursive
2547
   * lens (which is a placeholder for the actual recursion) into arbitrary
2548
   * places in some bigger lens and then have LNS_CHECK_REC rattle through
2549
   * to do the special-purpose typechecking.
2550
   */
2551
0
  char *id;
2552
0
  struct info *info = exp->info;
2553
0
  struct term *lambda = NULL, *rlens = NULL;
2554
0
  struct term *app1 = NULL, *app2 = NULL, *app3 = NULL;
2555
2556
0
  id = strdup(ident);
2557
0
  if (id == NULL) goto error;
2558
2559
0
  lambda = make_param(id, make_base_type(T_LENS), ref(info));
2560
0
  if (lambda == NULL) goto error;
2561
0
  id = NULL;
2562
2563
0
  build_func(lambda, exp);
2564
2565
0
  rlens = make_term(A_VALUE, ref(exp->info));
2566
0
  if (rlens == NULL) goto error;
2567
0
  rlens->value = lns_make_rec(ref(exp->info));
2568
0
  if (rlens->value == NULL) goto error;
2569
0
  rlens->type = make_base_type(T_LENS);
2570
2571
0
  app1 = make_app_term(lambda, rlens, ref(info));
2572
0
  if (app1 == NULL) goto error;
2573
2574
0
  id = strdup(LNS_CHECK_REC_NAME);
2575
0
  if (id == NULL) goto error;
2576
0
  app2 = make_app_ident(id, app1, ref(info));
2577
0
  if (app2 == NULL) goto error;
2578
0
  id = NULL;
2579
2580
0
  app3 = make_app_term(app2, ref(rlens), ref(info));
2581
0
  if (app3 == NULL) goto error;
2582
2583
0
  return make_bind(ident, NULL, app3, decls, locp);
2584
2585
0
 error:
2586
0
  free(id);
2587
0
  unref(lambda, term);
2588
0
  unref(rlens, term);
2589
0
  unref(app1, term);
2590
0
  unref(app2, term);
2591
0
  unref(app3, term);
2592
0
  return NULL;
2593
0
}
2594
2595
static struct term *make_let(char *ident, struct term *params,
2596
                             struct term *exp, struct term *body,
2597
0
                             struct info *locp) {
2598
  /* let f (x:string) = "f " . x in
2599
     f "a" . f "b" */
2600
  /* (lambda f: f "a" . f "b") (lambda x: "f " . x) */
2601
  /* (lambda IDENT: BODY) (lambda PARAMS: EXP) */
2602
  /* Desugar as (lambda IDENT: BODY) (lambda PARAMS: EXP) */
2603
0
  struct term *term = make_term_locp(A_LET, locp);
2604
0
  struct term *p = make_param(ident, NULL, ref(term->info));
2605
0
  term->left = build_func(p, body);
2606
0
  if (params != NULL)
2607
0
    term->right = build_func(params, exp);
2608
0
  else
2609
0
    term->right = exp;
2610
0
  return term;
2611
0
}
2612
2613
static struct term *make_binop(enum term_tag tag,
2614
                              struct term *left, struct term *right,
2615
0
                              struct info *locp) {
2616
0
  assert(tag == A_COMPOSE || tag == A_CONCAT
2617
0
         || tag == A_UNION || tag == A_APP || tag == A_MINUS);
2618
0
  struct term *term = make_term_locp(tag, locp);
2619
0
  term->left = left;
2620
0
  term->right = right;
2621
0
  return term;
2622
0
}
2623
2624
static struct term *make_unop(enum term_tag tag, struct term *exp,
2625
0
                             struct info *locp) {
2626
0
  assert(tag == A_BRACKET);
2627
0
  struct term *term = make_term_locp(tag, locp);
2628
0
  term->brexp = exp;
2629
0
  return term;
2630
0
}
2631
2632
0
static struct term *make_ident(char *qname, struct info *locp) {
2633
0
  struct term *term = make_term_locp(A_IDENT, locp);
2634
0
  term->ident = make_string(qname);
2635
0
  return term;
2636
0
}
2637
2638
0
static struct term *make_unit_term(struct info *locp) {
2639
0
  struct term *term = make_term_locp(A_VALUE, locp);
2640
0
  term->value = make_unit(ref(term->info));
2641
0
  return term;
2642
0
}
2643
2644
0
static struct term *make_string_term(char *value, struct info *locp) {
2645
0
  struct term *term = make_term_locp(A_VALUE, locp);
2646
0
  term->value = make_value(V_STRING, ref(term->info));
2647
0
  term->value->string = make_string(value);
2648
0
  return term;
2649
0
}
2650
2651
static struct term *make_regexp_term(char *pattern, int nocase,
2652
0
                                     struct info *locp) {
2653
0
  struct term *term = make_term_locp(A_VALUE, locp);
2654
0
  term->value = make_value(V_REGEXP, ref(term->info));
2655
0
  term->value->regexp = make_regexp(term->info, pattern, nocase);
2656
0
  return term;
2657
0
}
2658
2659
static struct term *make_rep(struct term *exp, enum quant_tag quant,
2660
0
                            struct info *locp) {
2661
0
  struct term *term = make_term_locp(A_REP, locp);
2662
0
  term->quant = quant;
2663
0
  term->exp = exp;
2664
0
  return term;
2665
0
}
2666
2667
static struct term *make_get_test(struct term *lens, struct term *arg,
2668
0
                                  struct info *locp) {
2669
  /* Return a term for "get" LENS ARG */
2670
0
  struct info *info = clone_info(locp);
2671
0
  struct term *term = make_app_ident(strdup("get"), lens, info);
2672
0
  term = make_app_term(term, arg, ref(info));
2673
0
  return term;
2674
0
}
2675
2676
static struct term *make_put_test(struct term *lens, struct term *arg,
2677
0
                                  struct term *cmds, struct info *locp) {
2678
  /* Return a term for "put" LENS (CMDS ("get" LENS ARG)) ARG */
2679
0
  struct term *term = make_get_test(lens, arg, locp);
2680
0
  term = make_app_term(cmds, term, ref(term->info));
2681
0
  struct term *put = make_app_ident(strdup("put"), ref(lens), ref(term->info));
2682
0
  put = make_app_term(put, term, ref(term->info));
2683
0
  put = make_app_term(put, ref(arg), ref(term->info));
2684
0
  return put;
2685
0
}
2686
2687
static struct term *make_test(struct term *test, struct term *result,
2688
                              enum test_result_tag tr_tag,
2689
0
                              struct term *decls, struct info *locp) {
2690
0
  struct term *term = make_term_locp(A_TEST, locp);
2691
0
  term->tr_tag = tr_tag;
2692
0
  term->test = test;
2693
0
  term->result = result;
2694
0
  term->next = decls;
2695
0
  return term;
2696
0
}
2697
2698
0
static struct term *make_tree_value(struct tree *tree, struct info *locp) {
2699
0
  struct term *term = make_term_locp(A_VALUE, locp);
2700
0
  struct value *value = make_value(V_TREE, ref(term->info));
2701
0
  value->origin = make_tree_origin(tree);
2702
0
  term->value = value;
2703
0
  return term;
2704
0
}
2705
2706
0
static struct tree *tree_concat(struct tree *t1, struct tree *t2) {
2707
0
  if (t2 != NULL)
2708
0
    list_append(t1, t2);
2709
0
  return t1;
2710
0
}
2711
2712
void augl_error(struct info *locp,
2713
                struct term **term,
2714
                yyscan_t scanner,
2715
0
                const char *s) {
2716
0
  struct info info;
2717
0
  struct string string;
2718
0
  MEMZERO(&info, 1);
2719
0
  info.ref = string.ref = UINT_MAX;
2720
0
  info.filename = &string;
2721
2722
0
  if (locp != NULL) {
2723
0
    info.first_line   = locp->first_line;
2724
0
    info.first_column = locp->first_column;
2725
0
    info.last_line    = locp->last_line;
2726
0
    info.last_column  = locp->last_column;
2727
0
    info.filename->str = locp->filename->str;
2728
0
    info.error = locp->error;
2729
0
  } else if (scanner != NULL) {
2730
0
    info.first_line   = augl_get_lineno(scanner);
2731
0
    info.first_column = augl_get_column(scanner);
2732
0
    info.last_line    = augl_get_lineno(scanner);
2733
0
    info.last_column  = augl_get_column(scanner);
2734
0
    info.filename     = augl_get_info(scanner)->filename;
2735
0
    info.error        = augl_get_info(scanner)->error;
2736
0
  } else if (*term != NULL && (*term)->info != NULL) {
2737
0
    memcpy(&info, (*term)->info, sizeof(info));
2738
0
  } else {
2739
0
    info.first_line = info.last_line = 0;
2740
0
    info.first_column = info.last_column = 0;
2741
0
  }
2742
0
  syntax_error(&info, "%s", s);
2743
0
}