-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse.c
4035 lines (3600 loc) · 166 KB
/
parse.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "3.3.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 2
/* Push parsers. */
#define YYPUSH 0
/* Pull parsers. */
#define YYPULL 1
/* First part of user prologue. */
#line 28 "parse.y" /* yacc.c:337 */
#include <stdio.h>
#include "mawk.h"
#include "table.h"
#include "code.h"
#include "types_string.h"
#include "bi_funct.h"
#include "bi_vars.h"
#include "field.h"
#include "files.h"
#include "scan.h"
#include "printf.h"
#define YYMAXDEPTH 200
extern void eat_nl(YYSTYPE *yylval) ;
static void resize_fblock(FBLOCK *) ;
static void code_array(SYMTAB *) ;
static void code_call_id(CA_REC *, SYMTAB *) ;
static void field_A2I(void) ;
static void check_var(SYMTAB *) ;
static void check_array(SYMTAB *) ;
static void RE_as_arg(void) ;
int REempty(void *) ;
static int scope ;
static FBLOCK * active_funct ;
/* when scope is SCOPE_FUNCT */
#define code_address(x) if ( is_local(x) ) \
code2op(L_PUSHA, (x)->offset) ;\
else \
code2(_PUSHA, (x)->stval.cp)
#define CDP(x) (code_base+(x))
/* WARNING: These CDP() calculations become invalid after calls
that might change code_base. Which are: code2(), code2op(),
code_jmp() and code_pop().
*/
/* this nonsense caters to MSDOS large model */
#define CODE_FE_PUSHA() code_ptr->ptr = (void *) 0 ; \
code1(FE_PUSHA)
/* moves the active_code from MAIN to a BEGIN or END */
#define CODE_OPEN_BEGIN _code_open_BEGIN(&scope)
#define CODE_OPEN_END _code_open_END(&scope)
#define CODE_CLOSE_ACTIVE _code_close_active(&scope)
#define CODE_CLOSE_BEGIN _code_close_BEGIN(&scope)
#define CODE_CLOSE_END _code_close_END(&scope)
#define CODE_CLOSE_ACTIVE _code_close_active(&scope)
#define CODE_NOT_SCOPE(SCOPE, MSG) if ( scope != SCOPE ) \
compile_error("MSG") ;
static void
_code_open_BEGIN( int * scope ) {
*scope = SCOPE_BEGIN ;
*main_code_p = active_code;
if ( !begin_code_p )
begin_code_p = code_create_block();
active_code = *begin_code_p;
}
static void
_code_open_END( int * scope ) {
*scope = SCOPE_END ;
*main_code_p = active_code;
if ( !end_code_p )
end_code_p = code_create_block();
active_code = *end_code_p;
}
static inline void
__code_close_active( void ) {
active_code = *main_code_p ;
active_funct = (FBLOCK*) 0 ;
}
static void
_code_close_BEGIN(
int * scope
// CODEBLOCK * active_code_p
) {
// *begin_code_p = *active_code_p ;
*begin_code_p = active_code ;
__code_close_active();
*scope = SCOPE_MAIN ;
}
static void
_code_close_END(
int * scope
// CODEBLOCK * active_code_p
) {
// *end_code_p = *active_code_p ;
*end_code_p = active_code ;
__code_close_active();
*scope = SCOPE_MAIN ;
}
static void
_code_close_FUNCT(
int * scope
) {
__code_close_active();
*scope = SCOPE_MAIN ;
}
/* reset the active_code back to the MAIN block */
static void
_code_close_active( int * scope ) // switch_code_to_main(void)
{
switch (*scope) {
case SCOPE_MAIN :
__code_close_active();
break ;
case SCOPE_BEGIN :
_code_close_BEGIN(scope);
break ;
case SCOPE_END :
_code_close_END(scope);
break ;
case SCOPE_FUNCT :
_code_close_FUNCT(scope);
break ;
}
// case SCOPE_FUNCT :
// active_code = *main_code_p ;
// break ;
// case SCOPE_MAIN :
// break ;
// }
// active_funct = (FBLOCK*) 0 ;
// scope = SCOPE_MAIN ;
}
#line 209 "y.tab.c" /* yacc.c:337 */
# ifndef YY_NULLPTR
# if defined __cplusplus
# if 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# else
# define YY_NULLPTR 0
# endif
# else
# define YY_NULLPTR ((void*)0)
# endif
# endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif
/* In a future release of Bison, this section will be replaced
by #include "y.tab.h". */
#ifndef YY_YY_Y_TAB_H_INCLUDED
# define YY_YY_Y_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
UNEXPECTED = 258,
BAD_DECIMAL = 259,
NL = 260,
SEMI_COLON = 261,
LBRACE = 262,
RBRACE = 263,
LBOX = 264,
RBOX = 265,
COMMA = 266,
IO_OUT = 267,
ASSIGN = 268,
ADD_ASG = 269,
SUB_ASG = 270,
MUL_ASG = 271,
DIV_ASG = 272,
MOD_ASG = 273,
POW_ASG = 274,
QMARK = 275,
COLON = 276,
OR = 277,
AND = 278,
IN = 279,
MATCH = 280,
EQ = 281,
NEQ = 282,
LT = 283,
LTE = 284,
GT = 285,
GTE = 286,
CAT = 287,
GETLINE = 288,
PLUS = 289,
MINUS = 290,
MUL = 291,
DIV = 292,
MOD = 293,
NOT = 294,
UMINUS = 295,
IO_IN = 296,
PIPE = 297,
POW = 298,
INC_or_DEC = 299,
DOLLAR = 300,
FIELD = 301,
LPAREN = 302,
RPAREN = 303,
DOUBLE = 304,
STRING_ = 305,
RE = 306,
ID = 307,
D_ID = 308,
FUNCT_ID = 309,
BUILTIN = 310,
LENGTH = 311,
PRINT = 312,
PRINTF = 313,
SPLIT = 314,
MATCH_FUNC = 315,
SUB = 316,
GSUB = 317,
SPRINTF = 318,
DO = 319,
WHILE = 320,
FOR = 321,
BREAK = 322,
CONTINUE = 323,
IF = 324,
ELSE = 325,
DELETE = 326,
BEGIN = 327,
END = 328,
EXIT = 329,
NEXT = 330,
NEXTFILE = 331,
RETURN = 332,
FUNCTION = 333
};
#endif
/* Tokens. */
#define UNEXPECTED 258
#define BAD_DECIMAL 259
#define NL 260
#define SEMI_COLON 261
#define LBRACE 262
#define RBRACE 263
#define LBOX 264
#define RBOX 265
#define COMMA 266
#define IO_OUT 267
#define ASSIGN 268
#define ADD_ASG 269
#define SUB_ASG 270
#define MUL_ASG 271
#define DIV_ASG 272
#define MOD_ASG 273
#define POW_ASG 274
#define QMARK 275
#define COLON 276
#define OR 277
#define AND 278
#define IN 279
#define MATCH 280
#define EQ 281
#define NEQ 282
#define LT 283
#define LTE 284
#define GT 285
#define GTE 286
#define CAT 287
#define GETLINE 288
#define PLUS 289
#define MINUS 290
#define MUL 291
#define DIV 292
#define MOD 293
#define NOT 294
#define UMINUS 295
#define IO_IN 296
#define PIPE 297
#define POW 298
#define INC_or_DEC 299
#define DOLLAR 300
#define FIELD 301
#define LPAREN 302
#define RPAREN 303
#define DOUBLE 304
#define STRING_ 305
#define RE 306
#define ID 307
#define D_ID 308
#define FUNCT_ID 309
#define BUILTIN 310
#define LENGTH 311
#define PRINT 312
#define PRINTF 313
#define SPLIT 314
#define MATCH_FUNC 315
#define SUB 316
#define GSUB 317
#define SPRINTF 318
#define DO 319
#define WHILE 320
#define FOR 321
#define BREAK 322
#define CONTINUE 323
#define IF 324
#define ELSE 325
#define DELETE 326
#define BEGIN 327
#define END 328
#define EXIT 329
#define NEXT 330
#define NEXTFILE 331
#define RETURN 332
#define FUNCTION 333
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 167 "parse.y" /* yacc.c:352 */
CELL * cp ;
SYMTAB * stp ;
int start ; /* code starting address as offset from code_base */
PF_CP fp ; /* ptr to a (print/printf) or (sub/gsub) function */
BI_REC * bip ; /* ptr to info about a builtin */
FBLOCK * fbp ; /* ptr to a function block */
ARG2_REC * arg2p ;
CA_REC * ca_p ;
int ival ;
void * ptr ;
#line 421 "y.tab.c" /* yacc.c:352 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
int yyparse (void);
#endif /* !YY_YY_Y_TAB_H_INCLUDED */
#ifdef short
# undef short
#endif
#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#else
typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short yytype_int16;
#endif
#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
# elif ! defined YYSIZE_T
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
# define YYSIZE_T unsigned
# endif
#endif
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
# define YY_(Msgid) Msgid
# endif
#endif
#ifndef YY_ATTRIBUTE
# if (defined __GNUC__ \
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
# define YY_ATTRIBUTE(Spec) /* empty */
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E) /* empty */
#endif
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# elif defined __BUILTIN_VA_ARG_INCR
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
# elif defined _AIX
# define YYSTACK_ALLOC __alloca
# elif defined _MSC_VER
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
/* Pacify GCC's 'empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
to allow for a few compiler-allocated temporary stack slots. */
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
# endif
# else
# define YYSTACK_ALLOC YYMALLOC
# define YYSTACK_FREE YYFREE
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 100
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 1451
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 79
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 61
/* YYNRULES -- Number of rules. */
#define YYNRULES 186
/* YYNSTATES -- Number of states. */
#define YYNSTATES 367
#define YYUNDEFTOK 2
#define YYMAXUTOK 333
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 242, 242, 244, 244, 249, 250, 252, 253, 254,
256, 258, 258, 262, 262, 267, 267, 272, 286, 272,
294, 296, 301, 302, 308, 309, 311, 312, 314, 316,
321, 325, 329, 331, 335, 341, 342, 345, 346, 348,
350, 352, 354, 356, 358, 360, 362, 364, 366, 368,
370, 372, 397, 397, 404, 404, 410, 412, 410, 418,
419, 422, 425, 428, 437, 440, 444, 446, 448, 450,
452, 454, 456, 459, 462, 465, 467, 475, 482, 487,
494, 499, 501, 503, 505, 508, 529, 532, 543, 548,
557, 560, 572, 580, 592, 605, 609, 612, 614, 618,
622, 626, 630, 631, 635, 641, 644, 649, 653, 658,
664, 682, 701, 717, 719, 723, 725, 739, 743, 751,
755, 763, 776, 787, 804, 811, 818, 829, 841, 844,
852, 862, 865, 869, 872, 873, 874, 875, 876, 877,
878, 884, 887, 892, 894, 924, 928, 932, 935, 976,
981, 997, 1000, 1003, 1006, 1010, 1016, 1021, 1026, 1030,
1036, 1038, 1039, 1041, 1044, 1050, 1066, 1068, 1072, 1075,
1081, 1086, 1107, 1124, 1129, 1131, 1134, 1139, 1152, 1159,
1175, 1177, 1189, 1191, 1197, 1204, 1208
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNEXPECTED", "BAD_DECIMAL", "NL",
"SEMI_COLON", "LBRACE", "RBRACE", "LBOX", "RBOX", "COMMA", "IO_OUT",
"ASSIGN", "ADD_ASG", "SUB_ASG", "MUL_ASG", "DIV_ASG", "MOD_ASG",
"POW_ASG", "QMARK", "COLON", "OR", "AND", "IN", "MATCH", "EQ", "NEQ",
"LT", "LTE", "GT", "GTE", "CAT", "GETLINE", "PLUS", "MINUS", "MUL",
"DIV", "MOD", "NOT", "UMINUS", "IO_IN", "PIPE", "POW", "INC_or_DEC",
"DOLLAR", "FIELD", "LPAREN", "RPAREN", "DOUBLE", "STRING_", "RE", "ID",
"D_ID", "FUNCT_ID", "BUILTIN", "LENGTH", "PRINT", "PRINTF", "SPLIT",
"MATCH_FUNC", "SUB", "GSUB", "SPRINTF", "DO", "WHILE", "FOR", "BREAK",
"CONTINUE", "IF", "ELSE", "DELETE", "BEGIN", "END", "EXIT", "NEXT",
"NEXTFILE", "RETURN", "FUNCTION", "$accept", "start", "$@1", "program",
"program_block", "PA_block", "$@2", "$@3", "$@4", "$@5", "$@6", "block",
"block_or_separator", "stmt_list", "statement", "separator", "expr",
"$@7", "$@8", "$@9", "$@10", "cat_expr", "p_expr", "lvalue", "arglist",
"args", "builtin", "string_comma", "mark", "pmark", "printf_args",
"pr_args", "arg2", "pr_direction", "if_front", "else", "do",
"while_front", "for1", "for2", "for3", "array_loop_front", "field",
"split_front", "split_back", "re_arg", "return_stmt", "getline",
"fvalue", "getline_file", "sub_or_gsub", "sub_back", "function_def",
"funct_start", "funct_head", "f_arglist", "f_args", "outside_error",
"call_args", "ca_front", "ca_back", YY_NULLPTR
};
#endif
# ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
325, 326, 327, 328, 329, 330, 331, 332, 333
};
# endif
#define YYPACT_NINF -214
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-214)))
#define YYTABLE_NINF -122
#define yytable_value_is_error(Yytable_value) \
(!!((Yytable_value) == (-122)))
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
static const yytype_int16 yypact[] =
{
378, -214, 611, -214, 1034, 1034, 1034, -15, 848, -214,
1065, -214, -214, -214, 387, -214, -214, -38, -11, -2,
-214, -214, -214, -214, -214, 23, 62, 688, 315, -214,
-214, -214, 1354, 1034, 144, 318, -214, 753, -5, 33,
1034, 8, -214, 65, 42, 65, 6, -214, -214, -214,
-214, -214, 51, 53, -1, -1, 59, 90, 755, -1,
-1, 755, -214, 534, -214, -214, 1295, 688, 688, 688,
786, 688, -214, 1065, 20, -27, 64, -27, -27, 41,
135, -214, -214, 135, -214, 449, -4, 179, -214, 137,
107, 112, 879, 1065, 1065, 119, 65, 65, -214, -214,
-214, -1, 457, -214, -214, -214, -214, -214, 116, 1065,
1065, 1065, 1065, 1065, 1065, 1065, 98, 144, 1034, 1034,
1034, 1034, 1034, 136, 1034, 1065, 1065, 1065, 1065, 1065,
1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, -214,
1065, -214, -214, -214, -214, -214, 130, -18, 1065, -214,
121, -214, -214, -214, 1096, 1127, 1065, 817, -214, -214,
1065, -1, -214, 1295, -214, -214, -214, 1295, -214, -214,
-214, 104, 134, -214, -214, 1321, 910, -214, 1202, 166,
129, 175, 191, 1065, -214, 1065, 181, -214, 1065, 159,
-214, 1158, 1065, -214, 257, 1214, 1375, 1396, 941, -214,
-214, 1065, 1065, 1065, 1065, -214, 609, -214, -214, -214,
-214, -214, -214, -214, -214, -214, 195, 195, -27, -27,
-27, -15, 165, 1420, 1420, 1420, 1420, 1420, 1420, 1420,
1420, 1420, 1420, 1420, 1420, 1420, 1420, 1229, -214, 1420,
198, -214, 168, 208, 972, 1420, -214, 209, 205, 1003,
211, 1065, 205, 1241, -214, 687, 1333, 1256, -214, 215,
-214, -214, -214, 688, 178, -214, -214, 1268, 688, 1065,
1065, 1065, 1420, 1420, 174, 55, -214, 241, 526, -214,
180, -214, -214, 177, 1065, -214, 9, 1065, 1420, 1408,
458, 535, -214, -214, 1065, -214, 182, -214, 11, 1065,
1065, -1, 1065, -214, 209, 205, -1, -214, 183, -214,
-214, 1065, -214, 1065, -214, -214, 108, 110, 113, -214,
764, -214, -214, -214, -214, -214, -214, 192, -214, 12,
98, -214, 603, -214, 181, 1420, 1420, -214, 193, -1,
-214, 194, 140, 1283, 199, -214, -214, -214, -214, -214,
-214, 1065, -15, -214, -214, 205, -214, -214, -1, -1,
1420, 197, -1, -214, -214, -214, -214
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE does not specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
0, 178, 0, 160, 0, 0, 0, 0, 0, 128,
0, 61, 62, 65, 63, 90, 90, 145, 0, 0,
166, 167, 90, 11, 13, 0, 0, 0, 0, 5,
7, 10, 15, 37, 59, 0, 75, 133, 0, 155,
0, 0, 8, 0, 0, 0, 0, 35, 36, 95,
95, 108, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 26, 0, 24, 28, 0, 0, 0, 0,
0, 0, 32, 0, 63, 73, 133, 74, 72, 0,
80, 77, 79, 129, 131, 0, 0, 133, 76, 0,
0, 0, 0, 0, 0, 0, 0, 0, 172, 173,
1, 0, 0, 6, 17, 56, 52, 54, 0, 0,
0, 0, 0, 0, 0, 0, 0, 60, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 78,
0, 143, 141, 163, 161, 162, 156, 157, 0, 170,
174, 9, 21, 29, 81, 81, 0, 0, 30, 31,
0, 90, 151, 0, 33, 34, 153, 0, 20, 25,
27, 105, 0, 111, 115, 0, 0, 127, 0, 0,
0, 0, 0, 0, 64, 0, 0, 132, 0, 182,
179, 0, 81, 146, 63, 0, 0, 0, 0, 12,
14, 0, 0, 0, 0, 119, 51, 45, 46, 47,
48, 49, 50, 22, 16, 23, 66, 67, 68, 69,
70, 158, 71, 38, 39, 40, 41, 42, 43, 44,
134, 135, 136, 137, 138, 139, 140, 0, 164, 150,
0, 176, 0, 175, 0, 83, 97, 82, 102, 0,
62, 0, 102, 0, 113, 63, 0, 0, 125, 0,
152, 154, 106, 0, 0, 116, 117, 0, 0, 0,
0, 0, 100, 101, 0, 0, 180, 63, 0, 181,
0, 148, 147, 0, 0, 86, 0, 0, 18, 0,
53, 55, 159, 144, 0, 171, 0, 99, 0, 0,
0, 0, 0, 89, 96, 102, 0, 110, 0, 114,
104, 0, 107, 0, 118, 112, 0, 0, 0, 120,
122, 184, 186, 183, 185, 85, 142, 0, 88, 0,
0, 57, 0, 177, 98, 84, 103, 91, 0, 0,
92, 0, 0, 0, 122, 121, 130, 123, 149, 87,
19, 0, 0, 168, 165, 102, 93, 126, 0, 0,
58, 0, 0, 124, 109, 169, 94
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-214, -214, -214, -214, 219, -214, -214, -214, -214, -214,
-214, 56, -82, 224, -50, -20, 0, -214, -214, -214,
-214, -214, 206, -6, 61, -81, -214, -195, 75, 212,
-41, 114, 255, -210, -214, -214, -214, -214, -214, -214,
-214, -214, 43, -214, -214, -17, -214, -214, -213, -214,
-214, -214, -214, -214, -214, -214, -214, -214, -214, -214,
-214
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 26, 27, 28, 29, 30, 96, 97, 116, 201,
330, 62, 214, 63, 64, 65, 245, 203, 204, 202,
351, 33, 34, 35, 246, 247, 36, 251, 89, 154,
305, 248, 298, 301, 67, 263, 68, 69, 70, 176,
268, 71, 37, 38, 142, 240, 72, 39, 146, 40,
41, 354, 42, 43, 44, 242, 243, 45, 190, 191,
279
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule whose
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int16 yytable[] =
{
32, 81, 66, 287, 47, 48, 140, 185, 292, 92,
85, 47, 48, 169, 152, 123, 124, 171, 172, 173,
299, 177, 185, 299, -122, 124, 153, 66, 32, -90,
8, 9, 79, 144, 158, 159, 93, 80, 162, 164,
165, 166, 306, 141, 186, 94, 170, 76, 76, 76,
82, 76, 169, 87, 302, 148, 31, 328, 163, 334,
349, 167, 100, 66, 88, 320, 299, 66, 66, 66,
175, 66, 2, 178, 143, 98, 76, 99, 8, 9,
79, 153, 145, 76, 31, 80, 8, 9, 79, 150,
90, 91, 195, 196, 197, 339, 215, 95, 156, 149,
157, 151, 66, 47, 48, 2, 160, 275, 139, 206,
207, 208, 209, 210, 211, 212, 87, 286, 344, 299,
345, 299, 180, 346, 299, 223, 224, 225, 226, 227,
228, 229, 230, 231, 232, 233, 234, 235, 236, 361,
237, 258, 161, 260, -90, 362, 188, 261, 239, 179,
358, 299, 199, 200, 189, 181, 253, 256, 182, 192,
257, 76, 76, 76, 76, 76, 198, 76, 205, 221,
304, 238, 213, 241, 262, 269, 267, 187, 118, 119,
120, 121, 122, 272, 270, 273, 123, 124, 316, 317,
318, 278, 132, 133, 134, 135, 136, 137, 138, 264,
271, 288, 289, 290, 291, 274, 329, 276, 124, 294,
75, 77, 78, 312, 84, 144, 295, 300, 315, 296,
299, 304, 303, 139, 311, 313, 319, 187, 325, 326,
342, 120, 121, 122, 333, 341, 259, 123, 124, 117,
348, 355, 357, 347, 85, 365, 147, 103, 350, 85,
-90, 102, 321, 280, -80, -80, -80, -80, -80, -80,
-80, 338, 155, 66, 145, 86, -90, 327, 66, 252,
-80, -80, -80, -80, -80, -80, -80, 0, 0, 0,
0, 337, 0, 0, 239, 88, 340, 87, 0, 322,
0, 0, 87, 0, 332, 0, 0, 0, 0, 335,
336, 88, 0, 0, 0, 281, 0, 0, 0, 0,
215, 0, 0, 343, 0, -2, 1, 0, 0, 356,
0, 0, 2, 0, 216, 217, 218, 219, 220, 0,
222, 125, 126, 127, 128, 129, 130, 131, 363, 364,
0, 0, 366, 0, 0, 0, 144, 0, 3, 4,
5, 360, 0, 0, 6, 0, 0, 0, 0, 7,
8, 9, 10, 0, 11, 12, 13, 14, 0, 15,
16, 17, 0, 0, 18, 19, 20, 21, 22, 1,
0, 0, 0, -3, -3, 2, 213, 23, 24, 0,
0, 0, 0, 25, 0, 145, -90, 0, 0, 0,
-80, -80, -80, -80, -80, -80, -80, 0, 0, 0,
0, 3, 4, 5, 0, 0, 0, 6, 0, 0,
0, 0, 7, 8, 9, 10, 0, 11, 12, 13,
14, 88, 15, 16, 17, -3, -3, 18, 19, 20,
21, 22, -3, -3, -3, -3, -3, -3, 0, -3,
23, 24, -3, -3, -3, -3, 25, -4, 101, 0,
183, 0, 47, 48, 2, 0, 0, 0, 0, 105,
0, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 107, 108, 109, 110, 111, 112, 113, 114, 115,
3, 4, 5, 0, 0, 0, 6, 184, 0, 0,
0, 7, 8, 9, 10, 0, 11, 12, 13, 14,
0, 15, 16, 17, 49, 50, 18, 19, 20, 21,
22, 51, 52, 53, 54, 55, 56, 0, 57, 0,
0, 58, 59, 60, 61, 101, 0, 323, 0, 47,
48, 2, 168, 0, 0, 0, 105, 0, 106, 107,
108, 109, 110, 111, 112, 113, 114, 115, 0, 108,
109, 110, 111, 112, 113, 114, 115, 3, 4, 5,
0, 0, 0, 6, 324, 0, 0, 0, 7, 8,
9, 10, 0, 11, 12, 13, 14, 0, 15, 16,
17, 49, 50, 18, 19, 20, 21, 22, 51, 52,
53, 54, 55, 56, 0, 57, 0, 0, 58, 59,
60, 61, 46, 0, 352, 0, 47, 48, 2, 0,
0, 0, 0, 105, 0, 106, 107, 108, 109, 110,
111, 112, 113, 114, 115, 110, 111, 112, 113, 114,
115, 0, 0, 0, 3, 4, 5, 0, 0, 0,
6, 353, 0, 0, 0, 7, 8, 9, 10, 0,
11, 12, 13, 14, 0, 15, 16, 17, 49, 50,
18, 19, 20, 21, 22, 51, 52, 53, 54, 55,
56, 0, 57, 0, 0, 58, 59, 60, 61, 101,
0, 0, 0, 47, 48, 2, -90, 0, 0, 0,
-80, -80, -80, -80, -80, -80, -80, 0, 0, 0,
0, 308, 0, 0, 0, 0, 0, 0, 0, 0,
0, 3, 4, 5, 0, 0, 0, 6, 0, 0,
0, 88, 7, 8, 9, 10, 0, 11, 12, 13,
14, 0, 15, 16, 17, 49, 50, 18, 19, 20,
21, 22, 51, 52, 53, 54, 55, 56, 0, 57,
47, 48, 58, 59, 60, 61, 132, 133, 134, 135,
136, 137, 138, 0, 0, 0, 0, -121, -121, -121,