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