OpenVAS Scanner 22.7.9
nasl_grammar.tab.c
Go to the documentation of this file.
1/* A Bison parser, made by GNU Bison 3.7.6. */
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 30706
50
51/* Bison version string. */
52#define YYBISON_VERSION "3.7.6"
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 naslparse
69#define yylex nasllex
70#define yyerror naslerror
71#define yydebug nasldebug
72#define yynerrs naslnerrs
73
74/* First part of user prologue. */
75#line 12 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
76
77
78#define YYPARSE_PARAM parm
79#define YYLEX_PARAM parm
80#define YYPARSE_ERRC err_c
81#define YYLEX_ERRC err_c
82
83#define LNB (((naslctxt*)parm)->line_nb)
84#define LN (((naslctxt*)parm)->name)
85#define ERRC err_c
86
87#include <ctype.h> /* for isalpha */
88#include <pcap.h> /* for islocalhost */
89#include <string.h> /* for strlen */
90#include <sys/stat.h> /* for stat */
91
92#include <glib.h>
93
94#include "../misc/plugutils.h"
95#include "nasl_tree.h"
96#include "nasl_global_ctxt.h"
97#include "nasl_func.h"
98#include "nasl_var.h"
99#include "nasl_lex_ctxt.h"
100#include "nasl_debug.h"
101#include "nasl_signature.h"
102
103#undef G_LOG_DOMAIN
107#define G_LOG_DOMAIN "lib nasl"
108
109static char *parse_buffer = NULL;
110
111static int parse_len = 0;
112static int include_order = 0;
113
114static void naslerror(naslctxt *, int *, const char *);
115
116GHashTable *includes_hash = NULL;
117
118#define YYERROR_VERBOSE
119
120#line 121 "nasl_grammar.tab.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# 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# define YY_NULLPTR ((void*)0)
140# endif
141# endif
142
143#include "nasl_grammar.tab.h"
144/* Symbol kind. */
146{
148 YYSYMBOL_YYEOF = 0, /* "end of file" */
149 YYSYMBOL_YYerror = 1, /* error */
150 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
151 YYSYMBOL_IF = 3, /* IF */
152 YYSYMBOL_ELSE = 4, /* ELSE */
153 YYSYMBOL_EQ = 5, /* EQ */
154 YYSYMBOL_NEQ = 6, /* NEQ */
155 YYSYMBOL_SUPEQ = 7, /* SUPEQ */
156 YYSYMBOL_INFEQ = 8, /* INFEQ */
157 YYSYMBOL_OR = 9, /* OR */
158 YYSYMBOL_AND = 10, /* AND */
159 YYSYMBOL_MATCH = 11, /* MATCH */
160 YYSYMBOL_NOMATCH = 12, /* NOMATCH */
161 YYSYMBOL_REP = 13, /* REP */
162 YYSYMBOL_FOR = 14, /* FOR */
163 YYSYMBOL_REPEAT = 15, /* REPEAT */
164 YYSYMBOL_UNTIL = 16, /* UNTIL */
165 YYSYMBOL_FOREACH = 17, /* FOREACH */
166 YYSYMBOL_WHILE = 18, /* WHILE */
167 YYSYMBOL_BREAK = 19, /* BREAK */
168 YYSYMBOL_CONTINUE = 20, /* CONTINUE */
169 YYSYMBOL_FUNCTION = 21, /* FUNCTION */
170 YYSYMBOL_RETURN = 22, /* RETURN */
171 YYSYMBOL_INCLUDE = 23, /* INCLUDE */
172 YYSYMBOL_LOCAL = 24, /* LOCAL */
173 YYSYMBOL_GLOBAL = 25, /* GLOBAL */
174 YYSYMBOL_PLUS_PLUS = 26, /* PLUS_PLUS */
175 YYSYMBOL_MINUS_MINUS = 27, /* MINUS_MINUS */
176 YYSYMBOL_L_SHIFT = 28, /* L_SHIFT */
177 YYSYMBOL_R_SHIFT = 29, /* R_SHIFT */
178 YYSYMBOL_R_USHIFT = 30, /* R_USHIFT */
179 YYSYMBOL_EXPO = 31, /* EXPO */
180 YYSYMBOL_PLUS_EQ = 32, /* PLUS_EQ */
181 YYSYMBOL_MINUS_EQ = 33, /* MINUS_EQ */
182 YYSYMBOL_MULT_EQ = 34, /* MULT_EQ */
183 YYSYMBOL_DIV_EQ = 35, /* DIV_EQ */
184 YYSYMBOL_MODULO_EQ = 36, /* MODULO_EQ */
185 YYSYMBOL_L_SHIFT_EQ = 37, /* L_SHIFT_EQ */
186 YYSYMBOL_R_SHIFT_EQ = 38, /* R_SHIFT_EQ */
187 YYSYMBOL_R_USHIFT_EQ = 39, /* R_USHIFT_EQ */
188 YYSYMBOL_RE_MATCH = 40, /* RE_MATCH */
189 YYSYMBOL_RE_NOMATCH = 41, /* RE_NOMATCH */
190 YYSYMBOL_ARROW = 42, /* ARROW */
191 YYSYMBOL_IDENT = 43, /* IDENT */
192 YYSYMBOL_STRING1 = 44, /* STRING1 */
193 YYSYMBOL_STRING2 = 45, /* STRING2 */
194 YYSYMBOL_INTEGER = 46, /* INTEGER */
195 YYSYMBOL_47_ = 47, /* '=' */
196 YYSYMBOL_48_ = 48, /* '<' */
197 YYSYMBOL_49_ = 49, /* '>' */
198 YYSYMBOL_50_ = 50, /* '|' */
199 YYSYMBOL_51_ = 51, /* '^' */
200 YYSYMBOL_52_ = 52, /* '&' */
201 YYSYMBOL_53_ = 53, /* '+' */
202 YYSYMBOL_54_ = 54, /* '-' */
203 YYSYMBOL_55_ = 55, /* '*' */
204 YYSYMBOL_56_ = 56, /* '/' */
205 YYSYMBOL_57_ = 57, /* '%' */
206 YYSYMBOL_NOT = 58, /* NOT */
207 YYSYMBOL_UMINUS = 59, /* UMINUS */
208 YYSYMBOL_BIT_NOT = 60, /* BIT_NOT */
209 YYSYMBOL_61_ = 61, /* '(' */
210 YYSYMBOL_62_ = 62, /* ')' */
211 YYSYMBOL_63_ = 63, /* ',' */
212 YYSYMBOL_64_ = 64, /* '{' */
213 YYSYMBOL_65_ = 65, /* '}' */
214 YYSYMBOL_66_ = 66, /* ';' */
215 YYSYMBOL_67_ = 67, /* ':' */
216 YYSYMBOL_68_ = 68, /* '[' */
217 YYSYMBOL_69_ = 69, /* ']' */
218 YYSYMBOL_70_ = 70, /* '!' */
219 YYSYMBOL_71_ = 71, /* '~' */
220 YYSYMBOL_72_ = 72, /* '.' */
221 YYSYMBOL_YYACCEPT = 73, /* $accept */
222 YYSYMBOL_tiptop = 74, /* tiptop */
223 YYSYMBOL_instr_decl_list = 75, /* instr_decl_list */
224 YYSYMBOL_instr_decl = 76, /* instr_decl */
225 YYSYMBOL_func_decl = 77, /* func_decl */
226 YYSYMBOL_arg_decl = 78, /* arg_decl */
227 YYSYMBOL_arg_decl_1 = 79, /* arg_decl_1 */
228 YYSYMBOL_block = 80, /* block */
229 YYSYMBOL_instr_list = 81, /* instr_list */
230 YYSYMBOL_instr = 82, /* instr */
231 YYSYMBOL_simple_instr = 83, /* simple_instr */
232 YYSYMBOL_ret = 84, /* ret */
233 YYSYMBOL_if_block = 85, /* if_block */
234 YYSYMBOL_loop = 86, /* loop */
235 YYSYMBOL_for_loop = 87, /* for_loop */
236 YYSYMBOL_while_loop = 88, /* while_loop */
237 YYSYMBOL_repeat_loop = 89, /* repeat_loop */
238 YYSYMBOL_foreach_loop = 90, /* foreach_loop */
239 YYSYMBOL_aff_func = 91, /* aff_func */
240 YYSYMBOL_rep = 92, /* rep */
241 YYSYMBOL_string = 93, /* string */
242 YYSYMBOL_inc = 94, /* inc */
243 YYSYMBOL_func_call = 95, /* func_call */
244 YYSYMBOL_arg_list = 96, /* arg_list */
245 YYSYMBOL_arg_list_1 = 97, /* arg_list_1 */
246 YYSYMBOL_arg = 98, /* arg */
247 YYSYMBOL_aff = 99, /* aff */
248 YYSYMBOL_lvalue = 100, /* lvalue */
249 YYSYMBOL_identifier = 101, /* identifier */
250 YYSYMBOL_array_elem = 102, /* array_elem */
251 YYSYMBOL_array_index = 103, /* array_index */
252 YYSYMBOL_post_pre_incr = 104, /* post_pre_incr */
253 YYSYMBOL_expr = 105, /* expr */
254 YYSYMBOL_const_array = 106, /* const_array */
255 YYSYMBOL_list_array_data = 107, /* list_array_data */
256 YYSYMBOL_array_data = 108, /* array_data */
257 YYSYMBOL_atom = 109, /* atom */
258 YYSYMBOL_simple_array_data = 110, /* simple_array_data */
259 YYSYMBOL_var = 111, /* var */
260 YYSYMBOL_var_name = 112, /* var_name */
261 YYSYMBOL_ipaddr = 113, /* ipaddr */
262 YYSYMBOL_loc = 114, /* loc */
263 YYSYMBOL_glob = 115 /* glob */
266
267
268/* Second part of user prologue. */
269#line 67 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
270
271static int nasllex(YYSTYPE * lvalp, void * parm, int * err_c);
272
273#line 274 "nasl_grammar.tab.c"
274
275
276#ifdef short
277# undef short
278#endif
279
280/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
281 <limits.h> and (if available) <stdint.h> are included
282 so that the code can choose integer types of a good width. */
283
284#ifndef __PTRDIFF_MAX__
285# include <limits.h> /* INFRINGES ON USER NAME SPACE */
286# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
287# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
288# define YY_STDINT_H
289# endif
290#endif
291
292/* Narrow types that promote to a signed type and that can represent a
293 signed or unsigned integer of at least N bits. In tables they can
294 save space and decrease cache pressure. Promoting to a signed type
295 helps avoid bugs in integer arithmetic. */
296
297#ifdef __INT_LEAST8_MAX__
298typedef __INT_LEAST8_TYPE__ yytype_int8;
299#elif defined YY_STDINT_H
300typedef int_least8_t yytype_int8;
301#else
302typedef signed char yytype_int8;
303#endif
304
305#ifdef __INT_LEAST16_MAX__
306typedef __INT_LEAST16_TYPE__ yytype_int16;
307#elif defined YY_STDINT_H
308typedef int_least16_t yytype_int16;
309#else
310typedef short yytype_int16;
311#endif
312
313/* Work around bug in HP-UX 11.23, which defines these macros
314 incorrectly for preprocessor constants. This workaround can likely
315 be removed in 2023, as HPE has promised support for HP-UX 11.23
316 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
317 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
318#ifdef __hpux
319# undef UINT_LEAST8_MAX
320# undef UINT_LEAST16_MAX
321# define UINT_LEAST8_MAX 255
322# define UINT_LEAST16_MAX 65535
323#endif
324
325#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
326typedef __UINT_LEAST8_TYPE__ yytype_uint8;
327#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
328 && UINT_LEAST8_MAX <= INT_MAX)
329typedef uint_least8_t yytype_uint8;
330#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
331typedef unsigned char yytype_uint8;
332#else
333typedef short yytype_uint8;
334#endif
335
336#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
337typedef __UINT_LEAST16_TYPE__ yytype_uint16;
338#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
339 && UINT_LEAST16_MAX <= INT_MAX)
340typedef uint_least16_t yytype_uint16;
341#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
342typedef unsigned short yytype_uint16;
343#else
344typedef int yytype_uint16;
345#endif
346
347#ifndef YYPTRDIFF_T
348# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
349# define YYPTRDIFF_T __PTRDIFF_TYPE__
350# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
351# elif defined PTRDIFF_MAX
352# ifndef ptrdiff_t
353# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
354# endif
355# define YYPTRDIFF_T ptrdiff_t
356# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
357# else
358# define YYPTRDIFF_T long
359# define YYPTRDIFF_MAXIMUM LONG_MAX
360# endif
361#endif
362
363#ifndef YYSIZE_T
364# ifdef __SIZE_TYPE__
365# define YYSIZE_T __SIZE_TYPE__
366# elif defined size_t
367# define YYSIZE_T size_t
368# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
369# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
370# define YYSIZE_T size_t
371# else
372# define YYSIZE_T unsigned
373# endif
374#endif
375
376#define YYSIZE_MAXIMUM \
377 YY_CAST (YYPTRDIFF_T, \
378 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
379 ? YYPTRDIFF_MAXIMUM \
380 : YY_CAST (YYSIZE_T, -1)))
381
382#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
383
384
385/* Stored state numbers (used for stacks). */
387
388/* State numbers in computations. */
389typedef int yy_state_fast_t;
390
391#ifndef YY_
392# if defined YYENABLE_NLS && YYENABLE_NLS
393# if ENABLE_NLS
394# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
395# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
396# endif
397# endif
398# ifndef YY_
399# define YY_(Msgid) Msgid
400# endif
401#endif
402
403
404#ifndef YY_ATTRIBUTE_PURE
405# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
406# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
407# else
408# define YY_ATTRIBUTE_PURE
409# endif
410#endif
411
412#ifndef YY_ATTRIBUTE_UNUSED
413# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
414# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
415# else
416# define YY_ATTRIBUTE_UNUSED
417# endif
418#endif
419
420/* Suppress unused-variable warnings by "using" E. */
421#if ! defined lint || defined __GNUC__
422# define YY_USE(E) ((void) (E))
423#else
424# define YY_USE(E) /* empty */
425#endif
426
427#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
428/* Suppress an incorrect diagnostic about yylval being uninitialized. */
429# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
430 _Pragma ("GCC diagnostic push") \
431 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
432 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
433# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
434 _Pragma ("GCC diagnostic pop")
435#else
436# define YY_INITIAL_VALUE(Value) Value
437#endif
438#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
439# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
440# define YY_IGNORE_MAYBE_UNINITIALIZED_END
441#endif
442#ifndef YY_INITIAL_VALUE
443# define YY_INITIAL_VALUE(Value) /* Nothing. */
444#endif
445
446#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
447# define YY_IGNORE_USELESS_CAST_BEGIN \
448 _Pragma ("GCC diagnostic push") \
449 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
450# define YY_IGNORE_USELESS_CAST_END \
451 _Pragma ("GCC diagnostic pop")
452#endif
453#ifndef YY_IGNORE_USELESS_CAST_BEGIN
454# define YY_IGNORE_USELESS_CAST_BEGIN
455# define YY_IGNORE_USELESS_CAST_END
456#endif
457
458
459#define YY_ASSERT(E) ((void) (0 && (E)))
460
461#if !defined yyoverflow
462
463/* The parser invokes alloca or malloc; define the necessary symbols. */
464
465# ifdef YYSTACK_USE_ALLOCA
466# if YYSTACK_USE_ALLOCA
467# ifdef __GNUC__
468# define YYSTACK_ALLOC __builtin_alloca
469# elif defined __BUILTIN_VA_ARG_INCR
470# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
471# elif defined _AIX
472# define YYSTACK_ALLOC __alloca
473# elif defined _MSC_VER
474# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
475# define alloca _alloca
476# else
477# define YYSTACK_ALLOC alloca
478# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
479# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
480 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
481# ifndef EXIT_SUCCESS
482# define EXIT_SUCCESS 0
483# endif
484# endif
485# endif
486# endif
487# endif
488
489# ifdef YYSTACK_ALLOC
490 /* Pacify GCC's 'empty if-body' warning. */
491# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
492# ifndef YYSTACK_ALLOC_MAXIMUM
493 /* The OS might guarantee only one guard page at the bottom of the stack,
494 and a page size can be as small as 4096 bytes. So we cannot safely
495 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
496 to allow for a few compiler-allocated temporary stack slots. */
497# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
498# endif
499# else
500# define YYSTACK_ALLOC YYMALLOC
501# define YYSTACK_FREE YYFREE
502# ifndef YYSTACK_ALLOC_MAXIMUM
503# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
504# endif
505# if (defined __cplusplus && ! defined EXIT_SUCCESS \
506 && ! ((defined YYMALLOC || defined malloc) \
507 && (defined YYFREE || defined free)))
508# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
509# ifndef EXIT_SUCCESS
510# define EXIT_SUCCESS 0
511# endif
512# endif
513# ifndef YYMALLOC
514# define YYMALLOC malloc
515# if ! defined malloc && ! defined EXIT_SUCCESS
516void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
517# endif
518# endif
519# ifndef YYFREE
520# define YYFREE free
521# if ! defined free && ! defined EXIT_SUCCESS
522void free (void *); /* INFRINGES ON USER NAME SPACE */
523# endif
524# endif
525# endif
526#endif /* !defined yyoverflow */
527
528#if (! defined yyoverflow \
529 && (! defined __cplusplus \
530 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
531
532/* A type that is properly aligned for any stack member. */
534{
537};
538
539/* The size of the maximum gap between one aligned stack and the next. */
540# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
541
542/* The size of an array large to enough to hold all stacks, each with
543 N elements. */
544# define YYSTACK_BYTES(N) \
545 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
546 + YYSTACK_GAP_MAXIMUM)
547
548# define YYCOPY_NEEDED 1
549
550/* Relocate STACK from its old location to the new one. The
551 local variables YYSIZE and YYSTACKSIZE give the old and new number of
552 elements in the stack, and YYPTR gives the new location of the
553 stack. Advance YYPTR to a properly aligned location for the next
554 stack. */
555# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
556 do \
557 { \
558 YYPTRDIFF_T yynewbytes; \
559 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
560 Stack = &yyptr->Stack_alloc; \
561 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
562 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
563 } \
564 while (0)
565
566#endif
567
568#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
569/* Copy COUNT objects from SRC to DST. The source and destination do
570 not overlap. */
571# ifndef YYCOPY
572# if defined __GNUC__ && 1 < __GNUC__
573# define YYCOPY(Dst, Src, Count) \
574 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
575# else
576# define YYCOPY(Dst, Src, Count) \
577 do \
578 { \
579 YYPTRDIFF_T yyi; \
580 for (yyi = 0; yyi < (Count); yyi++) \
581 (Dst)[yyi] = (Src)[yyi]; \
582 } \
583 while (0)
584# endif
585# endif
586#endif /* !YYCOPY_NEEDED */
587
588/* YYFINAL -- State number of the termination state. */
589#define YYFINAL 80
590/* YYLAST -- Last index in YYTABLE. */
591#define YYLAST 1009
592
593/* YYNTOKENS -- Number of terminals. */
594#define YYNTOKENS 73
595/* YYNNTS -- Number of nonterminals. */
596#define YYNNTS 43
597/* YYNRULES -- Number of rules. */
598#define YYNRULES 127
599/* YYNSTATES -- Number of states. */
600#define YYNSTATES 229
601
602/* YYMAXUTOK -- Last valid token kind. */
603#define YYMAXUTOK 304
604
605
606/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
607 as returned by yylex, with out-of-bounds checking. */
608#define YYTRANSLATE(YYX) \
609 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
610 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
611 : YYSYMBOL_YYUNDEF)
612
613/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
614 as returned by yylex. */
615static const yytype_int8 yytranslate[] =
616{
617 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 2, 2, 2, 70, 2, 2, 2, 57, 52, 2,
621 61, 62, 55, 53, 63, 54, 72, 56, 2, 2,
622 2, 2, 2, 2, 2, 2, 2, 2, 67, 66,
623 48, 47, 49, 2, 2, 2, 2, 2, 2, 2,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
626 2, 68, 2, 69, 51, 2, 2, 2, 2, 2,
627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
629 2, 2, 2, 64, 50, 65, 71, 2, 2, 2,
630 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
635 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
642 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
643 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
644 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
645 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
646 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
647 45, 46, 58, 59, 60
648};
649
650#if YYDEBUG
651 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
652static const yytype_int16 yyrline[] =
653{
654 0, 152, 152, 157, 163, 170, 170, 173, 184, 184,
655 185, 192, 202, 202, 203, 204, 219, 219, 219, 219,
656 220, 224, 224, 224, 225, 225, 225, 225, 225, 226,
657 231, 236, 239, 246, 254, 261, 270, 270, 270, 270,
658 271, 282, 290, 299, 310, 310, 310, 310, 313, 322,
659 322, 325, 385, 394, 394, 395, 395, 401, 408, 418,
660 422, 423, 424, 425, 426, 427, 428, 429, 432, 436,
661 438, 438, 440, 448, 451, 452, 453, 454, 458, 459,
662 460, 461, 462, 463, 464, 465, 466, 467, 468, 469,
663 470, 471, 472, 473, 474, 475, 476, 477, 478, 479,
664 480, 481, 482, 483, 484, 485, 486, 487, 487, 487,
665 487, 487, 490, 492, 493, 497, 500, 506, 507, 511,
666 516, 518, 524, 524, 526, 528, 538, 546
667};
668#endif
669
671#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
672
673#if YYDEBUG || 0
674/* The user-facing name of the symbol whose (internal) number is
675 YYSYMBOL. No bounds checking. */
676static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
677
678/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
679 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
680static const char *const yytname[] =
681{
682 "\"end of file\"", "error", "\"invalid token\"", "IF", "ELSE", "EQ",
683 "NEQ", "SUPEQ", "INFEQ", "OR", "AND", "MATCH", "NOMATCH", "REP", "FOR",
684 "REPEAT", "UNTIL", "FOREACH", "WHILE", "BREAK", "CONTINUE", "FUNCTION",
685 "RETURN", "INCLUDE", "LOCAL", "GLOBAL", "PLUS_PLUS", "MINUS_MINUS",
686 "L_SHIFT", "R_SHIFT", "R_USHIFT", "EXPO", "PLUS_EQ", "MINUS_EQ",
687 "MULT_EQ", "DIV_EQ", "MODULO_EQ", "L_SHIFT_EQ", "R_SHIFT_EQ",
688 "R_USHIFT_EQ", "RE_MATCH", "RE_NOMATCH", "ARROW", "IDENT", "STRING1",
689 "STRING2", "INTEGER", "'='", "'<'", "'>'", "'|'", "'^'", "'&'", "'+'",
690 "'-'", "'*'", "'/'", "'%'", "NOT", "UMINUS", "BIT_NOT", "'('", "')'",
691 "','", "'{'", "'}'", "';'", "':'", "'['", "']'", "'!'", "'~'", "'.'",
692 "$accept", "tiptop", "instr_decl_list", "instr_decl", "func_decl",
693 "arg_decl", "arg_decl_1", "block", "instr_list", "instr", "simple_instr",
694 "ret", "if_block", "loop", "for_loop", "while_loop", "repeat_loop",
695 "foreach_loop", "aff_func", "rep", "string", "inc", "func_call",
696 "arg_list", "arg_list_1", "arg", "aff", "lvalue", "identifier",
697 "array_elem", "array_index", "post_pre_incr", "expr", "const_array",
698 "list_array_data", "array_data", "atom", "simple_array_data", "var",
699 "var_name", "ipaddr", "loc", "glob", YY_NULLPTR
700};
701
702static const char *
704{
705 return yytname[yysymbol];
706}
707#endif
708
709#ifdef YYPRINT
710/* YYTOKNUM[NUM] -- (External) token number corresponding to the
711 (internal) symbol number NUM (which must be that of a token). */
712static const yytype_int16 yytoknum[] =
713{
714 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
715 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
716 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
717 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
718 295, 296, 297, 298, 299, 300, 301, 61, 60, 62,
719 124, 94, 38, 43, 45, 42, 47, 37, 302, 303,
720 304, 40, 41, 44, 123, 125, 59, 58, 91, 93,
721 33, 126, 46
722};
723#endif
724
725#define YYPACT_NINF (-77)
726
727#define yypact_value_is_default(Yyn) \
728 ((Yyn) == YYPACT_NINF)
729
730#define YYTABLE_NINF (-70)
731
732#define yytable_value_is_error(Yyn) \
733 ((Yyn) == YYTABLE_NINF)
734
735 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
736 STATE-NUM. */
737static const yytype_int16 yypact[] =
738{
739 340, -57, -35, -77, -27, 427, -5, -15, -77, -77,
740 -5, 538, -13, -5, -5, -5, -5, -77, 373, 50,
741 -77, 111, -77, -77, -77, -12, -77, -77, -77, -77,
742 -77, -77, -77, -77, -77, 38, -77, 507, -39, -77,
743 -77, -77, -77, -77, 538, -2, 48, -8, 538, 16,
744 -77, -77, -16, 538, 538, 40, 538, 538, -77, -77,
745 124, 592, -77, 837, -77, -77, -77, -77, -77, -1,
746 -77, -77, 15, -77, -77, -3, -77, -77, 25, 400,
747 -77, -77, -77, 538, -77, -77, 538, 538, 538, 538,
748 538, 538, 538, 538, 538, 538, 538, 605, 26, -77,
749 -77, -77, 538, 538, 663, -5, 34, 65, 721, 56,
750 57, -77, 58, 32, 39, -77, -77, 65, 65, 538,
751 538, 538, 538, 538, 538, 538, 538, 538, 538, 538,
752 538, -1, -1, 538, 538, 538, 538, 538, 538, 538,
753 538, 538, 538, -77, -77, 44, -5, -77, -77, 837,
754 837, 837, 837, 837, 837, 837, 837, 837, 837, 45,
755 -77, 46, 36, 837, 49, 837, 427, 538, 466, 779,
756 427, 51, 47, -77, 43, -77, 40, 921, 921, 921,
757 921, 890, 952, 921, 921, 160, 160, 160, 65, -77,
758 -77, 921, 921, 404, 316, 240, 4, 4, 65, 65,
759 65, -77, -77, -77, 538, 538, -77, 104, 519, -77,
760 427, -77, 53, 69, -77, -77, -77, 837, 427, -2,
761 -77, -77, 55, -77, 59, 77, 427, -77, -77
762};
763
764 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
765 Performed when YYTABLE does not specify something else to do. Zero
766 means the default is an error. */
767static const yytype_int8 yydefact[] =
768{
769 0, 0, 0, 71, 0, 0, 0, 0, 29, 30,
770 0, 33, 0, 8, 8, 0, 0, 70, 0, 0,
771 2, 0, 6, 17, 5, 0, 25, 18, 19, 36,
772 37, 38, 39, 23, 26, 24, 21, 0, 68, 69,
773 22, 27, 28, 20, 0, 47, 0, 0, 0, 0,
774 119, 118, 117, 0, 0, 0, 0, 0, 123, 108,
775 124, 122, 96, 32, 111, 110, 107, 121, 109, 0,
776 126, 9, 10, 127, 74, 68, 75, 13, 0, 0,
777 1, 4, 16, 0, 76, 77, 0, 0, 0, 0,
778 0, 0, 0, 0, 0, 54, 0, 0, 0, 46,
779 44, 45, 0, 0, 0, 8, 0, 84, 0, 119,
780 118, 117, 0, 0, 113, 120, 115, 80, 85, 0,
781 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
782 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
783 0, 0, 0, 49, 50, 0, 0, 12, 15, 48,
784 60, 61, 62, 63, 64, 67, 65, 66, 59, 0,
785 53, 55, 124, 57, 0, 73, 0, 0, 0, 0,
786 0, 0, 0, 78, 0, 112, 0, 103, 104, 105,
787 106, 81, 79, 97, 98, 95, 93, 94, 87, 99,
788 100, 101, 102, 92, 91, 90, 82, 83, 86, 88,
789 89, 51, 11, 52, 0, 0, 72, 34, 0, 42,
790 0, 41, 0, 0, 116, 114, 56, 58, 0, 47,
791 43, 7, 0, 35, 0, 0, 0, 125, 40
792};
793
794 /* YYPGOTO[NTERM-NUM]. */
795static const yytype_int16 yypgoto[] =
796{
797 -77, -77, 118, -77, -77, -11, -6, -71, 63, 14,
798 -77, -77, -77, -77, -77, -77, -77, -77, -76, -77,
799 -65, -77, 2, -77, -60, -77, 31, 24, 0, 12,
800 -77, 37, 189, -77, -31, -77, -54, -26, -77, -77,
801 -77, -77, -77
802};
803
804 /* YYDEFGOTO[NTERM-NUM]. */
805static const yytype_uint8 yydefgoto[] =
806{
807 0, 19, 20, 21, 22, 70, 71, 23, 78, 24,
808 25, 26, 27, 28, 29, 30, 31, 32, 98, 33,
809 112, 34, 58, 159, 160, 161, 59, 37, 60, 61,
810 164, 62, 163, 64, 113, 114, 65, 116, 66, 67,
811 68, 41, 42
812};
813
814 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
815 positive, shift that token. If negative, reduce the rule whose
816 number is the opposite. If YYTABLE_NINF, syntax error. */
817static const yytype_int16 yytable[] =
818{
819 38, 115, 35, 73, 145, 38, 47, 35, 3, 43,
820 49, 3, 39, 72, 72, 75, 75, 39, 38, 46,
821 35, 38, 95, 35, 15, 16, 44, 39, 39, 96,
822 39, 36, 79, 39, 45, 130, 36, 40, 17, 74,
823 76, 17, 40, 143, 144, 38, 48, 99, 69, 36,
824 80, 83, 36, 103, 82, 40, 106, 39, 40, 140,
825 141, 142, -68, -68, 102, 96, 189, 190, -68, -68,
826 -68, -68, -68, -68, -68, -68, 100, 105, 146, 38,
827 172, 35, 101, -68, 109, 110, 111, 50, 51, 111,
828 147, 39, 167, 79, 171, 162, 130, 95, -49, -50,
829 174, 175, 176, 205, 96, 72, 201, 203, 218, 204,
830 36, -3, 1, 212, 2, 222, 40, 18, 206, 213,
831 115, 226, 115, 227, 3, 4, 5, 225, 6, 7,
832 8, 9, 10, 11, 12, 13, 14, 15, 16, 81,
833 202, 221, 148, 224, 216, 215, 72, 0, 214, 0,
834 -68, -68, 0, 0, 17, 0, -68, -68, -68, -68,
835 -68, -68, -68, -68, 0, 0, 38, 0, 35, 0,
836 38, -68, 35, 0, 0, 18, 0, -31, 39, 0,
837 207, 0, 39, 0, 211, 95, 0, 0, -70, -70,
838 -70, 130, 96, 0, 0, 0, 0, 36, 0, 0,
839 63, 36, 0, 40, 162, 0, 0, 40, 0, 0,
840 38, 0, 35, 138, 139, 140, 141, 142, 38, 38,
841 35, 99, 39, 0, 220, 0, 38, 0, 35, 0,
842 39, 39, 223, 97, 0, 0, 0, 104, 39, 0,
843 228, 36, 107, 108, 0, 117, 118, 40, 0, 36,
844 100, 0, 0, 0, 0, 40, 101, 36, 0, 0,
845 0, 0, 0, 40, 0, 0, 0, 0, 127, 128,
846 129, 130, 149, 0, 0, 150, 151, 152, 153, 154,
847 155, 156, 157, 158, 0, 165, 0, 0, 0, 0,
848 0, 168, 169, 138, 139, 140, 141, 142, 0, 0,
849 0, 0, 0, 0, 0, 0, 0, 0, 177, 178,
850 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
851 0, 0, 191, 192, 193, 194, 195, 196, 197, 198,
852 199, 200, 0, 0, 0, 0, 0, 0, 0, 0,
853 0, 1, 0, 2, 127, 128, 129, 130, 0, 0,
854 0, 0, 0, 3, 4, 5, 208, 6, 7, 8,
855 9, 10, 11, 12, 13, 14, 15, 16, 137, 138,
856 139, 140, 141, 142, 1, 0, 2, 0, 0, 0,
857 0, 0, 0, 17, 0, 0, 3, 4, 5, 0,
858 6, 7, 8, 9, 217, 11, 12, 13, 14, 15,
859 16, 1, 0, 2, 18, 0, -31, 0, 0, 0,
860 0, 0, 0, 3, 4, 5, 17, 6, 7, 8,
861 9, 0, 11, 12, 13, 14, 15, 16, 1, 0,
862 2, 0, 127, 128, 129, 130, 0, 18, 77, -31,
863 3, 4, 5, 17, 6, 7, 8, 9, 0, 11,
864 12, 13, 14, 15, 16, 136, 137, 138, 139, 140,
865 141, 142, 0, 0, 18, -14, -31, 0, 0, 0,
866 17, 119, 120, 121, 122, 123, 124, 125, 126, 0,
867 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
868 0, 18, 0, -31, 127, 128, 129, 130, 0, 0,
869 0, 0, 0, 0, 0, 0, 131, 132, 0, 0,
870 0, 0, 0, 0, 133, 134, 135, 136, 137, 138,
871 139, 140, 141, 142, 119, 120, 121, 122, 123, 124,
872 125, 126, 209, 84, 85, 0, 0, 0, 0, 86,
873 87, 88, 89, 90, 91, 92, 93, 127, 128, 129,
874 130, 3, 0, 0, 94, 0, 0, 0, 0, 131,
875 132, 0, 0, 0, 15, 16, 0, 133, 134, 135,
876 136, 137, 138, 139, 140, 141, 142, 0, 0, 0,
877 0, 17, 50, 51, 52, 219, 0, 0, 0, 0,
878 0, 0, 53, 0, 0, 0, 0, 0, 0, 54,
879 0, 0, 0, 0, 0, 0, 55, 0, 56, 57,
880 119, 120, 121, 122, 123, 124, 125, 126, -69, -69,
881 0, 0, 0, 0, -69, -69, -69, -69, -69, -69,
882 -69, -69, 0, 127, 128, 129, 130, 0, 0, -69,
883 0, 0, 0, 0, 0, 131, 132, 0, 0, 0,
884 0, 0, 0, 133, 134, 135, 136, 137, 138, 139,
885 140, 141, 142, 0, 0, 0, 0, 166, 119, 120,
886 121, 122, 123, 124, 125, 126, 0, 0, 0, 0,
887 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
888 0, 127, 128, 129, 130, 0, 0, 0, 0, 0,
889 0, 0, 0, 131, 132, 0, 0, 0, 0, 0,
890 0, 133, 134, 135, 136, 137, 138, 139, 140, 141,
891 142, 0, 0, 0, 0, 170, 119, 120, 121, 122,
892 123, 124, 125, 126, 0, 0, 0, 0, 0, 0,
893 0, 0, 0, 0, 0, 0, 0, 0, 0, 127,
894 128, 129, 130, 0, 0, 0, 0, 0, 0, 0,
895 0, 131, 132, 0, 0, 0, 0, 0, 0, 133,
896 134, 135, 136, 137, 138, 139, 140, 141, 142, 0,
897 0, 0, 0, 173, 119, 120, 121, 122, 123, 124,
898 125, 126, 0, 0, 0, 0, 0, 0, 0, 0,
899 0, 0, 0, 0, 0, 0, 0, 127, 128, 129,
900 130, 0, 0, 0, 0, 0, 0, 0, 0, 131,
901 132, 0, 0, 0, 0, 0, 0, 133, 134, 135,
902 136, 137, 138, 139, 140, 141, 142, 0, 0, 0,
903 0, 210, 119, 120, 121, 122, 123, 124, 125, 126,
904 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
905 0, 0, 0, 0, 0, 127, 128, 129, 130, 0,
906 0, 0, 0, 0, 0, 0, 0, 131, 132, 0,
907 0, 0, 0, 0, 0, 133, 134, 135, 136, 137,
908 138, 139, 140, 141, 142, 119, 120, 121, 122, 0,
909 124, 125, 126, 0, 0, 0, 0, 0, 0, 0,
910 0, 0, 0, 0, 0, 0, 0, 0, 127, 128,
911 129, 130, 0, 0, 0, 0, -70, -70, -70, -70,
912 131, 132, -70, -70, 0, 0, 0, 0, 133, 134,
913 135, 136, 137, 138, 139, 140, 141, 142, 0, 127,
914 128, 129, 130, 0, 0, 0, 0, 119, 120, 121,
915 122, -70, -70, 125, 126, 0, 0, 0, 0, -70,
916 -70, 135, 136, 137, 138, 139, 140, 141, 142, 0,
917 127, 128, 129, 130, 0, 0, 0, 0, 0, 0,
918 0, 0, 131, 132, 0, 0, 0, 0, 0, 0,
919 133, 134, 135, 136, 137, 138, 139, 140, 141, 142
920};
921
922static const yytype_int16 yycheck[] =
923{
924 0, 55, 0, 14, 69, 5, 6, 5, 13, 66,
925 10, 13, 0, 13, 14, 15, 16, 5, 18, 5,
926 18, 21, 61, 21, 26, 27, 61, 15, 16, 68,
927 18, 0, 18, 21, 61, 31, 5, 0, 43, 15,
928 16, 43, 5, 44, 45, 45, 61, 45, 61, 18,
929 0, 13, 21, 61, 66, 18, 72, 45, 21, 55,
930 56, 57, 26, 27, 16, 68, 131, 132, 32, 33,
931 34, 35, 36, 37, 38, 39, 45, 61, 63, 79,
932 46, 79, 45, 47, 44, 45, 46, 44, 45, 46,
933 65, 79, 66, 79, 105, 95, 31, 61, 42, 42,
934 42, 69, 63, 67, 68, 105, 62, 62, 4, 63,
935 79, 0, 1, 62, 3, 46, 79, 64, 69, 72,
936 174, 62, 176, 46, 13, 14, 15, 72, 17, 18,
937 19, 20, 21, 22, 23, 24, 25, 26, 27, 21,
938 146, 212, 79, 219, 204, 176, 146, -1, 174, -1,
939 26, 27, -1, -1, 43, -1, 32, 33, 34, 35,
940 36, 37, 38, 39, -1, -1, 166, -1, 166, -1,
941 170, 47, 170, -1, -1, 64, -1, 66, 166, -1,
942 166, -1, 170, -1, 170, 61, -1, -1, 28, 29,
943 30, 31, 68, -1, -1, -1, -1, 166, -1, -1,
944 11, 170, -1, 166, 204, -1, -1, 170, -1, -1,
945 210, -1, 210, 53, 54, 55, 56, 57, 218, 219,
946 218, 219, 210, -1, 210, -1, 226, -1, 226, -1,
947 218, 219, 218, 44, -1, -1, -1, 48, 226, -1,
948 226, 210, 53, 54, -1, 56, 57, 210, -1, 218,
949 219, -1, -1, -1, -1, 218, 219, 226, -1, -1,
950 -1, -1, -1, 226, -1, -1, -1, -1, 28, 29,
951 30, 31, 83, -1, -1, 86, 87, 88, 89, 90,
952 91, 92, 93, 94, -1, 96, -1, -1, -1, -1,
953 -1, 102, 103, 53, 54, 55, 56, 57, -1, -1,
954 -1, -1, -1, -1, -1, -1, -1, -1, 119, 120,
955 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
956 -1, -1, 133, 134, 135, 136, 137, 138, 139, 140,
957 141, 142, -1, -1, -1, -1, -1, -1, -1, -1,
958 -1, 1, -1, 3, 28, 29, 30, 31, -1, -1,
959 -1, -1, -1, 13, 14, 15, 167, 17, 18, 19,
960 20, 21, 22, 23, 24, 25, 26, 27, 52, 53,
961 54, 55, 56, 57, 1, -1, 3, -1, -1, -1,
962 -1, -1, -1, 43, -1, -1, 13, 14, 15, -1,
963 17, 18, 19, 20, 205, 22, 23, 24, 25, 26,
964 27, 1, -1, 3, 64, -1, 66, -1, -1, -1,
965 -1, -1, -1, 13, 14, 15, 43, 17, 18, 19,
966 20, -1, 22, 23, 24, 25, 26, 27, 1, -1,
967 3, -1, 28, 29, 30, 31, -1, 64, 65, 66,
968 13, 14, 15, 43, 17, 18, 19, 20, -1, 22,
969 23, 24, 25, 26, 27, 51, 52, 53, 54, 55,
970 56, 57, -1, -1, 64, 65, 66, -1, -1, -1,
971 43, 5, 6, 7, 8, 9, 10, 11, 12, -1,
972 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
973 -1, 64, -1, 66, 28, 29, 30, 31, -1, -1,
974 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
975 -1, -1, -1, -1, 48, 49, 50, 51, 52, 53,
976 54, 55, 56, 57, 5, 6, 7, 8, 9, 10,
977 11, 12, 66, 26, 27, -1, -1, -1, -1, 32,
978 33, 34, 35, 36, 37, 38, 39, 28, 29, 30,
979 31, 13, -1, -1, 47, -1, -1, -1, -1, 40,
980 41, -1, -1, -1, 26, 27, -1, 48, 49, 50,
981 51, 52, 53, 54, 55, 56, 57, -1, -1, -1,
982 -1, 43, 44, 45, 46, 66, -1, -1, -1, -1,
983 -1, -1, 54, -1, -1, -1, -1, -1, -1, 61,
984 -1, -1, -1, -1, -1, -1, 68, -1, 70, 71,
985 5, 6, 7, 8, 9, 10, 11, 12, 26, 27,
986 -1, -1, -1, -1, 32, 33, 34, 35, 36, 37,
987 38, 39, -1, 28, 29, 30, 31, -1, -1, 47,
988 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
989 -1, -1, -1, 48, 49, 50, 51, 52, 53, 54,
990 55, 56, 57, -1, -1, -1, -1, 62, 5, 6,
991 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
992 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
993 -1, 28, 29, 30, 31, -1, -1, -1, -1, -1,
994 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
995 -1, 48, 49, 50, 51, 52, 53, 54, 55, 56,
996 57, -1, -1, -1, -1, 62, 5, 6, 7, 8,
997 9, 10, 11, 12, -1, -1, -1, -1, -1, -1,
998 -1, -1, -1, -1, -1, -1, -1, -1, -1, 28,
999 29, 30, 31, -1, -1, -1, -1, -1, -1, -1,
1000 -1, 40, 41, -1, -1, -1, -1, -1, -1, 48,
1001 49, 50, 51, 52, 53, 54, 55, 56, 57, -1,
1002 -1, -1, -1, 62, 5, 6, 7, 8, 9, 10,
1003 11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
1004 -1, -1, -1, -1, -1, -1, -1, 28, 29, 30,
1005 31, -1, -1, -1, -1, -1, -1, -1, -1, 40,
1006 41, -1, -1, -1, -1, -1, -1, 48, 49, 50,
1007 51, 52, 53, 54, 55, 56, 57, -1, -1, -1,
1008 -1, 62, 5, 6, 7, 8, 9, 10, 11, 12,
1009 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1010 -1, -1, -1, -1, -1, 28, 29, 30, 31, -1,
1011 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
1012 -1, -1, -1, -1, -1, 48, 49, 50, 51, 52,
1013 53, 54, 55, 56, 57, 5, 6, 7, 8, -1,
1014 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1015 -1, -1, -1, -1, -1, -1, -1, -1, 28, 29,
1016 30, 31, -1, -1, -1, -1, 5, 6, 7, 8,
1017 40, 41, 11, 12, -1, -1, -1, -1, 48, 49,
1018 50, 51, 52, 53, 54, 55, 56, 57, -1, 28,
1019 29, 30, 31, -1, -1, -1, -1, 5, 6, 7,
1020 8, 40, 41, 11, 12, -1, -1, -1, -1, 48,
1021 49, 50, 51, 52, 53, 54, 55, 56, 57, -1,
1022 28, 29, 30, 31, -1, -1, -1, -1, -1, -1,
1023 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
1024 48, 49, 50, 51, 52, 53, 54, 55, 56, 57
1025};
1026
1027 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1028 symbol of state STATE-NUM. */
1029static const yytype_int8 yystos[] =
1030{
1031 0, 1, 3, 13, 14, 15, 17, 18, 19, 20,
1032 21, 22, 23, 24, 25, 26, 27, 43, 64, 74,
1033 75, 76, 77, 80, 82, 83, 84, 85, 86, 87,
1034 88, 89, 90, 92, 94, 95, 99, 100, 101, 102,
1035 104, 114, 115, 66, 61, 61, 82, 101, 61, 101,
1036 44, 45, 46, 54, 61, 68, 70, 71, 95, 99,
1037 101, 102, 104, 105, 106, 109, 111, 112, 113, 61,
1038 78, 79, 101, 78, 100, 101, 100, 65, 81, 82,
1039 0, 75, 66, 13, 26, 27, 32, 33, 34, 35,
1040 36, 37, 38, 39, 47, 61, 68, 105, 91, 95,
1041 99, 104, 16, 61, 105, 61, 72, 105, 105, 44,
1042 45, 46, 93, 107, 108, 109, 110, 105, 105, 5,
1043 6, 7, 8, 9, 10, 11, 12, 28, 29, 30,
1044 31, 40, 41, 48, 49, 50, 51, 52, 53, 54,
1045 55, 56, 57, 44, 45, 93, 63, 65, 81, 105,
1046 105, 105, 105, 105, 105, 105, 105, 105, 105, 96,
1047 97, 98, 101, 105, 103, 105, 62, 66, 105, 105,
1048 62, 78, 46, 62, 42, 69, 63, 105, 105, 105,
1049 105, 105, 105, 105, 105, 105, 105, 105, 105, 93,
1050 93, 105, 105, 105, 105, 105, 105, 105, 105, 105,
1051 105, 62, 79, 62, 63, 67, 69, 82, 105, 66,
1052 62, 82, 62, 72, 110, 107, 97, 105, 4, 66,
1053 82, 80, 46, 82, 91, 72, 62, 46, 82
1054};
1055
1056 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1057static const yytype_int8 yyr1[] =
1058{
1059 0, 73, 74, 75, 75, 76, 76, 77, 78, 78,
1060 79, 79, 80, 80, 81, 81, 82, 82, 82, 82,
1061 82, 83, 83, 83, 83, 83, 83, 83, 83, 83,
1062 83, 83, 84, 84, 85, 85, 86, 86, 86, 86,
1063 87, 88, 89, 90, 91, 91, 91, 91, 92, 93,
1064 93, 94, 95, 96, 96, 97, 97, 98, 98, 99,
1065 99, 99, 99, 99, 99, 99, 99, 99, 100, 100,
1066 101, 101, 102, 103, 104, 104, 104, 104, 105, 105,
1067 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
1068 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
1069 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
1070 105, 105, 106, 107, 107, 108, 108, 109, 109, 109,
1071 110, 111, 111, 111, 112, 113, 114, 115
1072};
1073
1074 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1075static const yytype_int8 yyr2[] =
1076{
1077 0, 2, 1, 1, 2, 1, 1, 6, 0, 1,
1078 1, 3, 3, 2, 1, 2, 2, 1, 1, 1,
1079 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1080 1, 0, 2, 1, 5, 7, 1, 1, 1, 1,
1081 9, 5, 5, 6, 1, 1, 1, 0, 3, 1,
1082 1, 4, 4, 1, 0, 1, 3, 1, 3, 3,
1083 3, 3, 3, 3, 3, 3, 3, 3, 1, 1,
1084 1, 1, 4, 1, 2, 2, 2, 2, 3, 3,
1085 2, 3, 3, 3, 2, 2, 3, 3, 3, 3,
1086 3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
1087 3, 3, 3, 3, 3, 3, 3, 1, 1, 1,
1088 1, 1, 3, 1, 3, 1, 3, 1, 1, 1,
1089 1, 1, 1, 1, 1, 7, 2, 2
1090};
1091
1092
1093enum { YYENOMEM = -2 };
1094
1095#define yyerrok (yyerrstatus = 0)
1096#define yyclearin (yychar = YYEMPTY)
1097
1098#define YYACCEPT goto yyacceptlab
1099#define YYABORT goto yyabortlab
1100#define YYERROR goto yyerrorlab
1101
1102
1103#define YYRECOVERING() (!!yyerrstatus)
1104
1105#define YYBACKUP(Token, Value) \
1106 do \
1107 if (yychar == YYEMPTY) \
1108 { \
1109 yychar = (Token); \
1110 yylval = (Value); \
1111 YYPOPSTACK (yylen); \
1112 yystate = *yyssp; \
1113 goto yybackup; \
1114 } \
1115 else \
1116 { \
1117 yyerror (parm, err_c, YY_("syntax error: cannot back up")); \
1118 YYERROR; \
1119 } \
1120 while (0)
1121
1122/* Backward compatibility with an undocumented macro.
1123 Use YYerror or YYUNDEF. */
1124#define YYERRCODE YYUNDEF
1125
1126
1127/* Enable debugging if requested. */
1128#if YYDEBUG
1129
1130# ifndef YYFPRINTF
1131# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1132# define YYFPRINTF fprintf
1133# endif
1134
1135# define YYDPRINTF(Args) \
1136do { \
1137 if (yydebug) \
1138 YYFPRINTF Args; \
1139} while (0)
1140
1141/* This macro is provided for backward compatibility. */
1142# ifndef YY_LOCATION_PRINT
1143# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1144# endif
1145
1146
1147# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
1148do { \
1149 if (yydebug) \
1150 { \
1151 YYFPRINTF (stderr, "%s ", Title); \
1152 yy_symbol_print (stderr, \
1153 Kind, Value, parm, err_c); \
1154 YYFPRINTF (stderr, "\n"); \
1155 } \
1156} while (0)
1157
1158
1159/*-----------------------------------.
1160| Print this symbol's value on YYO. |
1161`-----------------------------------*/
1162
1163static void
1165 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, naslctxt * parm, int * err_c)
1166{
1167 FILE *yyoutput = yyo;
1168 YY_USE (yyoutput);
1169 YY_USE (parm);
1170 YY_USE (err_c);
1171 if (!yyvaluep)
1172 return;
1173# ifdef YYPRINT
1174 if (yykind < YYNTOKENS)
1175 YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
1176# endif
1178 YY_USE (yykind);
1180}
1181
1182
1183/*---------------------------.
1184| Print this symbol on YYO. |
1185`---------------------------*/
1186
1187static void
1189 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, naslctxt * parm, int * err_c)
1190{
1191 YYFPRINTF (yyo, "%s %s (",
1192 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1193
1194 yy_symbol_value_print (yyo, yykind, yyvaluep, parm, err_c);
1195 YYFPRINTF (yyo, ")");
1196}
1197
1198/*------------------------------------------------------------------.
1199| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1200| TOP (included). |
1201`------------------------------------------------------------------*/
1202
1203static void
1205{
1206 YYFPRINTF (stderr, "Stack now");
1207 for (; yybottom <= yytop; yybottom++)
1208 {
1209 int yybot = *yybottom;
1210 YYFPRINTF (stderr, " %d", yybot);
1211 }
1212 YYFPRINTF (stderr, "\n");
1213}
1214
1215# define YY_STACK_PRINT(Bottom, Top) \
1216do { \
1217 if (yydebug) \
1218 yy_stack_print ((Bottom), (Top)); \
1219} while (0)
1220
1221
1222/*------------------------------------------------.
1223| Report that the YYRULE is going to be reduced. |
1224`------------------------------------------------*/
1225
1226static void
1228 int yyrule, naslctxt * parm, int * err_c)
1229{
1230 int yylno = yyrline[yyrule];
1231 int yynrhs = yyr2[yyrule];
1232 int yyi;
1233 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1234 yyrule - 1, yylno);
1235 /* The symbols being reduced. */
1236 for (yyi = 0; yyi < yynrhs; yyi++)
1237 {
1238 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1239 yy_symbol_print (stderr,
1240 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1241 &yyvsp[(yyi + 1) - (yynrhs)], parm, err_c);
1242 YYFPRINTF (stderr, "\n");
1243 }
1244}
1245
1246# define YY_REDUCE_PRINT(Rule) \
1247do { \
1248 if (yydebug) \
1249 yy_reduce_print (yyssp, yyvsp, Rule, parm, err_c); \
1250} while (0)
1251
1252/* Nonzero means print parse trace. It is left uninitialized so that
1253 multiple parsers can coexist. */
1255#else /* !YYDEBUG */
1256# define YYDPRINTF(Args) ((void) 0)
1257# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1258# define YY_STACK_PRINT(Bottom, Top)
1259# define YY_REDUCE_PRINT(Rule)
1260#endif /* !YYDEBUG */
1261
1262
1263/* YYINITDEPTH -- initial size of the parser's stacks. */
1264#ifndef YYINITDEPTH
1265# define YYINITDEPTH 200
1266#endif
1267
1268/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1269 if the built-in stack extension method is used).
1270
1271 Do not make this value too large; the results are undefined if
1272 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1273 evaluated with infinite-precision integer arithmetic. */
1274
1275#ifndef YYMAXDEPTH
1276# define YYMAXDEPTH 10000
1277#endif
1278
1279
1280
1281
1282
1283
1284/*-----------------------------------------------.
1285| Release the memory associated to this symbol. |
1286`-----------------------------------------------*/
1287
1288static void
1289yydestruct (const char *yymsg,
1290 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, naslctxt * parm, int * err_c)
1291{
1292 YY_USE (yyvaluep);
1293 YY_USE (parm);
1294 YY_USE (err_c);
1295 if (!yymsg)
1296 yymsg = "Deleting";
1297 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1298
1300 YY_USE (yykind);
1302}
1303
1304
1305
1306
1307
1308
1309/*----------.
1310| yyparse. |
1311`----------*/
1312
1313int
1314yyparse (naslctxt * parm, int * err_c)
1315{
1316/* Lookahead token kind. */
1317int yychar;
1318
1319
1320/* The semantic value of the lookahead symbol. */
1321/* Default value used for initialization, for pacifying older GCCs
1322 or non-GCC compilers. */
1323YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1324YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1325
1326 /* Number of syntax errors so far. */
1327 int yynerrs = 0;
1328
1329 yy_state_fast_t yystate = 0;
1330 /* Number of tokens to shift before error messages enabled. */
1331 int yyerrstatus = 0;
1332
1333 /* Refer to the stacks through separate pointers, to allow yyoverflow
1334 to reallocate them elsewhere. */
1335
1336 /* Their size. */
1337 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1338
1339 /* The state stack: array, bottom, top. */
1340 yy_state_t yyssa[YYINITDEPTH];
1341 yy_state_t *yyss = yyssa;
1342 yy_state_t *yyssp = yyss;
1343
1344 /* The semantic value stack: array, bottom, top. */
1345 YYSTYPE yyvsa[YYINITDEPTH];
1346 YYSTYPE *yyvs = yyvsa;
1347 YYSTYPE *yyvsp = yyvs;
1348
1349 int yyn;
1350 /* The return value of yyparse. */
1351 int yyresult;
1352 /* Lookahead symbol kind. */
1354 /* The variables used to return semantic value and location from the
1355 action routines. */
1356 YYSTYPE yyval;
1357
1358
1359
1360#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1361
1362 /* The number of symbols on the RHS of the reduced rule.
1363 Keep to zero when no symbol should be popped. */
1364 int yylen = 0;
1365
1366 YYDPRINTF ((stderr, "Starting parse\n"));
1367
1368 yychar = YYEMPTY; /* Cause a token to be read. */
1369 goto yysetstate;
1370
1371
1372/*------------------------------------------------------------.
1373| yynewstate -- push a new state, which is found in yystate. |
1374`------------------------------------------------------------*/
1375yynewstate:
1376 /* In all cases, when you get here, the value and location stacks
1377 have just been pushed. So pushing a state here evens the stacks. */
1378 yyssp++;
1379
1380
1381/*--------------------------------------------------------------------.
1382| yysetstate -- set current state (the top of the stack) to yystate. |
1383`--------------------------------------------------------------------*/
1384yysetstate:
1385 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1386 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1388 *yyssp = YY_CAST (yy_state_t, yystate);
1390 YY_STACK_PRINT (yyss, yyssp);
1391
1392 if (yyss + yystacksize - 1 <= yyssp)
1393#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1394 goto yyexhaustedlab;
1395#else
1396 {
1397 /* Get the current used size of the three stacks, in elements. */
1398 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1399
1400# if defined yyoverflow
1401 {
1402 /* Give user a chance to reallocate the stack. Use copies of
1403 these so that the &'s don't force the real ones into
1404 memory. */
1405 yy_state_t *yyss1 = yyss;
1406 YYSTYPE *yyvs1 = yyvs;
1407
1408 /* Each stack pointer address is followed by the size of the
1409 data in use in that stack, in bytes. This used to be a
1410 conditional around just the two extra args, but that might
1411 be undefined if yyoverflow is a macro. */
1412 yyoverflow (YY_("memory exhausted"),
1413 &yyss1, yysize * YYSIZEOF (*yyssp),
1414 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1415 &yystacksize);
1416 yyss = yyss1;
1417 yyvs = yyvs1;
1418 }
1419# else /* defined YYSTACK_RELOCATE */
1420 /* Extend the stack our own way. */
1421 if (YYMAXDEPTH <= yystacksize)
1422 goto yyexhaustedlab;
1423 yystacksize *= 2;
1424 if (YYMAXDEPTH < yystacksize)
1425 yystacksize = YYMAXDEPTH;
1426
1427 {
1428 yy_state_t *yyss1 = yyss;
1429 union yyalloc *yyptr =
1430 YY_CAST (union yyalloc *,
1431 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1432 if (! yyptr)
1433 goto yyexhaustedlab;
1436# undef YYSTACK_RELOCATE
1437 if (yyss1 != yyssa)
1438 YYSTACK_FREE (yyss1);
1439 }
1440# endif
1441
1442 yyssp = yyss + yysize - 1;
1443 yyvsp = yyvs + yysize - 1;
1444
1446 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1447 YY_CAST (long, yystacksize)));
1449
1450 if (yyss + yystacksize - 1 <= yyssp)
1451 YYABORT;
1452 }
1453#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1454
1455 if (yystate == YYFINAL)
1456 YYACCEPT;
1457
1458 goto yybackup;
1459
1460
1461/*-----------.
1462| yybackup. |
1463`-----------*/
1464yybackup:
1465 /* Do appropriate processing given the current state. Read a
1466 lookahead token if we need one and don't already have one. */
1467
1468 /* First try to decide what to do without reference to lookahead token. */
1469 yyn = yypact[yystate];
1470 if (yypact_value_is_default (yyn))
1471 goto yydefault;
1472
1473 /* Not known => get a lookahead token if don't already have one. */
1474
1475 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1476 if (yychar == YYEMPTY)
1477 {
1478 YYDPRINTF ((stderr, "Reading a token\n"));
1479 yychar = yylex (&yylval, parm, err_c);
1480 }
1481
1482 if (yychar <= YYEOF)
1483 {
1484 yychar = YYEOF;
1485 yytoken = YYSYMBOL_YYEOF;
1486 YYDPRINTF ((stderr, "Now at end of input.\n"));
1487 }
1488 else if (yychar == YYerror)
1489 {
1490 /* The scanner already issued an error message, process directly
1491 to error recovery. But do not keep the error token as
1492 lookahead, it is too special and may lead us to an endless
1493 loop in error recovery. */
1494 yychar = YYUNDEF;
1495 yytoken = YYSYMBOL_YYerror;
1496 goto yyerrlab1;
1497 }
1498 else
1499 {
1500 yytoken = YYTRANSLATE (yychar);
1501 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1502 }
1503
1504 /* If the proper action on seeing token YYTOKEN is to reduce or to
1505 detect an error, take that action. */
1506 yyn += yytoken;
1507 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1508 goto yydefault;
1509 yyn = yytable[yyn];
1510 if (yyn <= 0)
1511 {
1512 if (yytable_value_is_error (yyn))
1513 goto yyerrlab;
1514 yyn = -yyn;
1515 goto yyreduce;
1516 }
1517
1518 /* Count tokens shifted since error; after three, turn off error
1519 status. */
1520 if (yyerrstatus)
1521 yyerrstatus--;
1522
1523 /* Shift the lookahead token. */
1524 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1525 yystate = yyn;
1527 *++yyvsp = yylval;
1529
1530 /* Discard the shifted token. */
1531 yychar = YYEMPTY;
1532 goto yynewstate;
1533
1534
1535/*-----------------------------------------------------------.
1536| yydefault -- do the default action for the current state. |
1537`-----------------------------------------------------------*/
1538yydefault:
1539 yyn = yydefact[yystate];
1540 if (yyn == 0)
1541 goto yyerrlab;
1542 goto yyreduce;
1543
1544
1545/*-----------------------------.
1546| yyreduce -- do a reduction. |
1547`-----------------------------*/
1548yyreduce:
1549 /* yyn is the number of a rule to reduce with. */
1550 yylen = yyr2[yyn];
1551
1552 /* If YYLEN is nonzero, implement the default value of the action:
1553 '$$ = $1'.
1554
1555 Otherwise, the following line sets YYVAL to garbage.
1556 This behavior is undocumented and Bison
1557 users should not rely upon it. Assigning to YYVAL
1558 unconditionally makes the parser a bit smaller, and it avoids a
1559 GCC warning that YYVAL may be used uninitialized. */
1560 yyval = yyvsp[1-yylen];
1561
1562
1563 YY_REDUCE_PRINT (yyn);
1564 switch (yyn)
1565 {
1566 case 2: /* tiptop: instr_decl_list */
1567#line 153 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1568 {
1569 ((naslctxt*)parm)->tree = (yyvsp[0].node);
1570 }
1571#line 1572 "nasl_grammar.tab.c"
1572 break;
1573
1574 case 3: /* instr_decl_list: instr_decl */
1575#line 158 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1576 {
1578 (yyval.node)->line_nb = LNB;
1579 (yyval.node)->link[0] = (yyvsp[0].node);
1580 }
1581#line 1582 "nasl_grammar.tab.c"
1582 break;
1583
1584 case 4: /* instr_decl_list: instr_decl instr_decl_list */
1585#line 164 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1586 {
1588 (yyval.node)->line_nb = LNB;
1589 (yyval.node)->link[0] = (yyvsp[-1].node);
1590 (yyval.node)->link[1] = (yyvsp[0].node);
1591 }
1592#line 1593 "nasl_grammar.tab.c"
1593 break;
1594
1595 case 7: /* func_decl: FUNCTION identifier '(' arg_decl ')' block */
1596#line 174 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1597 {
1598 nasl_set_function_filename ((yyvsp[-4].str));
1600 (yyval.node)->name = LN;
1601 (yyval.node)->line_nb = LNB;
1602 (yyval.node)->x.str_val = (yyvsp[-4].str);
1603 (yyval.node)->link[0] = (yyvsp[-2].node);
1604 (yyval.node)->link[1] = (yyvsp[0].node);
1605 }
1606#line 1607 "nasl_grammar.tab.c"
1607 break;
1608
1609 case 8: /* arg_decl: %empty */
1610#line 184 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1611 { (yyval.node) = NULL; }
1612#line 1613 "nasl_grammar.tab.c"
1613 break;
1614
1615 case 9: /* arg_decl: arg_decl_1 */
1616#line 184 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1617 { (yyval.node) = (yyvsp[0].node); }
1618#line 1619 "nasl_grammar.tab.c"
1619 break;
1620
1621 case 10: /* arg_decl_1: identifier */
1622#line 186 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1623 {
1624 (yyval.node) = alloc_typed_cell (NODE_DECL);
1625 (yyval.node)->name = LN;
1626 (yyval.node)->line_nb = LNB;
1627 (yyval.node)->x.str_val = (yyvsp[0].str);
1628 }
1629#line 1630 "nasl_grammar.tab.c"
1630 break;
1631
1632 case 11: /* arg_decl_1: identifier ',' arg_decl_1 */
1633#line 193 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1634 {
1635 (yyval.node) = alloc_typed_cell (NODE_DECL);
1636 (yyval.node)->name = LN;
1637 (yyval.node)->line_nb = LNB;
1638 (yyval.node)->x.str_val = (yyvsp[-2].str);
1639 (yyval.node)->link[0] = (yyvsp[0].node);
1640 }
1641#line 1642 "nasl_grammar.tab.c"
1642 break;
1643
1644 case 12: /* block: '{' instr_list '}' */
1645#line 202 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1646 { (yyval.node) = (yyvsp[-1].node); }
1647#line 1648 "nasl_grammar.tab.c"
1648 break;
1649
1650 case 13: /* block: '{' '}' */
1651#line 202 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1652 { (yyval.node) = NULL; }
1653#line 1654 "nasl_grammar.tab.c"
1654 break;
1655
1656 case 15: /* instr_list: instr instr_list */
1657#line 205 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1658 {
1659 if ((yyvsp[-1].node) == NULL)
1660 (yyval.node) = (yyvsp[0].node);
1661 else
1662 {
1664 (yyval.node)->name = LN;
1665 (yyval.node)->line_nb = LNB;
1666 (yyval.node)->link[0] = (yyvsp[-1].node);
1667 (yyval.node)->link[1] = (yyvsp[0].node);
1668 }
1669 }
1670#line 1671 "nasl_grammar.tab.c"
1671 break;
1672
1673 case 16: /* instr: simple_instr ';' */
1674#line 219 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1675 { (yyval.node) = (yyvsp[-1].node); }
1676#line 1677 "nasl_grammar.tab.c"
1677 break;
1678
1679 case 20: /* instr: error ';' */
1680#line 220 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1681 {yyerrok;}
1682#line 1683 "nasl_grammar.tab.c"
1683 break;
1684
1685 case 29: /* simple_instr: BREAK */
1686#line 226 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1687 {
1688 (yyval.node) = alloc_typed_cell (NODE_BREAK);
1689 (yyval.node)->name = LN;
1690 (yyval.node)->line_nb = LNB;
1691 }
1692#line 1693 "nasl_grammar.tab.c"
1693 break;
1694
1695 case 30: /* simple_instr: CONTINUE */
1696#line 231 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1697 {
1699 (yyval.node)->name = LN;
1700 (yyval.node)->line_nb = LNB;
1701 }
1702#line 1703 "nasl_grammar.tab.c"
1703 break;
1704
1705 case 31: /* simple_instr: %empty */
1706#line 236 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1707 { (yyval.node) = NULL; }
1708#line 1709 "nasl_grammar.tab.c"
1709 break;
1710
1711 case 32: /* ret: RETURN expr */
1712#line 240 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1713 {
1714 (yyval.node) = alloc_typed_cell (NODE_RETURN);
1715 (yyval.node)->name = LN;
1716 (yyval.node)->line_nb = LNB;
1717 (yyval.node)->link[0] = (yyvsp[0].node);
1718 }
1719#line 1720 "nasl_grammar.tab.c"
1720 break;
1721
1722 case 33: /* ret: RETURN */
1723#line 247 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1724 {
1725 (yyval.node) = alloc_typed_cell (NODE_RETURN);
1726 (yyval.node)->name = LN;
1727 (yyval.node)->line_nb = LNB;
1728 }
1729#line 1730 "nasl_grammar.tab.c"
1730 break;
1731
1732 case 34: /* if_block: IF '(' expr ')' instr */
1733#line 255 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1734 {
1736 (yyval.node)->name = LN;
1737 (yyval.node)->line_nb = LNB;
1738 (yyval.node)->link[0] = (yyvsp[-2].node); (yyval.node)->link[1] = (yyvsp[0].node);
1739 }
1740#line 1741 "nasl_grammar.tab.c"
1741 break;
1742
1743 case 35: /* if_block: IF '(' expr ')' instr ELSE instr */
1744#line 262 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1745 {
1747 (yyval.node)->name = LN;
1748 (yyval.node)->line_nb = LNB;
1749 (yyval.node)->link[0] = (yyvsp[-4].node); (yyval.node)->link[1] = (yyvsp[-2].node); (yyval.node)->link[2] = (yyvsp[0].node);
1750 }
1751#line 1752 "nasl_grammar.tab.c"
1752 break;
1753
1754 case 40: /* for_loop: FOR '(' aff_func ';' expr ';' aff_func ')' instr */
1755#line 272 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1756 {
1757 (yyval.node) = alloc_typed_cell (NODE_FOR);
1758 (yyval.node)->name = LN;
1759 (yyval.node)->line_nb = LNB;
1760 (yyval.node)->link[0] = (yyvsp[-6].node);
1761 (yyval.node)->link[1] = (yyvsp[-4].node);
1762 (yyval.node)->link[2] = (yyvsp[-2].node);
1763 (yyval.node)->link[3] = (yyvsp[0].node);
1764 }
1765#line 1766 "nasl_grammar.tab.c"
1766 break;
1767
1768 case 41: /* while_loop: WHILE '(' expr ')' instr */
1769#line 283 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1770 {
1771 (yyval.node) = alloc_typed_cell (NODE_WHILE);
1772 (yyval.node)->name = LN;
1773 (yyval.node)->line_nb = LNB;
1774 (yyval.node)->link[0] = (yyvsp[-2].node);
1775 (yyval.node)->link[1] = (yyvsp[0].node);
1776 }
1777#line 1778 "nasl_grammar.tab.c"
1778 break;
1779
1780 case 42: /* repeat_loop: REPEAT instr UNTIL expr ';' */
1781#line 291 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1782 {
1784 (yyval.node)->name = LN;
1785 (yyval.node)->line_nb = LNB;
1786 (yyval.node)->link[0] = (yyvsp[-3].node);
1787 (yyval.node)->link[1] = (yyvsp[-1].node);
1788 }
1789#line 1790 "nasl_grammar.tab.c"
1790 break;
1791
1792 case 43: /* foreach_loop: FOREACH identifier '(' expr ')' instr */
1793#line 300 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1794 {
1796 (yyval.node)->name = LN;
1797 (yyval.node)->line_nb = LNB;
1798 (yyval.node)->x.str_val = (yyvsp[-4].str);
1799 (yyval.node)->link[0] = (yyvsp[-2].node);
1800 (yyval.node)->link[1] = (yyvsp[0].node);
1801 }
1802#line 1803 "nasl_grammar.tab.c"
1803 break;
1804
1805 case 47: /* aff_func: %empty */
1806#line 310 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1807 { (yyval.node) = NULL; }
1808#line 1809 "nasl_grammar.tab.c"
1809 break;
1810
1811 case 48: /* rep: func_call REP expr */
1812#line 314 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1813 {
1815 (yyval.node)->name = LN;
1816 (yyval.node)->line_nb = LNB;
1817 (yyval.node)->link[0] = (yyvsp[-2].node);
1818 (yyval.node)->link[1] = (yyvsp[0].node);
1819 }
1820#line 1821 "nasl_grammar.tab.c"
1821 break;
1822
1823 case 49: /* string: STRING1 */
1824#line 322 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1825 { (yyval.str) = (yyvsp[0].data).val; }
1826#line 1827 "nasl_grammar.tab.c"
1827 break;
1828
1829 case 51: /* inc: INCLUDE '(' string ')' */
1830#line 326 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1831 {
1832 char *tmp;
1833 naslctxt subctx;
1834 #pragma GCC diagnostic push
1835 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
1836 int * error_counter;
1837 #pragma GCC diagnostic pop
1838 error_counter = (int*)err_c;
1839
1840 bzero (&subctx, sizeof (subctx));
1841 subctx.always_signed = ((naslctxt*)parm)->always_signed;
1842 subctx.exec_descr = ((naslctxt*)parm)->exec_descr;
1843 subctx.kb = ((naslctxt *) parm)->kb;
1844 subctx.tree = ((naslctxt*) parm)->tree;
1845 (yyval.node) = NULL;
1846 tmp = g_strdup (nasl_get_filename (NULL));
1847 nasl_set_filename ((yyvsp[-1].str));
1848 if (!includes_hash)
1849 includes_hash = g_hash_table_new_full
1850 (g_str_hash, g_str_equal, g_free,
1851 (GDestroyNotify) deref_cell);
1852
1853 if ((subctx.tree = g_hash_table_lookup (includes_hash, (yyvsp[-1].str))))
1854 {
1855 (yyval.node) = subctx.tree;
1856 ref_cell ((yyval.node));
1857 g_free ((yyvsp[-1].str));
1858 }
1859 else if (init_nasl_ctx (&subctx, (yyvsp[-1].str)) >= 0)
1860 {
1861 if (!naslparse (&subctx, err_c))
1862 {
1863 // set the name of tree to the filename for further
1864 // identification of origin (e.g. whos is calling a func).
1865 subctx.tree->name = (yyvsp[-1].str);
1867 (yyval.node) = subctx.tree;
1868 g_hash_table_insert (includes_hash, (yyvsp[-1].str), (yyval.node));
1869 ref_cell ((yyval.node));
1870 }
1871 else
1872 {
1873 nasl_perror (NULL, "%s: Parse error at or near line %d\n", (yyvsp[-1].str),
1874 subctx.line_nb);
1875 g_free ((yyvsp[-1].str));
1876 }
1877 g_free (subctx.buffer);
1878 }
1879 else
1880 {
1881 g_free((yyvsp[-1].str));
1882 g_free (tmp);
1883 return -2;
1884 }
1885 nasl_set_filename (tmp);
1886 g_free (tmp);
1887 }
1888#line 1889 "nasl_grammar.tab.c"
1889 break;
1890
1891 case 52: /* func_call: identifier '(' arg_list ')' */
1892#line 386 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1893 {
1895 (yyval.node)->name = LN;
1896 (yyval.node)->line_nb = LNB;
1897 (yyval.node)->x.str_val = (yyvsp[-3].str);
1898 (yyval.node)->link[0] = (yyvsp[-1].node);
1899 }
1900#line 1901 "nasl_grammar.tab.c"
1901 break;
1902
1903 case 54: /* arg_list: %empty */
1904#line 394 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1905 { (yyval.node) = NULL; }
1906#line 1907 "nasl_grammar.tab.c"
1907 break;
1908
1909 case 56: /* arg_list_1: arg ',' arg_list_1 */
1910#line 396 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1911 {
1912 (yyvsp[-2].node)->link[1] = (yyvsp[0].node);
1913 (yyval.node) = (yyvsp[-2].node);
1914 }
1915#line 1916 "nasl_grammar.tab.c"
1916 break;
1917
1918 case 57: /* arg: expr */
1919#line 402 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1920 {
1921 (yyval.node) = alloc_typed_cell (NODE_ARG);
1922 (yyval.node)->name = LN;
1923 (yyval.node)->line_nb = LNB;
1924 (yyval.node)->link[0] = (yyvsp[0].node);
1925 }
1926#line 1927 "nasl_grammar.tab.c"
1927 break;
1928
1929 case 58: /* arg: identifier ':' expr */
1930#line 409 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1931 {
1932 (yyval.node) = alloc_typed_cell (NODE_ARG);
1933 (yyval.node)->name = LN;
1934 (yyval.node)->line_nb = LNB;
1935 (yyval.node)->x.str_val = (yyvsp[-2].str);
1936 (yyval.node)->link[0] = (yyvsp[0].node);
1937 }
1938#line 1939 "nasl_grammar.tab.c"
1939 break;
1940
1941 case 59: /* aff: lvalue '=' expr */
1942#line 419 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1943 {
1944 (yyval.node) = alloc_expr_cell(LNB, NODE_AFF, (yyvsp[-2].node), (yyvsp[0].node));
1945 }
1946#line 1947 "nasl_grammar.tab.c"
1947 break;
1948
1949 case 60: /* aff: lvalue PLUS_EQ expr */
1950#line 422 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1951 { (yyval.node) = alloc_expr_cell(LNB, NODE_PLUS_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1952#line 1953 "nasl_grammar.tab.c"
1953 break;
1954
1955 case 61: /* aff: lvalue MINUS_EQ expr */
1956#line 423 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1957 { (yyval.node) = alloc_expr_cell(LNB, NODE_MINUS_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1958#line 1959 "nasl_grammar.tab.c"
1959 break;
1960
1961 case 62: /* aff: lvalue MULT_EQ expr */
1962#line 424 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1963 { (yyval.node) = alloc_expr_cell(LNB, NODE_MULT_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1964#line 1965 "nasl_grammar.tab.c"
1965 break;
1966
1967 case 63: /* aff: lvalue DIV_EQ expr */
1968#line 425 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1969 { (yyval.node) = alloc_expr_cell(LNB, NODE_DIV_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1970#line 1971 "nasl_grammar.tab.c"
1971 break;
1972
1973 case 64: /* aff: lvalue MODULO_EQ expr */
1974#line 426 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1975 { (yyval.node) = alloc_expr_cell(LNB, NODE_MODULO_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1976#line 1977 "nasl_grammar.tab.c"
1977 break;
1978
1979 case 65: /* aff: lvalue R_SHIFT_EQ expr */
1980#line 427 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1981 { (yyval.node) = alloc_expr_cell(LNB, NODE_R_SHIFT_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1982#line 1983 "nasl_grammar.tab.c"
1983 break;
1984
1985 case 66: /* aff: lvalue R_USHIFT_EQ expr */
1986#line 428 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1987 { (yyval.node) = alloc_expr_cell(LNB, NODE_R_USHIFT_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1988#line 1989 "nasl_grammar.tab.c"
1989 break;
1990
1991 case 67: /* aff: lvalue L_SHIFT_EQ expr */
1992#line 429 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1993 { (yyval.node) = alloc_expr_cell(LNB, NODE_L_SHIFT_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1994#line 1995 "nasl_grammar.tab.c"
1995 break;
1996
1997 case 68: /* lvalue: identifier */
1998#line 433 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1999 { (yyval.node) = alloc_typed_cell (NODE_VAR);
2000 (yyval.node)->line_nb = LNB;
2001 (yyval.node)->x.str_val = (yyvsp[0].str);
2002 }
2003#line 2004 "nasl_grammar.tab.c"
2004 break;
2005
2006 case 71: /* identifier: REP */
2007#line 438 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2008 { (yyval.str) = strdup("x"); }
2009#line 2010 "nasl_grammar.tab.c"
2010 break;
2011
2012 case 72: /* array_elem: identifier '[' array_index ']' */
2013#line 441 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2014 {
2016 (yyval.node)->line_nb = LNB;
2017 (yyval.node)->x.str_val = (yyvsp[-3].str);
2018 (yyval.node)->link[0] = (yyvsp[-1].node);
2019 }
2020#line 2021 "nasl_grammar.tab.c"
2021 break;
2022
2023 case 74: /* post_pre_incr: PLUS_PLUS lvalue */
2024#line 451 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2025 { (yyval.node) = alloc_expr_cell(LNB, EXPR_INCR, NULL, (yyvsp[0].node)); }
2026#line 2027 "nasl_grammar.tab.c"
2027 break;
2028
2029 case 75: /* post_pre_incr: MINUS_MINUS lvalue */
2030#line 452 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2031 {(yyval.node) = alloc_expr_cell(LNB, EXPR_DECR, NULL, (yyvsp[0].node)); }
2032#line 2033 "nasl_grammar.tab.c"
2033 break;
2034
2035 case 76: /* post_pre_incr: lvalue PLUS_PLUS */
2036#line 453 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2037 { (yyval.node)= alloc_expr_cell(LNB, EXPR_INCR, (yyvsp[-1].node), NULL); }
2038#line 2039 "nasl_grammar.tab.c"
2039 break;
2040
2041 case 77: /* post_pre_incr: lvalue MINUS_MINUS */
2042#line 454 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2043 { (yyval.node)= alloc_expr_cell(LNB, EXPR_DECR, (yyvsp[-1].node), NULL); }
2044#line 2045 "nasl_grammar.tab.c"
2045 break;
2046
2047 case 78: /* expr: '(' expr ')' */
2048#line 458 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2049 { (yyval.node) = (yyvsp[-1].node); }
2050#line 2051 "nasl_grammar.tab.c"
2051 break;
2052
2053 case 79: /* expr: expr AND expr */
2054#line 459 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2055 { (yyval.node) = alloc_expr_cell(LNB, EXPR_AND, (yyvsp[-2].node), (yyvsp[0].node)); }
2056#line 2057 "nasl_grammar.tab.c"
2057 break;
2058
2059 case 80: /* expr: '!' expr */
2060#line 460 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2061 { (yyval.node) = alloc_expr_cell(LNB, EXPR_NOT, (yyvsp[0].node), NULL); }
2062#line 2063 "nasl_grammar.tab.c"
2063 break;
2064
2065 case 81: /* expr: expr OR expr */
2066#line 461 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2067 { (yyval.node) = alloc_expr_cell(LNB, EXPR_OR, (yyvsp[-2].node), (yyvsp[0].node)); }
2068#line 2069 "nasl_grammar.tab.c"
2069 break;
2070
2071 case 82: /* expr: expr '+' expr */
2072#line 462 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2073 { (yyval.node) = alloc_expr_cell(LNB, EXPR_PLUS, (yyvsp[-2].node), (yyvsp[0].node)); }
2074#line 2075 "nasl_grammar.tab.c"
2075 break;
2076
2077 case 83: /* expr: expr '-' expr */
2078#line 463 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2079 { (yyval.node) = alloc_expr_cell(LNB, EXPR_MINUS, (yyvsp[-2].node), (yyvsp[0].node)); }
2080#line 2081 "nasl_grammar.tab.c"
2081 break;
2082
2083 case 84: /* expr: '-' expr */
2084#line 464 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2085 { (yyval.node) = alloc_expr_cell(LNB, EXPR_U_MINUS, (yyvsp[0].node), NULL);}
2086#line 2087 "nasl_grammar.tab.c"
2087 break;
2088
2089 case 85: /* expr: '~' expr */
2090#line 465 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2091 { (yyval.node) = alloc_expr_cell(LNB, EXPR_BIT_NOT, (yyvsp[0].node), NULL);}
2092#line 2093 "nasl_grammar.tab.c"
2093 break;
2094
2095 case 86: /* expr: expr '*' expr */
2096#line 466 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2097 { (yyval.node) = alloc_expr_cell(LNB, EXPR_MULT, (yyvsp[-2].node), (yyvsp[0].node)); }
2098#line 2099 "nasl_grammar.tab.c"
2099 break;
2100
2101 case 87: /* expr: expr EXPO expr */
2102#line 467 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2103 { (yyval.node) = alloc_expr_cell(LNB, EXPR_EXPO, (yyvsp[-2].node), (yyvsp[0].node)); }
2104#line 2105 "nasl_grammar.tab.c"
2105 break;
2106
2107 case 88: /* expr: expr '/' expr */
2108#line 468 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2109 { (yyval.node) = alloc_expr_cell(LNB, EXPR_DIV, (yyvsp[-2].node), (yyvsp[0].node)); }
2110#line 2111 "nasl_grammar.tab.c"
2111 break;
2112
2113 case 89: /* expr: expr '%' expr */
2114#line 469 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2115 { (yyval.node) = alloc_expr_cell(LNB, EXPR_MODULO, (yyvsp[-2].node), (yyvsp[0].node)); }
2116#line 2117 "nasl_grammar.tab.c"
2117 break;
2118
2119 case 90: /* expr: expr '&' expr */
2120#line 470 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2121 { (yyval.node) = alloc_expr_cell(LNB, EXPR_BIT_AND, (yyvsp[-2].node), (yyvsp[0].node)); }
2122#line 2123 "nasl_grammar.tab.c"
2123 break;
2124
2125 case 91: /* expr: expr '^' expr */
2126#line 471 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2127 { (yyval.node) = alloc_expr_cell(LNB, EXPR_BIT_XOR, (yyvsp[-2].node), (yyvsp[0].node)); }
2128#line 2129 "nasl_grammar.tab.c"
2129 break;
2130
2131 case 92: /* expr: expr '|' expr */
2132#line 472 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2133 { (yyval.node) = alloc_expr_cell(LNB, EXPR_BIT_OR, (yyvsp[-2].node), (yyvsp[0].node)); }
2134#line 2135 "nasl_grammar.tab.c"
2135 break;
2136
2137 case 93: /* expr: expr R_SHIFT expr */
2138#line 473 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2139 { (yyval.node) = alloc_expr_cell(LNB, EXPR_R_SHIFT, (yyvsp[-2].node), (yyvsp[0].node)); }
2140#line 2141 "nasl_grammar.tab.c"
2141 break;
2142
2143 case 94: /* expr: expr R_USHIFT expr */
2144#line 474 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2145 { (yyval.node) = alloc_expr_cell(LNB, EXPR_R_USHIFT, (yyvsp[-2].node), (yyvsp[0].node)); }
2146#line 2147 "nasl_grammar.tab.c"
2147 break;
2148
2149 case 95: /* expr: expr L_SHIFT expr */
2150#line 475 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2151 { (yyval.node) = alloc_expr_cell(LNB, EXPR_L_SHIFT, (yyvsp[-2].node), (yyvsp[0].node)); }
2152#line 2153 "nasl_grammar.tab.c"
2153 break;
2154
2155 case 97: /* expr: expr MATCH expr */
2156#line 477 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2157 { (yyval.node) = alloc_expr_cell(LNB, COMP_MATCH, (yyvsp[-2].node), (yyvsp[0].node)); }
2158#line 2159 "nasl_grammar.tab.c"
2159 break;
2160
2161 case 98: /* expr: expr NOMATCH expr */
2162#line 478 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2163 { (yyval.node) = alloc_expr_cell(LNB, COMP_NOMATCH, (yyvsp[-2].node), (yyvsp[0].node)); }
2164#line 2165 "nasl_grammar.tab.c"
2165 break;
2166
2167 case 99: /* expr: expr RE_MATCH string */
2168#line 479 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2169 { (yyval.node) = alloc_RE_cell(LNB, COMP_RE_MATCH, (yyvsp[-2].node), (yyvsp[0].str), ERRC); }
2170#line 2171 "nasl_grammar.tab.c"
2171 break;
2172
2173 case 100: /* expr: expr RE_NOMATCH string */
2174#line 480 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2175 { (yyval.node) = alloc_RE_cell(LNB, COMP_RE_NOMATCH, (yyvsp[-2].node), (yyvsp[0].str), ERRC); }
2176#line 2177 "nasl_grammar.tab.c"
2177 break;
2178
2179 case 101: /* expr: expr '<' expr */
2180#line 481 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2181 { (yyval.node) = alloc_expr_cell(LNB, COMP_LT, (yyvsp[-2].node), (yyvsp[0].node)); }
2182#line 2183 "nasl_grammar.tab.c"
2183 break;
2184
2185 case 102: /* expr: expr '>' expr */
2186#line 482 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2187 { (yyval.node) = alloc_expr_cell(LNB, COMP_GT, (yyvsp[-2].node), (yyvsp[0].node)); }
2188#line 2189 "nasl_grammar.tab.c"
2189 break;
2190
2191 case 103: /* expr: expr EQ expr */
2192#line 483 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2193 { (yyval.node) = alloc_expr_cell(LNB, COMP_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
2194#line 2195 "nasl_grammar.tab.c"
2195 break;
2196
2197 case 104: /* expr: expr NEQ expr */
2198#line 484 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2199 { (yyval.node) = alloc_expr_cell(LNB, COMP_NE, (yyvsp[-2].node), (yyvsp[0].node)); }
2200#line 2201 "nasl_grammar.tab.c"
2201 break;
2202
2203 case 105: /* expr: expr SUPEQ expr */
2204#line 485 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2205 { (yyval.node) = alloc_expr_cell(LNB, COMP_GE, (yyvsp[-2].node), (yyvsp[0].node)); }
2206#line 2207 "nasl_grammar.tab.c"
2207 break;
2208
2209 case 106: /* expr: expr INFEQ expr */
2210#line 486 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2211 { (yyval.node) = alloc_expr_cell(LNB, COMP_LE, (yyvsp[-2].node), (yyvsp[0].node)); }
2212#line 2213 "nasl_grammar.tab.c"
2213 break;
2214
2215 case 112: /* const_array: '[' list_array_data ']' */
2216#line 490 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2217 { (yyval.node) = make_array_from_elems((yyvsp[-1].node)); }
2218#line 2219 "nasl_grammar.tab.c"
2219 break;
2220
2221 case 113: /* list_array_data: array_data */
2222#line 492 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2223 { (yyval.node) = (yyvsp[0].node); }
2224#line 2225 "nasl_grammar.tab.c"
2225 break;
2226
2227 case 114: /* list_array_data: array_data ',' list_array_data */
2228#line 493 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2229 {
2230 (yyvsp[-2].node)->link[1] = (yyvsp[0].node); (yyval.node) = (yyvsp[-2].node);
2231 }
2232#line 2233 "nasl_grammar.tab.c"
2233 break;
2234
2235 case 115: /* array_data: simple_array_data */
2236#line 497 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2237 {
2238 (yyval.node) = alloc_typed_cell(ARRAY_ELEM);
2239 (yyval.node)->link[0] = (yyvsp[0].node);
2240 }
2241#line 2242 "nasl_grammar.tab.c"
2242 break;
2243
2244 case 116: /* array_data: string ARROW simple_array_data */
2245#line 500 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2246 {
2247 (yyval.node) = alloc_typed_cell(ARRAY_ELEM);
2248 (yyval.node)->link[0] = (yyvsp[0].node);
2249 (yyval.node)->x.str_val = (yyvsp[-2].str);
2250 }
2251#line 2252 "nasl_grammar.tab.c"
2252 break;
2253
2254 case 117: /* atom: INTEGER */
2255#line 506 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2256 { (yyval.node) = alloc_typed_cell(CONST_INT); (yyval.node)->x.i_val = (yyvsp[0].num); }
2257#line 2258 "nasl_grammar.tab.c"
2258 break;
2259
2260 case 118: /* atom: STRING2 */
2261#line 507 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2262 {
2263 (yyval.node) = alloc_typed_cell(CONST_STR); (yyval.node)->x.str_val = (yyvsp[0].str);
2264 (yyval.node)->size = strlen((yyvsp[0].str));
2265 }
2266#line 2267 "nasl_grammar.tab.c"
2267 break;
2268
2269 case 119: /* atom: STRING1 */
2270#line 511 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2271 {
2272 (yyval.node) = alloc_typed_cell(CONST_DATA); (yyval.node)->x.str_val = (yyvsp[0].data).val;
2273 (yyval.node)->size = (yyvsp[0].data).len;
2274 }
2275#line 2276 "nasl_grammar.tab.c"
2276 break;
2277
2278 case 121: /* var: var_name */
2279#line 519 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2280 {
2281 (yyval.node) = alloc_typed_cell (NODE_VAR);
2282 (yyval.node)->line_nb = LNB;
2283 (yyval.node)->x.str_val = (yyvsp[0].str);
2284 }
2285#line 2286 "nasl_grammar.tab.c"
2286 break;
2287
2288 case 125: /* ipaddr: INTEGER '.' INTEGER '.' INTEGER '.' INTEGER */
2289#line 529 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2290 {
2291 char *s = g_strdup_printf ("%ld.%ld.%ld.%ld", (yyvsp[-6].num), (yyvsp[-4].num), (yyvsp[-2].num), (yyvsp[0].num));
2292 (yyval.node) = alloc_typed_cell (CONST_STR);
2293 (yyval.node)->line_nb = LNB;
2294 (yyval.node)->x.str_val = s;
2295 (yyval.node)->size = strlen(s);
2296 }
2297#line 2298 "nasl_grammar.tab.c"
2298 break;
2299
2300 case 126: /* loc: LOCAL arg_decl */
2301#line 539 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2302 {
2303 (yyval.node) = alloc_typed_cell (NODE_LOCAL);
2304 (yyval.node)->line_nb = LNB;
2305 (yyval.node)->link[0] = (yyvsp[0].node);
2306 }
2307#line 2308 "nasl_grammar.tab.c"
2308 break;
2309
2310 case 127: /* glob: GLOBAL arg_decl */
2311#line 547 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2312 {
2313 (yyval.node) = alloc_typed_cell (NODE_GLOBAL);
2314 (yyval.node)->line_nb = LNB;
2315 (yyval.node)->link[0] = (yyvsp[0].node);
2316 }
2317#line 2318 "nasl_grammar.tab.c"
2318 break;
2319
2320
2321#line 2322 "nasl_grammar.tab.c"
2322
2323 default: break;
2324 }
2325 /* User semantic actions sometimes alter yychar, and that requires
2326 that yytoken be updated with the new translation. We take the
2327 approach of translating immediately before every use of yytoken.
2328 One alternative is translating here after every semantic action,
2329 but that translation would be missed if the semantic action invokes
2330 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2331 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2332 incorrect destructor might then be invoked immediately. In the
2333 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2334 to an incorrect destructor call or verbose syntax error message
2335 before the lookahead is translated. */
2336 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
2337
2338 YYPOPSTACK (yylen);
2339 yylen = 0;
2340
2341 *++yyvsp = yyval;
2342
2343 /* Now 'shift' the result of the reduction. Determine what state
2344 that goes to, based on the state we popped back to and the rule
2345 number reduced by. */
2346 {
2347 const int yylhs = yyr1[yyn] - YYNTOKENS;
2348 const int yyi = yypgoto[yylhs] + *yyssp;
2349 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2350 ? yytable[yyi]
2351 : yydefgoto[yylhs]);
2352 }
2353
2354 goto yynewstate;
2355
2356
2357/*--------------------------------------.
2358| yyerrlab -- here on detecting error. |
2359`--------------------------------------*/
2360yyerrlab:
2361 /* Make sure we have latest lookahead translation. See comments at
2362 user semantic actions for why this is necessary. */
2363 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
2364 /* If not already recovering from an error, report this error. */
2365 if (!yyerrstatus)
2366 {
2367 ++yynerrs;
2368 yyerror (parm, err_c, YY_("syntax error"));
2369 }
2370
2371 if (yyerrstatus == 3)
2372 {
2373 /* If just tried and failed to reuse lookahead token after an
2374 error, discard it. */
2375
2376 if (yychar <= YYEOF)
2377 {
2378 /* Return failure if at end of input. */
2379 if (yychar == YYEOF)
2380 YYABORT;
2381 }
2382 else
2383 {
2384 yydestruct ("Error: discarding",
2385 yytoken, &yylval, parm, err_c);
2386 yychar = YYEMPTY;
2387 }
2388 }
2389
2390 /* Else will try to reuse lookahead token after shifting the error
2391 token. */
2392 goto yyerrlab1;
2393
2394
2395/*---------------------------------------------------.
2396| yyerrorlab -- error raised explicitly by YYERROR. |
2397`---------------------------------------------------*/
2398yyerrorlab:
2399 /* Pacify compilers when the user code never invokes YYERROR and the
2400 label yyerrorlab therefore never appears in user code. */
2401 if (0)
2402 YYERROR;
2403
2404 /* Do not reclaim the symbols of the rule whose action triggered
2405 this YYERROR. */
2406 YYPOPSTACK (yylen);
2407 yylen = 0;
2408 YY_STACK_PRINT (yyss, yyssp);
2409 yystate = *yyssp;
2410 goto yyerrlab1;
2411
2412
2413/*-------------------------------------------------------------.
2414| yyerrlab1 -- common code for both syntax error and YYERROR. |
2415`-------------------------------------------------------------*/
2416yyerrlab1:
2417 yyerrstatus = 3; /* Each real token shifted decrements this. */
2418
2419 /* Pop stack until we find a state that shifts the error token. */
2420 for (;;)
2421 {
2422 yyn = yypact[yystate];
2423 if (!yypact_value_is_default (yyn))
2424 {
2425 yyn += YYSYMBOL_YYerror;
2426 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2427 {
2428 yyn = yytable[yyn];
2429 if (0 < yyn)
2430 break;
2431 }
2432 }
2433
2434 /* Pop the current state because it cannot handle the error token. */
2435 if (yyssp == yyss)
2436 YYABORT;
2437
2438
2439 yydestruct ("Error: popping",
2440 YY_ACCESSING_SYMBOL (yystate), yyvsp, parm, err_c);
2441 YYPOPSTACK (1);
2442 yystate = *yyssp;
2443 YY_STACK_PRINT (yyss, yyssp);
2444 }
2445
2447 *++yyvsp = yylval;
2449
2450
2451 /* Shift the error token. */
2452 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2453
2454 yystate = yyn;
2455 goto yynewstate;
2456
2457
2458/*-------------------------------------.
2459| yyacceptlab -- YYACCEPT comes here. |
2460`-------------------------------------*/
2461yyacceptlab:
2462 yyresult = 0;
2463 goto yyreturn;
2464
2465
2466/*-----------------------------------.
2467| yyabortlab -- YYABORT comes here. |
2468`-----------------------------------*/
2469yyabortlab:
2470 yyresult = 1;
2471 goto yyreturn;
2472
2473
2474#if !defined yyoverflow
2475/*-------------------------------------------------.
2476| yyexhaustedlab -- memory exhaustion comes here. |
2477`-------------------------------------------------*/
2478yyexhaustedlab:
2479 yyerror (parm, err_c, YY_("memory exhausted"));
2480 yyresult = 2;
2481 goto yyreturn;
2482#endif
2483
2484
2485/*-------------------------------------------------------.
2486| yyreturn -- parsing is finished, clean up and return. |
2487`-------------------------------------------------------*/
2488yyreturn:
2489 if (yychar != YYEMPTY)
2490 {
2491 /* Make sure we have latest lookahead translation. See comments at
2492 user semantic actions for why this is necessary. */
2493 yytoken = YYTRANSLATE (yychar);
2494 yydestruct ("Cleanup: discarding lookahead",
2495 yytoken, &yylval, parm, err_c);
2496 }
2497 /* Do not reclaim the symbols of the rule whose action triggered
2498 this YYABORT or YYACCEPT. */
2499 YYPOPSTACK (yylen);
2500 YY_STACK_PRINT (yyss, yyssp);
2501 while (yyssp != yyss)
2502 {
2503 yydestruct ("Cleanup: popping",
2504 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, parm, err_c);
2505 YYPOPSTACK (1);
2506 }
2507#ifndef yyoverflow
2508 if (yyss != yyssa)
2509 YYSTACK_FREE (yyss);
2510#endif
2511
2512 return yyresult;
2513}
2514
2515#line 553 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2516
2517
2518#include <stdio.h>
2519#include <stdlib.h>
2520#include <gvm/base/logging.h>
2521#include <gvm/base/prefs.h>
2522#include <libgen.h>
2523#include <gcrypt.h>
2524
2525static void
2526naslerror(naslctxt *parm, int *error_counter, const char *s)
2527{
2528 (void) parm;
2529 (*error_counter)++;
2530 g_message ("Parse error at or near line %d:", LNB);
2531 g_message (" %s", s);
2532}
2533
2534static GSList * inc_dirs = NULL;
2535
2547int
2548add_nasl_inc_dir (const char * dir);
2549
2550int
2551add_nasl_inc_dir (const char * dir)
2552{
2553 if (dir == NULL)
2554 {
2555 return 0;
2556 }
2557
2558 // Allow initialization with empty element
2559 if (*dir == '\0')
2560 {
2561 inc_dirs = g_slist_append (inc_dirs, g_strdup((gchar *)dir));
2562 return 0;
2563 }
2564
2565 struct stat stat_buf;
2566
2567 if (stat (dir, &stat_buf) != 0)
2568 return -1;
2569
2570 if (S_ISDIR(stat_buf.st_mode) != 0)
2571 {
2572 inc_dirs = g_slist_append (inc_dirs, g_strdup((gchar *)dir));
2573 return 0;
2574 }
2575 else
2576 return -2;
2577}
2578
2579static int checksum_algorithm = GCRY_MD_NONE;
2580
2581static void
2583{
2584 static int loaded = 0;
2585 const char *base, *prefix;
2586 char filename[2048], *fbuffer;
2587 FILE *file;
2588 size_t flen;
2589
2590 if (loaded)
2591 return;
2592 loaded = 1;
2593 base = prefs_get ("plugins_folder");
2594 snprintf (filename, sizeof (filename), "%s/sha256sums", base);
2595 if (g_file_get_contents (filename, &fbuffer, &flen, NULL))
2596 checksum_algorithm = GCRY_MD_SHA256;
2597 if (checksum_algorithm == GCRY_MD_NONE)
2598 {
2599 g_warning ("No plugins checksums file");
2600 return;
2601 }
2602 /* Verify checksum */
2603 if (nasl_verify_signature (filename, fbuffer, flen) != 0)
2604 {
2605 g_warning ("Erroneous or missing signature for checksums file %s",
2606 filename);
2607 g_free (fbuffer);
2608 return;
2609 }
2610 g_free (fbuffer);
2611
2612 /* Insert content into KB */
2613 file = fopen (filename, "r");
2614 if (!file)
2615 {
2616 g_warning ("%s: Couldn't read file %s", __func__, filename);
2617 return;
2618 }
2619 if (checksum_algorithm == GCRY_MD_SHA256)
2620 {
2621 kb_del_items (kb, "sha256sums:*");
2622 prefix = "sha256sums";
2623 }
2624 while (1)
2625 {
2626 char buffer[2048], **splits;
2627 if (!fgets (buffer, sizeof (buffer), file))
2628 break;
2629 if (strstr (buffer, ".asc")
2630 || (!strstr (buffer, ".inc") && !strstr (buffer, ".nasl")))
2631 continue;
2632 splits = g_strsplit (buffer, " ", -1);
2633 if (g_strv_length (splits) != 2)
2634 {
2635 g_warning ("%s: Erroneous checksum entry %s", __func__, buffer);
2636 g_strfreev (splits);
2637 break;
2638 }
2639 splits[1][strlen (splits[1]) - 1] = '\0';
2640 if (strstr (splits[1], ".inc"))
2641 g_snprintf (buffer, sizeof (buffer), "%s:%s", prefix,
2642 basename (splits[1]));
2643 else
2644 g_snprintf (buffer, sizeof (buffer), "%s:%s/%s", prefix, base,
2645 splits[1]);
2646 kb_item_set_str (kb, buffer, splits[0], 0);
2647 g_strfreev (splits);
2648 }
2649 fclose (file);
2650}
2651
2660static char *
2661file_checksum (const char *filename, int algorithm)
2662{
2663 char *content = NULL, digest[128], *result;
2664 size_t len = 0, i, alglen;
2665
2666 assert (algorithm == GCRY_MD_SHA256);
2667 if (!filename || !g_file_get_contents (filename, &content, &len, NULL))
2668 return NULL;
2669
2670 gcry_md_hash_buffer (algorithm, digest, content, len);
2671 alglen = gcry_md_get_algo_dlen (algorithm);
2672 result = g_malloc0 (alglen * 2 + 1);
2673 for (i = 0; i < alglen; i++)
2674 snprintf (result + 2 * i, 3, "%02x", (unsigned char) digest[i]);
2675 g_free (content);
2676
2677 return result;
2678}
2679
2680
2695int
2696init_nasl_ctx(naslctxt* pc, const char* name)
2697{
2698 char *full_name = NULL, key_path[2048], *checksum, *filename;
2699 GSList * inc_dir = inc_dirs; // iterator for include directories
2700 size_t flen = 0;
2701 time_t timestamp;
2702
2703 // initialize if not yet done (for openvas-server < 2.0.1)
2704 if (! inc_dirs) add_nasl_inc_dir("");
2705
2706 pc->line_nb = 1;
2707 pc->name = (char *) name;
2709 pc->tree = NULL;
2710 if (!parse_len)
2711 {
2712 parse_len = 9092;
2713 parse_buffer = g_malloc0 (parse_len);
2714 }
2715 else
2716 parse_buffer[0] = '\0';
2717
2718
2720 while (inc_dir != NULL) {
2721 if (full_name)
2722 g_free (full_name);
2723 full_name = g_build_filename(inc_dir->data, name, NULL);
2724
2725 if ((g_file_get_contents (full_name, &pc->buffer, &flen, NULL)))
2726 break;
2727
2728 inc_dir = g_slist_next(inc_dir);
2729 }
2730
2731 if (!full_name || !pc->buffer) {
2732 g_message ("%s: Not able to open nor to locate it in include paths",
2733 name);
2734 g_free(full_name);
2735 return -1;
2736 }
2737
2738 if (pc->always_signed)
2739 {
2740 g_free(full_name);
2741 return 0;
2742 }
2743 /* Cache the checksum of signature verified files, so that commonly included
2744 * files are not verified multiple times per scan. */
2745 if (strstr (full_name, ".inc"))
2746 filename = basename (full_name);
2747 else
2748 filename = full_name;
2749 snprintf (key_path, sizeof (key_path), "signaturecheck:%s", filename);
2750 timestamp = kb_item_get_int (pc->kb, key_path);
2751
2752 /* We never use the mtime of a .nasl/.inc file as integrity check during
2753 * the script load up. A complete verification is done in this case.
2754 * Once it has been uploaded in the nvticache it is enough to just check
2755 * the mtime. */
2756 if (timestamp > 0 && pc->exec_descr == 0)
2757 {
2758 struct stat file_stat;
2759
2760 if (stat (full_name, &file_stat) >= 0 && timestamp > file_stat.st_mtime)
2761 {
2762 /* Already checked. No need to check again. */
2763 g_free (full_name);
2764 return 0;
2765 }
2766 }
2767
2768 load_checksums (pc->kb);
2769 if (checksum_algorithm == GCRY_MD_NONE)
2770 return -1;
2771 else if (checksum_algorithm == GCRY_MD_SHA256)
2772 snprintf (key_path, sizeof (key_path), "sha256sums:%s", filename);
2773 else
2774 abort ();
2775 checksum = kb_item_get_str (pc->kb, key_path);
2776 if (!checksum)
2777 {
2778 g_warning ("No checksum for %s", full_name);
2779 g_free (full_name);
2780 return -1;
2781 }
2782 else
2783 {
2784 int ret;
2785 char *check = file_checksum (full_name, checksum_algorithm);
2786
2787 snprintf (key_path, sizeof (key_path), "signaturecheck:%s", filename);
2788 ret = strcmp (check, checksum);
2789 if (ret)
2790 {
2791 kb_del_items (pc->kb, key_path);
2792 g_warning ("checksum for %s not matching", full_name);
2793 }
2794 else
2795 {
2796 kb_del_items (pc->kb, key_path);
2797 kb_item_add_int (pc->kb, key_path, time (NULL));
2798 }
2799
2800 g_free (full_name);
2801 g_free (checksum);
2802 g_free (check);
2803 return ret;
2804 }
2805}
2806
2807void
2809{
2810 deref_cell(c->tree);
2811 g_free (c->buffer);
2812}
2813
2814void
2815nasl_clean_inc (void);
2816
2817void
2819{
2820 if (!includes_hash)
2821 return;
2822 g_hash_table_destroy (includes_hash);
2823 includes_hash = NULL;
2824}
2825
2826int
2828{
2829 tree_cell *ctx;
2830 if (!includes_hash)
2831 return -2;
2832
2833 if ((ctx = g_hash_table_lookup (includes_hash, c))) {
2834 return ctx->include_order;
2835 }
2836 return -1;
2837}
2838
2867
2868static int
2869mylex (YYSTYPE *lvalp, void *parm)
2870{
2871 char *p;
2872 naslctxt *ctx = parm;
2873 int c, st = ST_START, len, r;
2874 long int x, i;
2875
2876 if (!ctx)
2877 return -1;
2878
2879 p = parse_buffer;
2880 len = 0;
2881
2882 while (1)
2883 {
2884 c = ctx->buffer[ctx->index++];
2885 if (c == '\0')
2886 break;
2887 if (c == '\n')
2888 ctx->line_nb ++;
2889
2890 switch(st)
2891 {
2892 case ST_START:
2893 if (c == '#')
2894 st = ST_COMMENT;
2895 else if (isalpha(c) || c == '_')
2896 {
2897 st = ST_IDENT;
2898 *p++ = c;
2899 len ++;
2900 }
2901 else if (isspace(c))
2902 st = ST_SPACE;
2903 else if (c == '0')
2904 st = ST_ZERO;
2905 else if (isdigit(c))
2906 {
2907 st = ST_DEC;
2908 *p++ = c;
2909 len ++;
2910 }
2911 else if (c == '\'')
2912 st = ST_STRING1;
2913 else if (c == '"')
2914 st = ST_STRING2;
2915 else if (c == '+')
2916 st = ST_PLUS;
2917 else if (c == '-')
2918 st = ST_MINUS;
2919 else if (c == '*')
2920 st = ST_MULT;
2921 else if (c == '/')
2922 st = ST_DIV;
2923 else if (c == '%')
2924 st = ST_MODULO;
2925 else if (c == '>')
2926 st = ST_SUP;
2927 else if (c == '<')
2928 st = ST_INF;
2929 else if (c == '=')
2930 st = ST_EQ;
2931 else if (c == '|')
2932 st = ST_OR;
2933 else if (c == '!')
2934 st = ST_NOT;
2935 else if (c == '&')
2936 st = ST_AND;
2937 else
2938 {
2939 return c;
2940 }
2941 break;
2942
2943 case ST_STRING2:
2944 if (c == '"')
2945 goto exit_loop;
2946 *p++ = c;
2947 len ++;
2948 break;
2949
2950 case ST_STRING1:
2951 if (c == '\'')
2952 goto exit_loop;
2953 else if (c == '\\')
2954 {
2955 c = ctx->buffer[ctx->index++];
2956 if (c == '\0')
2957 {
2958 nasl_perror(NULL, "Unfinished string\n");
2959 goto exit_loop; /* parse error? */
2960 }
2961 switch (c)
2962 {
2963 case '\n': /* escaped end of line */
2964 ctx->line_nb ++;
2965 break;
2966 case '\\':
2967 *p++ ='\\'; len ++;
2968 break;
2969 case 'n':
2970 *p++ = '\n'; len++;
2971 break;
2972 case 'f':
2973 *p++ = '\f'; len ++;
2974 break;
2975 case 't':
2976 *p++ = '\t'; len ++;
2977 break;
2978 case 'r':
2979 *p++ = '\r'; len++;
2980 break;
2981 case 'v':
2982 *p++ = '\v'; len ++;
2983 break;
2984 case '"':
2985 *p ++ = '"'; len ++;
2986 break;
2987 /* Not yet, as we do not return the length of the string */
2988 case '0':
2989 *p++ = '\0'; len++;
2990 break;
2991 case '\'':
2992 *p++ = '\''; len++;
2993 break;
2994
2995 case 'x':
2996 x = 0;
2997 for (i = 0; i < 2; i ++)
2998 {
2999 c = ctx->buffer[ctx->index++];
3000 if (c == '\0')
3001 {
3002 nasl_perror(NULL, "Unfinished \\x escape sequence (EOF)\n");
3003 goto exit_loop;
3004 }
3005 if (c == '\n')
3006 ctx->line_nb ++;
3007
3008 c = tolower(c);
3009 if (c >= '0' && c <= '9')
3010 x = x * 16 + (c - '0');
3011 else if (c >= 'a' && c <= 'f')
3012 x = x * 16 + 10 + (c - 'a');
3013 else
3014 {
3015 nasl_perror(NULL, "Unfinished \\x escape sequence\n");
3016 ctx->index--;
3017 if (c == '\n')
3018 ctx->line_nb --;
3019 break;
3020 }
3021 }
3022 *p++ = x; len ++;
3023 break;
3024
3025 default:
3026 nasl_perror(NULL, "Unknown escape sequence \\%c\n", c);
3027 ctx->index--;
3028 goto exit_loop;
3029 }
3030 }
3031 else
3032 {
3033 *p++ = c;
3034 len ++;
3035 }
3036 break;
3037
3038 case ST_IDENT:
3039 if (isalnum(c) || c == '_')
3040 {
3041 st = ST_IDENT;
3042 *p++ = c;
3043 len ++;
3044 }
3045 else
3046 {
3047 ctx->index--;
3048 if (c == '\n')
3049 ctx->line_nb --;
3050 goto exit_loop;
3051 }
3052 break;
3053
3054 case ST_ZERO:
3055 if (c == 'x' || c == 'X')
3056 st = ST_ZEROX;
3057 else if (isdigit(c))
3058 {
3059 if (c <= '7')
3060 st = ST_OCT;
3061 else
3062 st = ST_DEC;
3063 *p ++ = c;
3064 len ++;
3065 }
3066 else
3067 {
3068 ctx->index--;
3069 if (c == '\n')
3070 ctx->line_nb --;
3071 goto exit_loop;
3072 }
3073 break;
3074
3075 case ST_ZEROX:
3076 if (isxdigit(c))
3077 {
3078 st = ST_HEX;
3079 *p++ = c;
3080 len ++;
3081 }
3082 else
3083 {
3084 /* This should be a parse error */
3085 ctx->index--;
3086 if (c == '\n')
3087 ctx->line_nb --;
3088 goto exit_loop;
3089 }
3090 break;
3091
3092 case ST_OCT:
3093 if (c >= '0')
3094 {
3095 if (c <= '7')
3096 {
3097 *p++ = c;
3098 len ++;
3099 break;
3100 }
3101 else if (c <= '9')
3102 {
3103 *p++ = c;
3104 len ++;
3105 st = ST_DEC;
3106 break;
3107 }
3108 }
3109 ctx->index--;
3110 if (c == '\n')
3111 ctx->line_nb --;
3112 goto exit_loop;
3113
3114 case ST_DEC:
3115 if (isdigit(c))
3116 {
3117 *p++ = c;
3118 len ++;
3119 }
3120 else
3121 {
3122 ctx->index--;
3123 if (c == '\n')
3124 ctx->line_nb --;
3125 goto exit_loop;
3126 }
3127 break;
3128
3129 case ST_HEX:
3130 if (isxdigit(c))
3131 {
3132 *p++ = c;
3133 len ++;
3134 }
3135 else
3136 {
3137 ctx->index--;
3138 if (c == '\n')
3139 ctx->line_nb --;
3140 goto exit_loop;
3141 }
3142 break;
3143
3144 case ST_SPACE:
3145 if (! isspace(c))
3146 {
3147 ctx->index--;
3148 if (c == '\n')
3149 ctx->line_nb --;
3150 st = ST_START;
3151 }
3152 break;
3153
3154 case ST_COMMENT:
3155 if (c == '\n')
3156 st = ST_START;
3157 break;
3158
3159 case ST_SUP_EXCL:
3160 if (c == '<')
3161 return NOMATCH;
3162 else
3163 {
3164 ctx->index--;
3165 if (c == '\n')
3166 ctx->line_nb --;
3167 if (! isprint(c)) c = '.';
3168 g_message ("lexer error: invalid token >!%c "
3169 "parsed as >!< %c", c, c);
3170 return NOMATCH;
3171 }
3172 break;
3173
3174 case ST_SUP:
3175 if (c == '=')
3176 return SUPEQ;
3177 else if (c == '<')
3178 return MATCH;
3179 else if (c == '>')
3180 st = ST_R_SHIFT;
3181 else if (c == '!')
3182 st = ST_SUP_EXCL;
3183 else
3184 {
3185 ctx->index--;
3186 if (c == '\n')
3187 ctx->line_nb --;
3188 return '>';
3189 }
3190 break;
3191
3192 case ST_INF:
3193 if (c == '=')
3194 return INFEQ;
3195 else if (c == '<')
3196 st = ST_L_SHIFT;
3197 else
3198 {
3199 ctx->index--;
3200 if (c == '\n')
3201 ctx->line_nb --;
3202 return '<';
3203 }
3204 break;
3205
3206 case ST_R_SHIFT:
3207 if (c == '=')
3208 return R_SHIFT_EQ;
3209 else if (c == '>')
3210 st = ST_R_USHIFT;
3211 else
3212 {
3213 ctx->index--;
3214 if (c == '\n')
3215 ctx->line_nb --;
3216 return R_SHIFT;
3217 }
3218 /*NOTREACHED*/
3219 break;
3220
3221 case ST_R_USHIFT:
3222 if (c == '=')
3223 return R_USHIFT_EQ;
3224 else
3225 {
3226 ctx->index--;
3227 if (c == '\n')
3228 ctx->line_nb --;
3229 return R_USHIFT;
3230 }
3231 /*NOTREACHED*/
3232 break;
3233
3234 case ST_L_SHIFT:
3235 if (c == '=')
3236 return L_SHIFT_EQ;
3237 else
3238 {
3239 ctx->index--;
3240 if (c == '\n')
3241 ctx->line_nb --;
3242 return L_SHIFT;
3243 }
3244 /*NOTREACHED*/
3245 break;
3246
3247 case ST_AND:
3248 if (c == '&')
3249 return AND;
3250 ctx->index--;
3251 if (c == '\n')
3252 ctx->line_nb --;
3253 return '&';
3254
3255 case ST_OR:
3256 if (c == '|')
3257 return OR;
3258 ctx->index--;
3259 if (c == '\n')
3260 ctx->line_nb --;
3261 return '|';
3262
3263 case ST_NOT:
3264 if (c == '=')
3265 return NEQ;
3266 else if (c == '~')
3267 return RE_NOMATCH;
3268 ctx->index--;
3269 if (c == '\n')
3270 ctx->line_nb --;
3271 return '!';
3272
3273 case ST_EQ:
3274 if (c == '=')
3275 return EQ;
3276 else if (c == '~')
3277 return RE_MATCH;
3278 else if (c == '>')
3279 return ARROW;
3280 ctx->index--;
3281 if (c == '\n')
3282 ctx->line_nb --;
3283 return '=';
3284
3285 case ST_PLUS:
3286 if (c == '+')
3287 return PLUS_PLUS;
3288 else if (c == '=')
3289 return PLUS_EQ;
3290
3291 ctx->index--;
3292 if (c == '\n')
3293 ctx->line_nb --;
3294 return '+';
3295
3296 case ST_MINUS:
3297 if (c == '-')
3298 return MINUS_MINUS;
3299 else if (c == '=')
3300 return MINUS_EQ;
3301
3302 ctx->index--;
3303 if (c == '\n')
3304 ctx->line_nb --;
3305 return '-';
3306
3307 case ST_MULT:
3308 if (c == '=')
3309 return MULT_EQ;
3310 else if (c == '*')
3311 return EXPO;
3312 ctx->index--;
3313 if (c == '\n')
3314 ctx->line_nb --;
3315 return '*';
3316
3317 case ST_DIV:
3318 if (c == '=')
3319 return DIV_EQ;
3320
3321 ctx->index--;
3322 if (c == '\n')
3323 ctx->line_nb --;
3324 return '/';
3325
3326 case ST_MODULO:
3327 if (c == '=')
3328 return MODULO_EQ;
3329
3330 ctx->index--;
3331 if (c == '\n')
3332 ctx->line_nb --;
3333 return '%';
3334
3335 }
3336
3337 if (len >= parse_len)
3338 {
3339 int offs = p - parse_buffer;
3340 parse_len += 9092;
3341 parse_buffer = g_realloc (parse_buffer, parse_len);
3342 p = parse_buffer + offs;
3343 }
3344 }
3345
3346 exit_loop:
3347 parse_buffer[len] = '\0';
3348 switch (st)
3349 {
3350 case ST_START:
3351 case ST_COMMENT:
3352 case ST_SPACE:
3353 return 0;
3354
3355 case ST_STRING2:
3356 r = STRING2;
3357 lvalp->str = g_strdup (parse_buffer);
3358 return r;
3359
3360 case ST_STRING1:
3361 r = STRING1;
3362 lvalp->data.val = g_malloc0 (len+2);
3363 memcpy (lvalp->data.val, parse_buffer, len + 1);
3364 lvalp->data.len = len;
3365 return r;
3366
3367 case ST_IDENT:
3368 if (strcmp (parse_buffer, "if") == 0)
3369 r = IF;
3370 else if (strcmp (parse_buffer, "else") == 0)
3371 r = ELSE;
3372 else if (strcmp (parse_buffer, "for") == 0)
3373 r = FOR;
3374 else if (strcmp (parse_buffer, "while") == 0)
3375 r = WHILE;
3376 else if (strcmp (parse_buffer, "repeat") == 0)
3377 r = REPEAT;
3378 else if (strcmp (parse_buffer, "until") == 0)
3379 r = UNTIL;
3380 else if (strcmp (parse_buffer, "foreach") == 0)
3381 r = FOREACH;
3382 else if (strcmp (parse_buffer, "function") == 0)
3383 r = FUNCTION;
3384 else if (strcmp (parse_buffer, "return") == 0)
3385 r = RETURN;
3386 else if (strcmp (parse_buffer, "x") == 0)
3387 r = REP;
3388 else if (strcmp (parse_buffer, "include") == 0)
3389 r = INCLUDE;
3390 else if (strcmp (parse_buffer, "break") == 0)
3391 r = BREAK;
3392 else if (strcmp (parse_buffer, "continue") == 0)
3393 r = CONTINUE;
3394 else if (strcmp (parse_buffer, "local_var") == 0)
3395 r = LOCAL;
3396 else if (strcmp (parse_buffer, "global_var") == 0)
3397 r = GLOBAL;
3398 else
3399 {
3400 r = IDENT;
3401 lvalp->str = g_strdup (parse_buffer);
3402 return r;
3403 }
3404 return r;
3405
3406 case ST_DEC:
3407 /* -123 is parsed as "-" and "123" so that we can write "4-2" without
3408 * inserting a white space after the minus operator
3409 * Note that strtoul would also work on negative integers */
3410 lvalp->num = x = strtoul (parse_buffer, NULL, 10);
3411 return INTEGER;
3412
3413 case ST_OCT:
3414 lvalp->num = x = strtoul (parse_buffer, NULL, 8);
3415 return INTEGER;
3416
3417 case ST_HEX:
3418 lvalp->num = x = strtoul (parse_buffer, NULL, 16);
3419 return INTEGER;
3420
3421 case ST_ZEROX:
3422 nasl_perror(NULL, "Invalid token 0x parsed as 0 at line %d\n",
3423 ctx->line_nb);
3424 /* fallthrough */
3425 case ST_ZERO:
3426 lvalp->num = 0;
3427 return INTEGER;
3428 default:
3429 abort();
3430 }
3431}
3432
3433static int
3434nasllex(YYSTYPE * lvalp, void * parm, int * err_c)
3435{
3436 #pragma GCC diagnostic push
3437 #pragma GCC diagnostic ignored "-Wunused-parameter"
3438 (void) err_c;
3439 #pragma GCC diagnostic pop
3440 int x = mylex (lvalp, parm);
3441 return x;
3442}
3443
int naslparse(naslctxt *, int *)
int nasl_verify_signature(const char *filename)
void nasl_set_filename(const char *filename)
Definition: nasl_debug.c:88
void nasl_set_function_filename(const char *function)
Definition: nasl_debug.c:99
void nasl_perror(lex_ctxt *lexic, char *msg,...)
Definition: nasl_debug.c:111
const char * nasl_get_filename(const char *function)
Definition: nasl_debug.c:60
int nasl_get_include_order(const char *c)
static const char * yysymbol_name(yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED
#define LNB
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
#define YYMAXDEPTH
static void naslerror(naslctxt *, int *, const char *)
static char * file_checksum(const char *filename, int algorithm)
Get the checksum of a file.
#define YYSTACK_FREE
static const yytype_int8 yytranslate[]
yysymbol_kind_t
@ YYSYMBOL_repeat_loop
@ YYSYMBOL_68_
@ YYSYMBOL_UMINUS
@ YYSYMBOL_INCLUDE
@ YYSYMBOL_MINUS_MINUS
@ YYSYMBOL_const_array
@ YYSYMBOL_YYUNDEF
@ YYSYMBOL_71_
@ YYSYMBOL_52_
@ YYSYMBOL_47_
@ YYSYMBOL_53_
@ YYSYMBOL_EQ
@ YYSYMBOL_UNTIL
@ YYSYMBOL_50_
@ YYSYMBOL_array_index
@ YYSYMBOL_IF
@ YYSYMBOL_for_loop
@ YYSYMBOL_loc
@ YYSYMBOL_func_decl
@ YYSYMBOL_instr
@ YYSYMBOL_LOCAL
@ YYSYMBOL_arg_list_1
@ YYSYMBOL_YYerror
@ YYSYMBOL_loop
@ YYSYMBOL_BREAK
@ YYSYMBOL_var_name
@ YYSYMBOL_65_
@ YYSYMBOL_REPEAT
@ YYSYMBOL_49_
@ YYSYMBOL_foreach_loop
@ YYSYMBOL_glob
@ YYSYMBOL_expr
@ YYSYMBOL_STRING1
@ YYSYMBOL_simple_instr
@ YYSYMBOL_63_
@ YYSYMBOL_AND
@ YYSYMBOL_51_
@ YYSYMBOL_instr_decl
@ YYSYMBOL_while_loop
@ YYSYMBOL_ARROW
@ YYSYMBOL_L_SHIFT
@ YYSYMBOL_inc
@ YYSYMBOL_NOMATCH
@ YYSYMBOL_55_
@ YYSYMBOL_FOREACH
@ YYSYMBOL_NEQ
@ YYSYMBOL_48_
@ YYSYMBOL_string
@ YYSYMBOL_67_
@ YYSYMBOL_identifier
@ YYSYMBOL_ELSE
@ YYSYMBOL_instr_decl_list
@ YYSYMBOL_R_USHIFT_EQ
@ YYSYMBOL_arg_decl_1
@ YYSYMBOL_array_data
@ YYSYMBOL_atom
@ YYSYMBOL_61_
@ YYSYMBOL_CONTINUE
@ YYSYMBOL_lvalue
@ YYSYMBOL_RE_NOMATCH
@ YYSYMBOL_BIT_NOT
@ YYSYMBOL_INFEQ
@ YYSYMBOL_instr_list
@ YYSYMBOL_64_
@ YYSYMBOL_WHILE
@ YYSYMBOL_70_
@ YYSYMBOL_54_
@ YYSYMBOL_L_SHIFT_EQ
@ YYSYMBOL_arg
@ YYSYMBOL_SUPEQ
@ YYSYMBOL_arg_list
@ YYSYMBOL_EXPO
@ YYSYMBOL_MINUS_EQ
@ YYSYMBOL_block
@ YYSYMBOL_array_elem
@ YYSYMBOL_56_
@ YYSYMBOL_if_block
@ YYSYMBOL_YYACCEPT
@ YYSYMBOL_57_
@ YYSYMBOL_MATCH
@ YYSYMBOL_OR
@ YYSYMBOL_rep
@ YYSYMBOL_R_SHIFT_EQ
@ YYSYMBOL_MODULO_EQ
@ YYSYMBOL_YYEOF
@ YYSYMBOL_GLOBAL
@ YYSYMBOL_FUNCTION
@ YYSYMBOL_func_call
@ YYSYMBOL_62_
@ YYSYMBOL_STRING2
@ YYSYMBOL_ret
@ YYSYMBOL_R_SHIFT
@ YYSYMBOL_tiptop
@ YYSYMBOL_aff_func
@ YYSYMBOL_MULT_EQ
@ YYSYMBOL_simple_array_data
@ YYSYMBOL_INTEGER
@ YYSYMBOL_ipaddr
@ YYSYMBOL_var
@ YYSYMBOL_list_array_data
@ YYSYMBOL_YYEMPTY
@ YYSYMBOL_aff
@ YYSYMBOL_72_
@ YYSYMBOL_69_
@ YYSYMBOL_RETURN
@ YYSYMBOL_66_
@ YYSYMBOL_IDENT
@ YYSYMBOL_DIV_EQ
@ YYSYMBOL_REP
@ YYSYMBOL_PLUS_EQ
@ YYSYMBOL_PLUS_PLUS
@ YYSYMBOL_FOR
@ YYSYMBOL_NOT
@ YYSYMBOL_R_USHIFT
@ YYSYMBOL_post_pre_incr
@ YYSYMBOL_arg_decl
@ YYSYMBOL_RE_MATCH
#define yyerrok
@ ST_INF
@ ST_ZERO
@ ST_MINUS
@ ST_STRING2
@ ST_DEC
@ ST_OR
@ ST_L_SHIFT
@ ST_ZEROX
@ ST_STRING1
@ ST_IDENT
@ ST_NOT
@ ST_MODULO
@ ST_HEX
@ ST_R_SHIFT
@ ST_SUP
@ ST_MULT
@ ST_SPACE
@ ST_OCT
@ ST_PLUS
@ ST_SUP_EXCL
@ ST_COMMENT
@ ST_DIV
@ ST_STRING1_ESC
@ ST_EQ
@ ST_R_USHIFT
@ ST_START
@ ST_AND
#define YY_ASSERT(E)
#define YY_(Msgid)
static int mylex(YYSTYPE *lvalp, void *parm)
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
static const yytype_int8 yydefact[]
#define YYNSTATES
void nasl_clean_ctx(naslctxt *c)
#define YY_IGNORE_USELESS_CAST_END
short yytype_int16
#define YYABORT
static const yytype_int16 yyrline[]
void nasl_clean_inc(void)
#define YYSTACK_BYTES(N)
static int checksum_algorithm
yytype_uint8 yy_state_t
#define YY_REDUCE_PRINT(Rule)
#define YY_CAST(Type, Val)
static const yytype_int16 yypact[]
static char * parse_buffer
#define yylex
static const yytype_uint8 yydefgoto[]
#define YY_NULLPTR
#define YYFINAL
#define YY_ACCESSING_SYMBOL(State)
#define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
static const yytype_int16 yypgoto[]
#define YY_INITIAL_VALUE(Value)
#define yyparse
#define YYNTOKENS
int init_nasl_ctx(naslctxt *pc, const char *name)
Initialize a NASL context for a NASL file.
unsigned char yytype_uint8
#define YY_STACK_PRINT(Bottom, Top)
static void yy_symbol_value_print(FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep, naslctxt *parm, int *err_c)
#define YYSIZE_T
#define yydebug
#define YY_IGNORE_USELESS_CAST_BEGIN
static void yydestruct(const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, naslctxt *parm, int *err_c)
static const yytype_int8 yyr2[]
GHashTable * includes_hash
void * malloc(YYSIZE_T)
#define LN
#define YYPTRDIFF_T
#define yynerrs
static int parse_len
@ YYENOMEM
static const yytype_int16 yytable[]
#define YYACCEPT
#define yytable_value_is_error(Yyn)
#define YYTRANSLATE(YYX)
static const yytype_int8 yystos[]
#define ERRC
#define YY_ATTRIBUTE_UNUSED
int add_nasl_inc_dir(const char *dir)
Adds the given string as directory for searching for includes.
static const char *const yytname[]
static int include_order
static const yytype_int8 yyr1[]
static void yy_reduce_print(yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule, naslctxt *parm, int *err_c)
static void load_checksums(kb_t kb)
#define YYPOPSTACK(N)
int yy_state_fast_t
static GSList * inc_dirs
static int nasllex(YYSTYPE *lvalp, void *parm, int *err_c)
unsigned short yytype_uint16
#define YYLAST
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
#define yypact_value_is_default(Yyn)
#define YYINITDEPTH
signed char yytype_int8
void free(void *)
#define YYERROR
static void yy_stack_print(yy_state_t *yybottom, yy_state_t *yytop)
#define YYSIZEOF(X)
#define YYFPRINTF
static const yytype_int16 yycheck[]
#define YYSTACK_ALLOC
#define YYDPRINTF(Args)
#define YY_USE(E)
#define yyerror
static void yy_symbol_print(FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep, naslctxt *parm, int *err_c)
@ MINUS_EQ
@ PLUS_PLUS
@ R_SHIFT_EQ
@ YYEOF
@ MATCH
@ DIV_EQ
@ IF
@ MINUS_MINUS
@ R_SHIFT
@ INCLUDE
@ MODULO_EQ
@ WHILE
@ RE_NOMATCH
@ CONTINUE
@ PLUS_EQ
@ YYerror
@ RETURN
@ ARROW
@ YYEMPTY
@ INTEGER
@ INFEQ
@ FOREACH
@ NOMATCH
@ EXPO
@ L_SHIFT
@ AND
@ R_USHIFT
@ YYUNDEF
@ ELSE
@ BREAK
@ OR
@ REPEAT
@ STRING1
@ EQ
@ UNTIL
@ FOR
@ R_USHIFT_EQ
@ FUNCTION
@ NEQ
@ L_SHIFT_EQ
@ REP
@ LOCAL
@ MULT_EQ
@ RE_MATCH
@ STRING2
@ SUPEQ
@ IDENT
@ GLOBAL
const char * name
Definition: nasl_init.c:411
uint8_t len
void ref_cell(tree_cell *c)
Definition: nasl_tree.c:167
tree_cell * alloc_RE_cell(int lnb, int t, tree_cell *l, char *re_str, int *err_c)
Definition: nasl_tree.c:36
tree_cell * alloc_expr_cell(int lnb, int t, tree_cell *l, tree_cell *r)
Definition: nasl_tree.c:63
tree_cell * alloc_typed_cell(int typ)
Definition: nasl_tree.c:28
static void prefix(int n, int i)
Definition: nasl_tree.c:222
void deref_cell(tree_cell *c)
Definition: nasl_tree.c:181
@ NODE_FOR
Definition: nasl_tree.h:16
@ NODE_ARRAY_EL
Definition: nasl_tree.h:29
@ NODE_L_SHIFT_EQ
Definition: nasl_tree.h:41
@ NODE_PLUS_EQ
Definition: nasl_tree.h:35
@ NODE_FUN_CALL
Definition: nasl_tree.h:22
@ COMP_LE
Definition: nasl_tree.h:73
@ NODE_R_SHIFT_EQ
Definition: nasl_tree.h:42
@ COMP_GT
Definition: nasl_tree.h:76
@ NODE_LOCAL
Definition: nasl_tree.h:32
@ CONST_DATA
Definition: nasl_tree.h:82
@ NODE_AFF
Definition: nasl_tree.h:30
@ EXPR_MODULO
Definition: nasl_tree.h:54
@ COMP_RE_MATCH
Definition: nasl_tree.h:69
@ NODE_MULT_EQ
Definition: nasl_tree.h:37
@ COMP_NE
Definition: nasl_tree.h:75
@ NODE_VAR
Definition: nasl_tree.h:31
@ NODE_R_USHIFT_EQ
Definition: nasl_tree.h:43
@ NODE_ARG
Definition: nasl_tree.h:24
@ NODE_CONTINUE
Definition: nasl_tree.h:27
@ COMP_EQ
Definition: nasl_tree.h:74
@ EXPR_MULT
Definition: nasl_tree.h:52
@ NODE_FUN_DEF
Definition: nasl_tree.h:21
@ COMP_GE
Definition: nasl_tree.h:77
@ ARRAY_ELEM
Definition: nasl_tree.h:85
@ NODE_REPEAT_UNTIL
Definition: nasl_tree.h:19
@ NODE_REPEATED
Definition: nasl_tree.h:20
@ EXPR_BIT_NOT
Definition: nasl_tree.h:60
@ EXPR_R_SHIFT
Definition: nasl_tree.h:64
@ EXPR_DIV
Definition: nasl_tree.h:53
@ COMP_RE_NOMATCH
Definition: nasl_tree.h:70
@ NODE_RETURN
Definition: nasl_tree.h:25
@ EXPR_BIT_XOR
Definition: nasl_tree.h:59
@ NODE_FOREACH
Definition: nasl_tree.h:18
@ NODE_IF_ELSE
Definition: nasl_tree.h:14
@ NODE_DIV_EQ
Definition: nasl_tree.h:38
@ NODE_MINUS_EQ
Definition: nasl_tree.h:36
@ COMP_NOMATCH
Definition: nasl_tree.h:68
@ COMP_MATCH
Definition: nasl_tree.h:67
@ EXPR_NOT
Definition: nasl_tree.h:47
@ EXPR_PLUS
Definition: nasl_tree.h:49
@ EXPR_L_SHIFT
Definition: nasl_tree.h:63
@ NODE_DECL
Definition: nasl_tree.h:23
@ CONST_STR
Definition: nasl_tree.h:80
@ EXPR_BIT_AND
Definition: nasl_tree.h:57
@ EXPR_EXPO
Definition: nasl_tree.h:55
@ EXPR_INCR
Definition: nasl_tree.h:61
@ NODE_INSTR_L
Definition: nasl_tree.h:15
@ EXPR_BIT_OR
Definition: nasl_tree.h:58
@ EXPR_U_MINUS
Definition: nasl_tree.h:51
@ COMP_LT
Definition: nasl_tree.h:72
@ EXPR_OR
Definition: nasl_tree.h:46
@ NODE_BREAK
Definition: nasl_tree.h:26
@ EXPR_DECR
Definition: nasl_tree.h:62
@ EXPR_R_USHIFT
Definition: nasl_tree.h:65
@ NODE_GLOBAL
Definition: nasl_tree.h:33
@ CONST_INT
Definition: nasl_tree.h:79
@ NODE_WHILE
Definition: nasl_tree.h:17
@ EXPR_MINUS
Definition: nasl_tree.h:50
@ NODE_MODULO_EQ
Definition: nasl_tree.h:39
@ EXPR_AND
Definition: nasl_tree.h:45
tree_cell * make_array_from_elems(tree_cell *el)
Definition: nasl_var.c:1323
Definition: nasl_tree.h:94
int include_order
Definition: nasl_tree.h:100
long int i_val
Definition: nasl_tree.h:104
char * name
Definition: nasl_tree.h:97
char * str_val
Definition: nasl_tree.h:103
unsigned int include_order
tree_cell * tree
char * buffer
tree_cell * node
long int num
struct YYSTYPE::asciiz data
YYSTYPE yyvs_alloc
yy_state_t yyss_alloc