OpenVAS Scanner 22.7.9
nasl_grammar.tab.c File Reference
#include <ctype.h>
#include <pcap.h>
#include <string.h>
#include <sys/stat.h>
#include <glib.h>
#include "../misc/plugutils.h"
#include "nasl_tree.h"
#include "nasl_global_ctxt.h"
#include "nasl_func.h"
#include "nasl_var.h"
#include "nasl_lex_ctxt.h"
#include "nasl_debug.h"
#include "nasl_signature.h"
#include "nasl_grammar.tab.h"
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <gvm/base/logging.h>
#include <gvm/base/prefs.h>
#include <libgen.h>
#include <gcrypt.h>
Include dependency graph for nasl_grammar.tab.c:

Go to the source code of this file.

Data Structures

union  yyalloc
 

Macros

#define YYBISON   30706
 
#define YYBISON_VERSION   "3.7.6"
 
#define YYSKELETON_NAME   "yacc.c"
 
#define YYPURE   1
 
#define YYPUSH   0
 
#define YYPULL   1
 
#define yyparse   naslparse
 
#define yylex   nasllex
 
#define yyerror   naslerror
 
#define yydebug   nasldebug
 
#define yynerrs   naslnerrs
 
#define YYPARSE_PARAM   parm
 
#define YYLEX_PARAM   parm
 
#define YYPARSE_ERRC   err_c
 
#define YYLEX_ERRC   err_c
 
#define LNB   (((naslctxt*)parm)->line_nb)
 
#define LN   (((naslctxt*)parm)->name)
 
#define ERRC   err_c
 
#define G_LOG_DOMAIN   "lib nasl"
 GLib logging domain.
 
#define YYERROR_VERBOSE
 
#define YY_CAST(Type, Val)   ((Type) (Val))
 
#define YY_REINTERPRET_CAST(Type, Val)   ((Type) (Val))
 
#define YY_NULLPTR   ((void*)0)
 
#define YYPTRDIFF_T   long
 
#define YYPTRDIFF_MAXIMUM   LONG_MAX
 
#define YYSIZE_T   unsigned
 
#define YYSIZE_MAXIMUM
 
#define YYSIZEOF(X)   YY_CAST (YYPTRDIFF_T, sizeof (X))
 
#define YY_(Msgid)   Msgid
 
#define YY_ATTRIBUTE_PURE
 
#define YY_ATTRIBUTE_UNUSED
 
#define YY_USE(E)   ((void) (E))
 
#define YY_INITIAL_VALUE(Value)   Value
 
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
 
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
 
#define YY_IGNORE_USELESS_CAST_BEGIN
 
#define YY_IGNORE_USELESS_CAST_END
 
#define YY_ASSERT(E)   ((void) (0 && (E)))
 
#define YYSTACK_ALLOC   YYMALLOC
 
#define YYSTACK_FREE   YYFREE
 
#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM
 
#define YYMALLOC   malloc
 
#define YYFREE   free
 
#define YYSTACK_GAP_MAXIMUM   (YYSIZEOF (union yyalloc) - 1)
 
#define YYSTACK_BYTES(N)
 
#define YYCOPY_NEEDED   1
 
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
 
#define YYCOPY(Dst, Src, Count)
 
#define YYFINAL   80
 
#define YYLAST   1009
 
#define YYNTOKENS   73
 
#define YYNNTS   43
 
#define YYNRULES   127
 
#define YYNSTATES   229
 
#define YYMAXUTOK   304
 
#define YYTRANSLATE(YYX)
 
#define YY_ACCESSING_SYMBOL(State)   YY_CAST (yysymbol_kind_t, yystos[State])
 
#define YYPACT_NINF   (-77)
 
#define yypact_value_is_default(Yyn)    ((Yyn) == YYPACT_NINF)
 
#define YYTABLE_NINF   (-70)
 
#define yytable_value_is_error(Yyn)    ((Yyn) == YYTABLE_NINF)
 
#define yyerrok   (yyerrstatus = 0)
 
#define yyclearin   (yychar = YYEMPTY)
 
#define YYACCEPT   goto yyacceptlab
 
#define YYABORT   goto yyabortlab
 
#define YYERROR   goto yyerrorlab
 
#define YYRECOVERING()   (!!yyerrstatus)
 
#define YYBACKUP(Token, Value)
 
#define YYERRCODE   YYUNDEF
 
#define YYFPRINTF   fprintf
 
#define YYDPRINTF(Args)
 
#define YY_LOCATION_PRINT(File, Loc)   ((void) 0)
 
#define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
 
#define YY_STACK_PRINT(Bottom, Top)
 
#define YY_REDUCE_PRINT(Rule)
 
#define YYINITDEPTH   200
 
#define YYMAXDEPTH   10000
 
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 

Typedefs

typedef enum yysymbol_kind_t yysymbol_kind_t
 
typedef signed char yytype_int8
 
typedef short yytype_int16
 
typedef unsigned char yytype_uint8
 
typedef unsigned short yytype_uint16
 
typedef yytype_uint8 yy_state_t
 
typedef int yy_state_fast_t
 

Enumerations

enum  yysymbol_kind_t {
  YYSYMBOL_YYEMPTY = -2 , YYSYMBOL_YYEOF = 0 , YYSYMBOL_YYerror = 1 , YYSYMBOL_YYUNDEF = 2 ,
  YYSYMBOL_IF = 3 , YYSYMBOL_ELSE = 4 , YYSYMBOL_EQ = 5 , YYSYMBOL_NEQ = 6 ,
  YYSYMBOL_SUPEQ = 7 , YYSYMBOL_INFEQ = 8 , YYSYMBOL_OR = 9 , YYSYMBOL_AND = 10 ,
  YYSYMBOL_MATCH = 11 , YYSYMBOL_NOMATCH = 12 , YYSYMBOL_REP = 13 , YYSYMBOL_FOR = 14 ,
  YYSYMBOL_REPEAT = 15 , YYSYMBOL_UNTIL = 16 , YYSYMBOL_FOREACH = 17 , YYSYMBOL_WHILE = 18 ,
  YYSYMBOL_BREAK = 19 , YYSYMBOL_CONTINUE = 20 , YYSYMBOL_FUNCTION = 21 , YYSYMBOL_RETURN = 22 ,
  YYSYMBOL_INCLUDE = 23 , YYSYMBOL_LOCAL = 24 , YYSYMBOL_GLOBAL = 25 , YYSYMBOL_PLUS_PLUS = 26 ,
  YYSYMBOL_MINUS_MINUS = 27 , YYSYMBOL_L_SHIFT = 28 , YYSYMBOL_R_SHIFT = 29 , YYSYMBOL_R_USHIFT = 30 ,
  YYSYMBOL_EXPO = 31 , YYSYMBOL_PLUS_EQ = 32 , YYSYMBOL_MINUS_EQ = 33 , YYSYMBOL_MULT_EQ = 34 ,
  YYSYMBOL_DIV_EQ = 35 , YYSYMBOL_MODULO_EQ = 36 , YYSYMBOL_L_SHIFT_EQ = 37 , YYSYMBOL_R_SHIFT_EQ = 38 ,
  YYSYMBOL_R_USHIFT_EQ = 39 , YYSYMBOL_RE_MATCH = 40 , YYSYMBOL_RE_NOMATCH = 41 , YYSYMBOL_ARROW = 42 ,
  YYSYMBOL_IDENT = 43 , YYSYMBOL_STRING1 = 44 , YYSYMBOL_STRING2 = 45 , YYSYMBOL_INTEGER = 46 ,
  YYSYMBOL_47_ = 47 , YYSYMBOL_48_ = 48 , YYSYMBOL_49_ = 49 , YYSYMBOL_50_ = 50 ,
  YYSYMBOL_51_ = 51 , YYSYMBOL_52_ = 52 , YYSYMBOL_53_ = 53 , YYSYMBOL_54_ = 54 ,
  YYSYMBOL_55_ = 55 , YYSYMBOL_56_ = 56 , YYSYMBOL_57_ = 57 , YYSYMBOL_NOT = 58 ,
  YYSYMBOL_UMINUS = 59 , YYSYMBOL_BIT_NOT = 60 , YYSYMBOL_61_ = 61 , YYSYMBOL_62_ = 62 ,
  YYSYMBOL_63_ = 63 , YYSYMBOL_64_ = 64 , YYSYMBOL_65_ = 65 , YYSYMBOL_66_ = 66 ,
  YYSYMBOL_67_ = 67 , YYSYMBOL_68_ = 68 , YYSYMBOL_69_ = 69 , YYSYMBOL_70_ = 70 ,
  YYSYMBOL_71_ = 71 , YYSYMBOL_72_ = 72 , YYSYMBOL_YYACCEPT = 73 , YYSYMBOL_tiptop = 74 ,
  YYSYMBOL_instr_decl_list = 75 , YYSYMBOL_instr_decl = 76 , YYSYMBOL_func_decl = 77 , YYSYMBOL_arg_decl = 78 ,
  YYSYMBOL_arg_decl_1 = 79 , YYSYMBOL_block = 80 , YYSYMBOL_instr_list = 81 , YYSYMBOL_instr = 82 ,
  YYSYMBOL_simple_instr = 83 , YYSYMBOL_ret = 84 , YYSYMBOL_if_block = 85 , YYSYMBOL_loop = 86 ,
  YYSYMBOL_for_loop = 87 , YYSYMBOL_while_loop = 88 , YYSYMBOL_repeat_loop = 89 , YYSYMBOL_foreach_loop = 90 ,
  YYSYMBOL_aff_func = 91 , YYSYMBOL_rep = 92 , YYSYMBOL_string = 93 , YYSYMBOL_inc = 94 ,
  YYSYMBOL_func_call = 95 , YYSYMBOL_arg_list = 96 , YYSYMBOL_arg_list_1 = 97 , YYSYMBOL_arg = 98 ,
  YYSYMBOL_aff = 99 , YYSYMBOL_lvalue = 100 , YYSYMBOL_identifier = 101 , YYSYMBOL_array_elem = 102 ,
  YYSYMBOL_array_index = 103 , YYSYMBOL_post_pre_incr = 104 , YYSYMBOL_expr = 105 , YYSYMBOL_const_array = 106 ,
  YYSYMBOL_list_array_data = 107 , YYSYMBOL_array_data = 108 , YYSYMBOL_atom = 109 , YYSYMBOL_simple_array_data = 110 ,
  YYSYMBOL_var = 111 , YYSYMBOL_var_name = 112 , YYSYMBOL_ipaddr = 113 , YYSYMBOL_loc = 114 ,
  YYSYMBOL_glob = 115
}
 
enum  { YYENOMEM = -2 }
 
enum  lex_state {
  ST_START = 0 , ST_SPACE , ST_IDENT , ST_ZERO ,
  ST_ZEROX , ST_OCT , ST_DEC , ST_HEX ,
  ST_COMMENT , ST_SUP , ST_INF , ST_SUP_EXCL ,
  ST_STRING1 , ST_STRING1_ESC , ST_STRING2 , ST_PLUS ,
  ST_MINUS , ST_MULT , ST_DIV , ST_MODULO ,
  ST_R_SHIFT , ST_R_USHIFT , ST_L_SHIFT , ST_NOT ,
  ST_EQ , ST_AND , ST_OR
}
 

Functions

static void naslerror (naslctxt *, int *, const char *)
 
static int nasllex (YYSTYPE *lvalp, void *parm, int *err_c)
 
void * malloc (YYSIZE_T)
 
void free (void *)
 
static const char * yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED
 
static void yy_symbol_value_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep, naslctxt *parm, int *err_c)
 
static void yy_symbol_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep, naslctxt *parm, int *err_c)
 
static void yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
 
static void yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule, naslctxt *parm, int *err_c)
 
static void yydestruct (const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, naslctxt *parm, int *err_c)
 
int yyparse (naslctxt *parm, int *err_c)
 
int add_nasl_inc_dir (const char *dir)
 Adds the given string as directory for searching for includes.
 
static void load_checksums (kb_t kb)
 
static char * file_checksum (const char *filename, int algorithm)
 Get the checksum of a file.
 
int init_nasl_ctx (naslctxt *pc, const char *name)
 Initialize a NASL context for a NASL file.
 
void nasl_clean_ctx (naslctxt *c)
 
void nasl_clean_inc (void)
 
int nasl_get_include_order (const char *c)
 
static int mylex (YYSTYPE *lvalp, void *parm)
 

Variables

static char * parse_buffer = NULL
 
static int parse_len = 0
 
static int include_order = 0
 
GHashTable * includes_hash = NULL
 
static const yytype_int8 yytranslate []
 
static const yytype_int16 yyrline []
 
static const char *const yytname []
 
static const yytype_int16 yypact []
 
static const yytype_int8 yydefact []
 
static const yytype_int16 yypgoto []
 
static const yytype_uint8 yydefgoto []
 
static const yytype_int16 yytable []
 
static const yytype_int16 yycheck []
 
static const yytype_int8 yystos []
 
static const yytype_int8 yyr1 []
 
static const yytype_int8 yyr2 []
 
int yydebug
 
static GSList * inc_dirs = NULL
 
static int checksum_algorithm = GCRY_MD_NONE
 

Macro Definition Documentation

◆ ERRC

#define ERRC   err_c

Definition at line 85 of file nasl_grammar.tab.c.

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "lib nasl"

GLib logging domain.

Definition at line 107 of file nasl_grammar.tab.c.

◆ LN

#define LN   (((naslctxt*)parm)->name)

Definition at line 84 of file nasl_grammar.tab.c.

◆ LNB

#define LNB   (((naslctxt*)parm)->line_nb)

Definition at line 83 of file nasl_grammar.tab.c.

◆ YY_

#define YY_ (   Msgid)    Msgid

Definition at line 399 of file nasl_grammar.tab.c.

◆ YY_ACCESSING_SYMBOL

#define YY_ACCESSING_SYMBOL (   State)    YY_CAST (yysymbol_kind_t, yystos[State])

Accessing symbol of state STATE.

Definition at line 671 of file nasl_grammar.tab.c.

◆ YY_ASSERT

#define YY_ASSERT (   E)    ((void) (0 && (E)))

Definition at line 459 of file nasl_grammar.tab.c.

◆ YY_ATTRIBUTE_PURE

#define YY_ATTRIBUTE_PURE

Definition at line 408 of file nasl_grammar.tab.c.

◆ YY_ATTRIBUTE_UNUSED

#define YY_ATTRIBUTE_UNUSED

Definition at line 416 of file nasl_grammar.tab.c.

◆ YY_CAST

#define YY_CAST (   Type,
  Val 
)    ((Type) (Val))

Definition at line 127 of file nasl_grammar.tab.c.

◆ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN

#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN

Definition at line 439 of file nasl_grammar.tab.c.

◆ YY_IGNORE_MAYBE_UNINITIALIZED_END

#define YY_IGNORE_MAYBE_UNINITIALIZED_END

Definition at line 440 of file nasl_grammar.tab.c.

◆ YY_IGNORE_USELESS_CAST_BEGIN

#define YY_IGNORE_USELESS_CAST_BEGIN

Definition at line 454 of file nasl_grammar.tab.c.

◆ YY_IGNORE_USELESS_CAST_END

#define YY_IGNORE_USELESS_CAST_END

Definition at line 455 of file nasl_grammar.tab.c.

◆ YY_INITIAL_VALUE

#define YY_INITIAL_VALUE (   Value)    Value

Definition at line 436 of file nasl_grammar.tab.c.

◆ YY_LOCATION_PRINT

#define YY_LOCATION_PRINT (   File,
  Loc 
)    ((void) 0)

Definition at line 1143 of file nasl_grammar.tab.c.

◆ YY_NULLPTR

#define YY_NULLPTR   ((void*)0)

Definition at line 139 of file nasl_grammar.tab.c.

◆ YY_REDUCE_PRINT

#define YY_REDUCE_PRINT (   Rule)
Value:
do { \
if (yydebug) \
yy_reduce_print (yyssp, yyvsp, Rule, parm, err_c); \
} while (0)
#define yydebug

Definition at line 1246 of file nasl_grammar.tab.c.

◆ YY_REINTERPRET_CAST

#define YY_REINTERPRET_CAST (   Type,
  Val 
)    ((Type) (Val))

Definition at line 128 of file nasl_grammar.tab.c.

◆ YY_STACK_PRINT

#define YY_STACK_PRINT (   Bottom,
  Top 
)
Value:
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (0)

Definition at line 1215 of file nasl_grammar.tab.c.

◆ YY_SYMBOL_PRINT

#define YY_SYMBOL_PRINT (   Title,
  Kind,
  Value,
  Location 
)
Value:
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
Kind, Value, parm, err_c); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)

Definition at line 1147 of file nasl_grammar.tab.c.

◆ YY_USE

#define YY_USE (   E)    ((void) (E))

Definition at line 422 of file nasl_grammar.tab.c.

◆ YYABORT

#define YYABORT   goto yyabortlab

Definition at line 1099 of file nasl_grammar.tab.c.

◆ YYACCEPT

#define YYACCEPT   goto yyacceptlab

Definition at line 1098 of file nasl_grammar.tab.c.

◆ YYBACKUP

#define YYBACKUP (   Token,
  Value 
)
Value:
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror (parm, err_c, YY_("syntax error: cannot back up")); \
} \
while (0)
#define YY_(Msgid)
#define YYERROR
@ YYEMPTY

Definition at line 1105 of file nasl_grammar.tab.c.

◆ YYBISON

#define YYBISON   30706

Definition at line 49 of file nasl_grammar.tab.c.

◆ YYBISON_VERSION

#define YYBISON_VERSION   "3.7.6"

Definition at line 52 of file nasl_grammar.tab.c.

◆ yyclearin

#define yyclearin   (yychar = YYEMPTY)

Definition at line 1096 of file nasl_grammar.tab.c.

◆ YYCOPY

#define YYCOPY (   Dst,
  Src,
  Count 
)
Value:
do \
{ \
YYPTRDIFF_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)
#define YYPTRDIFF_T

Definition at line 576 of file nasl_grammar.tab.c.

◆ YYCOPY_NEEDED

#define YYCOPY_NEEDED   1

Definition at line 548 of file nasl_grammar.tab.c.

◆ yydebug

#define yydebug   nasldebug

Definition at line 71 of file nasl_grammar.tab.c.

◆ YYDPRINTF

#define YYDPRINTF (   Args)
Value:
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
#define YYFPRINTF

Definition at line 1135 of file nasl_grammar.tab.c.

◆ YYERRCODE

#define YYERRCODE   YYUNDEF

Definition at line 1124 of file nasl_grammar.tab.c.

◆ yyerrok

#define yyerrok   (yyerrstatus = 0)

Definition at line 1095 of file nasl_grammar.tab.c.

◆ yyerror

#define yyerror   naslerror

Definition at line 70 of file nasl_grammar.tab.c.

◆ YYERROR

#define YYERROR   goto yyerrorlab

Definition at line 1100 of file nasl_grammar.tab.c.

◆ YYERROR_VERBOSE

#define YYERROR_VERBOSE

Definition at line 118 of file nasl_grammar.tab.c.

◆ YYFINAL

#define YYFINAL   80

Definition at line 589 of file nasl_grammar.tab.c.

◆ YYFPRINTF

#define YYFPRINTF   fprintf

Definition at line 1132 of file nasl_grammar.tab.c.

◆ YYFREE

#define YYFREE   free

Definition at line 520 of file nasl_grammar.tab.c.

◆ YYINITDEPTH

#define YYINITDEPTH   200

Definition at line 1265 of file nasl_grammar.tab.c.

◆ YYLAST

#define YYLAST   1009

Definition at line 591 of file nasl_grammar.tab.c.

◆ yylex

#define yylex   nasllex

Definition at line 69 of file nasl_grammar.tab.c.

◆ YYLEX_ERRC

#define YYLEX_ERRC   err_c

Definition at line 81 of file nasl_grammar.tab.c.

◆ YYLEX_PARAM

#define YYLEX_PARAM   parm

Definition at line 79 of file nasl_grammar.tab.c.

◆ YYMALLOC

#define YYMALLOC   malloc

Definition at line 514 of file nasl_grammar.tab.c.

◆ YYMAXDEPTH

#define YYMAXDEPTH   10000

Definition at line 1276 of file nasl_grammar.tab.c.

◆ YYMAXUTOK

#define YYMAXUTOK   304

Definition at line 603 of file nasl_grammar.tab.c.

◆ yynerrs

#define yynerrs   naslnerrs

Definition at line 72 of file nasl_grammar.tab.c.

◆ YYNNTS

#define YYNNTS   43

Definition at line 596 of file nasl_grammar.tab.c.

◆ YYNRULES

#define YYNRULES   127

Definition at line 598 of file nasl_grammar.tab.c.

◆ YYNSTATES

#define YYNSTATES   229

Definition at line 600 of file nasl_grammar.tab.c.

◆ YYNTOKENS

#define YYNTOKENS   73

Definition at line 594 of file nasl_grammar.tab.c.

◆ YYPACT_NINF

#define YYPACT_NINF   (-77)

Definition at line 725 of file nasl_grammar.tab.c.

◆ yypact_value_is_default

#define yypact_value_is_default (   Yyn)     ((Yyn) == YYPACT_NINF)

Definition at line 727 of file nasl_grammar.tab.c.

◆ yyparse

#define yyparse   naslparse

Definition at line 68 of file nasl_grammar.tab.c.

◆ YYPARSE_ERRC

#define YYPARSE_ERRC   err_c

Definition at line 80 of file nasl_grammar.tab.c.

◆ YYPARSE_PARAM

#define YYPARSE_PARAM   parm

Definition at line 78 of file nasl_grammar.tab.c.

◆ YYPOPSTACK

#define YYPOPSTACK (   N)    (yyvsp -= (N), yyssp -= (N))

◆ YYPTRDIFF_MAXIMUM

#define YYPTRDIFF_MAXIMUM   LONG_MAX

Definition at line 359 of file nasl_grammar.tab.c.

◆ YYPTRDIFF_T

#define YYPTRDIFF_T   long

Definition at line 358 of file nasl_grammar.tab.c.

◆ YYPULL

#define YYPULL   1

Definition at line 64 of file nasl_grammar.tab.c.

◆ YYPURE

#define YYPURE   1

Definition at line 58 of file nasl_grammar.tab.c.

◆ YYPUSH

#define YYPUSH   0

Definition at line 61 of file nasl_grammar.tab.c.

◆ YYRECOVERING

#define YYRECOVERING ( )    (!!yyerrstatus)

Definition at line 1103 of file nasl_grammar.tab.c.

◆ YYSIZE_MAXIMUM

#define YYSIZE_MAXIMUM
Value:
: YY_CAST (YYSIZE_T, -1)))
#define YYPTRDIFF_MAXIMUM
#define YY_CAST(Type, Val)
#define YYSIZE_T

Definition at line 376 of file nasl_grammar.tab.c.

◆ YYSIZE_T

#define YYSIZE_T   unsigned

Definition at line 372 of file nasl_grammar.tab.c.

◆ YYSIZEOF

#define YYSIZEOF (   X)    YY_CAST (YYPTRDIFF_T, sizeof (X))

Definition at line 382 of file nasl_grammar.tab.c.

◆ YYSKELETON_NAME

#define YYSKELETON_NAME   "yacc.c"

Definition at line 55 of file nasl_grammar.tab.c.

◆ YYSTACK_ALLOC

#define YYSTACK_ALLOC   YYMALLOC

Definition at line 500 of file nasl_grammar.tab.c.

◆ YYSTACK_ALLOC_MAXIMUM

#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM

Definition at line 503 of file nasl_grammar.tab.c.

◆ YYSTACK_BYTES

#define YYSTACK_BYTES (   N)
Value:
yytype_uint8 yy_state_t
#define YYSIZEOF(X)
#define YYSTACK_GAP_MAXIMUM

Definition at line 544 of file nasl_grammar.tab.c.

◆ YYSTACK_FREE

#define YYSTACK_FREE   YYFREE

Definition at line 501 of file nasl_grammar.tab.c.

◆ YYSTACK_GAP_MAXIMUM

#define YYSTACK_GAP_MAXIMUM   (YYSIZEOF (union yyalloc) - 1)

Definition at line 540 of file nasl_grammar.tab.c.

◆ YYSTACK_RELOCATE

#define YYSTACK_RELOCATE (   Stack_alloc,
  Stack 
)
Value:
do \
{ \
YYPTRDIFF_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / YYSIZEOF (*yyptr); \
} \
while (0)

Definition at line 555 of file nasl_grammar.tab.c.

◆ YYTABLE_NINF

#define YYTABLE_NINF   (-70)

Definition at line 730 of file nasl_grammar.tab.c.

◆ yytable_value_is_error

#define yytable_value_is_error (   Yyn)     ((Yyn) == YYTABLE_NINF)

Definition at line 732 of file nasl_grammar.tab.c.

◆ YYTRANSLATE

#define YYTRANSLATE (   YYX)
Value:
(0 <= (YYX) && (YYX) <= YYMAXUTOK \
static const yytype_int8 yytranslate[]
yysymbol_kind_t
@ YYSYMBOL_YYUNDEF
#define YYMAXUTOK

Definition at line 608 of file nasl_grammar.tab.c.

Typedef Documentation

◆ yy_state_fast_t

typedef int yy_state_fast_t

Definition at line 389 of file nasl_grammar.tab.c.

◆ yy_state_t

Definition at line 386 of file nasl_grammar.tab.c.

◆ yysymbol_kind_t

Definition at line 265 of file nasl_grammar.tab.c.

◆ yytype_int16

typedef short yytype_int16

Definition at line 310 of file nasl_grammar.tab.c.

◆ yytype_int8

typedef signed char yytype_int8

Definition at line 302 of file nasl_grammar.tab.c.

◆ yytype_uint16

typedef unsigned short yytype_uint16

Definition at line 342 of file nasl_grammar.tab.c.

◆ yytype_uint8

typedef unsigned char yytype_uint8

Definition at line 331 of file nasl_grammar.tab.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
YYENOMEM 

Definition at line 1093 of file nasl_grammar.tab.c.

1093{ YYENOMEM = -2 };
@ YYENOMEM

◆ lex_state

enum lex_state
Enumerator
ST_START 
ST_SPACE 
ST_IDENT 
ST_ZERO 
ST_ZEROX 
ST_OCT 
ST_DEC 
ST_HEX 
ST_COMMENT 
ST_SUP 
ST_INF 
ST_SUP_EXCL 
ST_STRING1 
ST_STRING1_ESC 
ST_STRING2 
ST_PLUS 
ST_MINUS 
ST_MULT 
ST_DIV 
ST_MODULO 
ST_R_SHIFT 
ST_R_USHIFT 
ST_L_SHIFT 
ST_NOT 
ST_EQ 
ST_AND 
ST_OR 

Definition at line 2839 of file nasl_grammar.tab.c.

2839 {
2840 ST_START = 0,
2841 ST_SPACE,
2842 ST_IDENT,
2843 ST_ZERO,
2844 ST_ZEROX,
2845 ST_OCT,
2846 ST_DEC,
2847 ST_HEX,
2848 ST_COMMENT,
2849 ST_SUP,
2850 ST_INF,
2852 ST_STRING1,
2854 ST_STRING2,
2855 ST_PLUS,
2856 ST_MINUS,
2857 ST_MULT,
2858 ST_DIV,
2859 ST_MODULO,
2860 ST_R_SHIFT,
2862 ST_L_SHIFT,
2863 ST_NOT,
2864 ST_EQ,
2865 ST_AND,
2866 ST_OR };
@ ST_INF
@ ST_ZERO
@ ST_MINUS
@ ST_STRING2
@ ST_DEC
@ ST_OR
@ ST_L_SHIFT
@ ST_ZEROX
@ ST_STRING1
@ ST_IDENT
@ ST_NOT
@ ST_MODULO
@ ST_HEX
@ ST_R_SHIFT
@ ST_SUP
@ ST_MULT
@ ST_SPACE
@ ST_OCT
@ ST_PLUS
@ ST_SUP_EXCL
@ ST_COMMENT
@ ST_DIV
@ ST_STRING1_ESC
@ ST_EQ
@ ST_R_USHIFT
@ ST_START
@ ST_AND

◆ yysymbol_kind_t

Enumerator
YYSYMBOL_YYEMPTY 
YYSYMBOL_YYEOF 
YYSYMBOL_YYerror 
YYSYMBOL_YYUNDEF 
YYSYMBOL_IF 
YYSYMBOL_ELSE 
YYSYMBOL_EQ 
YYSYMBOL_NEQ 
YYSYMBOL_SUPEQ 
YYSYMBOL_INFEQ 
YYSYMBOL_OR 
YYSYMBOL_AND 
YYSYMBOL_MATCH 
YYSYMBOL_NOMATCH 
YYSYMBOL_REP 
YYSYMBOL_FOR 
YYSYMBOL_REPEAT 
YYSYMBOL_UNTIL 
YYSYMBOL_FOREACH 
YYSYMBOL_WHILE 
YYSYMBOL_BREAK 
YYSYMBOL_CONTINUE 
YYSYMBOL_FUNCTION 
YYSYMBOL_RETURN 
YYSYMBOL_INCLUDE 
YYSYMBOL_LOCAL 
YYSYMBOL_GLOBAL 
YYSYMBOL_PLUS_PLUS 
YYSYMBOL_MINUS_MINUS 
YYSYMBOL_L_SHIFT 
YYSYMBOL_R_SHIFT 
YYSYMBOL_R_USHIFT 
YYSYMBOL_EXPO 
YYSYMBOL_PLUS_EQ 
YYSYMBOL_MINUS_EQ 
YYSYMBOL_MULT_EQ 
YYSYMBOL_DIV_EQ 
YYSYMBOL_MODULO_EQ 
YYSYMBOL_L_SHIFT_EQ 
YYSYMBOL_R_SHIFT_EQ 
YYSYMBOL_R_USHIFT_EQ 
YYSYMBOL_RE_MATCH 
YYSYMBOL_RE_NOMATCH 
YYSYMBOL_ARROW 
YYSYMBOL_IDENT 
YYSYMBOL_STRING1 
YYSYMBOL_STRING2 
YYSYMBOL_INTEGER 
YYSYMBOL_47_ 
YYSYMBOL_48_ 
YYSYMBOL_49_ 
YYSYMBOL_50_ 
YYSYMBOL_51_ 
YYSYMBOL_52_ 
YYSYMBOL_53_ 
YYSYMBOL_54_ 
YYSYMBOL_55_ 
YYSYMBOL_56_ 
YYSYMBOL_57_ 
YYSYMBOL_NOT 
YYSYMBOL_UMINUS 
YYSYMBOL_BIT_NOT 
YYSYMBOL_61_ 
YYSYMBOL_62_ 
YYSYMBOL_63_ 
YYSYMBOL_64_ 
YYSYMBOL_65_ 
YYSYMBOL_66_ 
YYSYMBOL_67_ 
YYSYMBOL_68_ 
YYSYMBOL_69_ 
YYSYMBOL_70_ 
YYSYMBOL_71_ 
YYSYMBOL_72_ 
YYSYMBOL_YYACCEPT 
YYSYMBOL_tiptop 
YYSYMBOL_instr_decl_list 
YYSYMBOL_instr_decl 
YYSYMBOL_func_decl 
YYSYMBOL_arg_decl 
YYSYMBOL_arg_decl_1 
YYSYMBOL_block 
YYSYMBOL_instr_list 
YYSYMBOL_instr 
YYSYMBOL_simple_instr 
YYSYMBOL_ret 
YYSYMBOL_if_block 
YYSYMBOL_loop 
YYSYMBOL_for_loop 
YYSYMBOL_while_loop 
YYSYMBOL_repeat_loop 
YYSYMBOL_foreach_loop 
YYSYMBOL_aff_func 
YYSYMBOL_rep 
YYSYMBOL_string 
YYSYMBOL_inc 
YYSYMBOL_func_call 
YYSYMBOL_arg_list 
YYSYMBOL_arg_list_1 
YYSYMBOL_arg 
YYSYMBOL_aff 
YYSYMBOL_lvalue 
YYSYMBOL_identifier 
YYSYMBOL_array_elem 
YYSYMBOL_array_index 
YYSYMBOL_post_pre_incr 
YYSYMBOL_expr 
YYSYMBOL_const_array 
YYSYMBOL_list_array_data 
YYSYMBOL_array_data 
YYSYMBOL_atom 
YYSYMBOL_simple_array_data 
YYSYMBOL_var 
YYSYMBOL_var_name 
YYSYMBOL_ipaddr 
YYSYMBOL_loc 
YYSYMBOL_glob 

Definition at line 145 of file nasl_grammar.tab.c.

146{
147 YYSYMBOL_YYEMPTY = -2,
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};
@ YYSYMBOL_repeat_loop
@ YYSYMBOL_68_
@ YYSYMBOL_UMINUS
@ YYSYMBOL_INCLUDE
@ YYSYMBOL_MINUS_MINUS
@ YYSYMBOL_const_array
@ 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

Function Documentation

◆ add_nasl_inc_dir()

int add_nasl_inc_dir ( const char *  dir)

Adds the given string as directory for searching for includes.

Parameters
dirA directory path. This function will add a copy of this parameter to the list of include folders. This means the parameter can be freed elsewhere without affecting the list.
Returns
0 in case of success. -1 if the stat on the given directory path was unsuccessful. -2 if the given directory path was not a directory.

Definition at line 2551 of file nasl_grammar.tab.c.

2552{
2553 if (dir == NULL)
2554 {
2555 return 0;
2556 }
2557
2558 // Allow initialization with empty element
2559 if (*dir == '\0')
2560 {
2561 inc_dirs = g_slist_append (inc_dirs, g_strdup((gchar *)dir));
2562 return 0;
2563 }
2564
2565 struct stat stat_buf;
2566
2567 if (stat (dir, &stat_buf) != 0)
2568 return -1;
2569
2570 if (S_ISDIR(stat_buf.st_mode) != 0)
2571 {
2572 inc_dirs = g_slist_append (inc_dirs, g_strdup((gchar *)dir));
2573 return 0;
2574 }
2575 else
2576 return -2;
2577}
static GSList * inc_dirs

References inc_dirs.

Referenced by include_dirs(), init_nasl_ctx(), and main().

Here is the caller graph for this function:

◆ file_checksum()

static char * file_checksum ( const char *  filename,
int  algorithm 
)
static

Get the checksum of a file.

Parameters
[in]filenamePath to file.
[in]algorithmLibgcrypt hash algorithm to use for generating the checksum.
Returns
checksum string, NULL otherwise.

Definition at line 2661 of file nasl_grammar.tab.c.

2662{
2663 char *content = NULL, digest[128], *result;
2664 size_t len = 0, i, alglen;
2665
2666 assert (algorithm == GCRY_MD_SHA256);
2667 if (!filename || !g_file_get_contents (filename, &content, &len, NULL))
2668 return NULL;
2669
2670 gcry_md_hash_buffer (algorithm, digest, content, len);
2671 alglen = gcry_md_get_algo_dlen (algorithm);
2672 result = g_malloc0 (alglen * 2 + 1);
2673 for (i = 0; i < alglen; i++)
2674 snprintf (result + 2 * i, 3, "%02x", (unsigned char) digest[i]);
2675 g_free (content);
2676
2677 return result;
2678}
uint8_t len

References len.

Referenced by init_nasl_ctx().

Here is the caller graph for this function:

◆ free()

◆ init_nasl_ctx()

int init_nasl_ctx ( naslctxt pc,
const char *  name 
)

Initialize a NASL context for a NASL file.

Parameters
pcThe NASL context handler.
nameThe filename of the NASL script.
Returns
0 in case of success. Then, file content is set in pc->buffer. -1 if either the filename was not found/accessible or the signature verification failed (provided signature checking is enabled. In any case, various elements of pc are modified (initialized);

Definition at line 2696 of file nasl_grammar.tab.c.

2697{
2698 char *full_name = NULL, key_path[2048], *checksum, *filename;
2699 GSList * inc_dir = inc_dirs; // iterator for include directories
2700 size_t flen = 0;
2701 time_t timestamp;
2702
2703 // initialize if not yet done (for openvas-server < 2.0.1)
2704 if (! inc_dirs) add_nasl_inc_dir("");
2705
2706 pc->line_nb = 1;
2707 pc->name = (char *) name;
2709 pc->tree = NULL;
2710 if (!parse_len)
2711 {
2712 parse_len = 9092;
2713 parse_buffer = g_malloc0 (parse_len);
2714 }
2715 else
2716 parse_buffer[0] = '\0';
2717
2718
2720 while (inc_dir != NULL) {
2721 if (full_name)
2722 g_free (full_name);
2723 full_name = g_build_filename(inc_dir->data, name, NULL);
2724
2725 if ((g_file_get_contents (full_name, &pc->buffer, &flen, NULL)))
2726 break;
2727
2728 inc_dir = g_slist_next(inc_dir);
2729 }
2730
2731 if (!full_name || !pc->buffer) {
2732 g_message ("%s: Not able to open nor to locate it in include paths",
2733 name);
2734 g_free(full_name);
2735 return -1;
2736 }
2737
2738 if (pc->always_signed)
2739 {
2740 g_free(full_name);
2741 return 0;
2742 }
2743 /* Cache the checksum of signature verified files, so that commonly included
2744 * files are not verified multiple times per scan. */
2745 if (strstr (full_name, ".inc"))
2746 filename = basename (full_name);
2747 else
2748 filename = full_name;
2749 snprintf (key_path, sizeof (key_path), "signaturecheck:%s", filename);
2750 timestamp = kb_item_get_int (pc->kb, key_path);
2751
2752 /* We never use the mtime of a .nasl/.inc file as integrity check during
2753 * the script load up. A complete verification is done in this case.
2754 * Once it has been uploaded in the nvticache it is enough to just check
2755 * the mtime. */
2756 if (timestamp > 0 && pc->exec_descr == 0)
2757 {
2758 struct stat file_stat;
2759
2760 if (stat (full_name, &file_stat) >= 0 && timestamp > file_stat.st_mtime)
2761 {
2762 /* Already checked. No need to check again. */
2763 g_free (full_name);
2764 return 0;
2765 }
2766 }
2767
2768 load_checksums (pc->kb);
2769 if (checksum_algorithm == GCRY_MD_NONE)
2770 return -1;
2771 else if (checksum_algorithm == GCRY_MD_SHA256)
2772 snprintf (key_path, sizeof (key_path), "sha256sums:%s", filename);
2773 else
2774 abort ();
2775 checksum = kb_item_get_str (pc->kb, key_path);
2776 if (!checksum)
2777 {
2778 g_warning ("No checksum for %s", full_name);
2779 g_free (full_name);
2780 return -1;
2781 }
2782 else
2783 {
2784 int ret;
2785 char *check = file_checksum (full_name, checksum_algorithm);
2786
2787 snprintf (key_path, sizeof (key_path), "signaturecheck:%s", filename);
2788 ret = strcmp (check, checksum);
2789 if (ret)
2790 {
2791 kb_del_items (pc->kb, key_path);
2792 g_warning ("checksum for %s not matching", full_name);
2793 }
2794 else
2795 {
2796 kb_del_items (pc->kb, key_path);
2797 kb_item_add_int (pc->kb, key_path, time (NULL));
2798 }
2799
2800 g_free (full_name);
2801 g_free (checksum);
2802 g_free (check);
2803 return ret;
2804 }
2805}
void nasl_set_filename(const char *filename)
Definition: nasl_debug.c:88
static char * file_checksum(const char *filename, int algorithm)
Get the checksum of a file.
static int checksum_algorithm
static char * parse_buffer
static int parse_len
int add_nasl_inc_dir(const char *dir)
Adds the given string as directory for searching for includes.
static int include_order
static void load_checksums(kb_t kb)
const char * name
Definition: nasl_init.c:411
unsigned int include_order
tree_cell * tree
char * buffer

References add_nasl_inc_dir(), naslctxt::always_signed, naslctxt::buffer, checksum_algorithm, naslctxt::exec_descr, file_checksum(), inc_dirs, naslctxt::include_order, include_order, naslctxt::kb, naslctxt::line_nb, load_checksums(), naslctxt::name, name, nasl_set_filename(), parse_buffer, parse_len, and naslctxt::tree.

Referenced by exec_nasl_script(), and yyparse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_checksums()

static void load_checksums ( kb_t  kb)
static

Definition at line 2582 of file nasl_grammar.tab.c.

2583{
2584 static int loaded = 0;
2585 const char *base, *prefix;
2586 char filename[2048], *fbuffer;
2587 FILE *file;
2588 size_t flen;
2589
2590 if (loaded)
2591 return;
2592 loaded = 1;
2593 base = prefs_get ("plugins_folder");
2594 snprintf (filename, sizeof (filename), "%s/sha256sums", base);
2595 if (g_file_get_contents (filename, &fbuffer, &flen, NULL))
2596 checksum_algorithm = GCRY_MD_SHA256;
2597 if (checksum_algorithm == GCRY_MD_NONE)
2598 {
2599 g_warning ("No plugins checksums file");
2600 return;
2601 }
2602 /* Verify checksum */
2603 if (nasl_verify_signature (filename, fbuffer, flen) != 0)
2604 {
2605 g_warning ("Erroneous or missing signature for checksums file %s",
2606 filename);
2607 g_free (fbuffer);
2608 return;
2609 }
2610 g_free (fbuffer);
2611
2612 /* Insert content into KB */
2613 file = fopen (filename, "r");
2614 if (!file)
2615 {
2616 g_warning ("%s: Couldn't read file %s", __func__, filename);
2617 return;
2618 }
2619 if (checksum_algorithm == GCRY_MD_SHA256)
2620 {
2621 kb_del_items (kb, "sha256sums:*");
2622 prefix = "sha256sums";
2623 }
2624 while (1)
2625 {
2626 char buffer[2048], **splits;
2627 if (!fgets (buffer, sizeof (buffer), file))
2628 break;
2629 if (strstr (buffer, ".asc")
2630 || (!strstr (buffer, ".inc") && !strstr (buffer, ".nasl")))
2631 continue;
2632 splits = g_strsplit (buffer, " ", -1);
2633 if (g_strv_length (splits) != 2)
2634 {
2635 g_warning ("%s: Erroneous checksum entry %s", __func__, buffer);
2636 g_strfreev (splits);
2637 break;
2638 }
2639 splits[1][strlen (splits[1]) - 1] = '\0';
2640 if (strstr (splits[1], ".inc"))
2641 g_snprintf (buffer, sizeof (buffer), "%s:%s", prefix,
2642 basename (splits[1]));
2643 else
2644 g_snprintf (buffer, sizeof (buffer), "%s:%s/%s", prefix, base,
2645 splits[1]);
2646 kb_item_set_str (kb, buffer, splits[0], 0);
2647 g_strfreev (splits);
2648 }
2649 fclose (file);
2650}
int nasl_verify_signature(const char *filename)
static void prefix(int n, int i)
Definition: nasl_tree.c:222

References checksum_algorithm, nasl_verify_signature(), and prefix().

Referenced by init_nasl_ctx().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ malloc()

void * malloc ( YYSIZE_T  )

Referenced by ipc_contexts_init(), and ipc_exec_as_process().

Here is the caller graph for this function:

◆ mylex()

static int mylex ( YYSTYPE lvalp,
void *  parm 
)
static

Definition at line 2869 of file nasl_grammar.tab.c.

2870{
2871 char *p;
2872 naslctxt *ctx = parm;
2873 int c, st = ST_START, len, r;
2874 long int x, i;
2875
2876 if (!ctx)
2877 return -1;
2878
2879 p = parse_buffer;
2880 len = 0;
2881
2882 while (1)
2883 {
2884 c = ctx->buffer[ctx->index++];
2885 if (c == '\0')
2886 break;
2887 if (c == '\n')
2888 ctx->line_nb ++;
2889
2890 switch(st)
2891 {
2892 case ST_START:
2893 if (c == '#')
2894 st = ST_COMMENT;
2895 else if (isalpha(c) || c == '_')
2896 {
2897 st = ST_IDENT;
2898 *p++ = c;
2899 len ++;
2900 }
2901 else if (isspace(c))
2902 st = ST_SPACE;
2903 else if (c == '0')
2904 st = ST_ZERO;
2905 else if (isdigit(c))
2906 {
2907 st = ST_DEC;
2908 *p++ = c;
2909 len ++;
2910 }
2911 else if (c == '\'')
2912 st = ST_STRING1;
2913 else if (c == '"')
2914 st = ST_STRING2;
2915 else if (c == '+')
2916 st = ST_PLUS;
2917 else if (c == '-')
2918 st = ST_MINUS;
2919 else if (c == '*')
2920 st = ST_MULT;
2921 else if (c == '/')
2922 st = ST_DIV;
2923 else if (c == '%')
2924 st = ST_MODULO;
2925 else if (c == '>')
2926 st = ST_SUP;
2927 else if (c == '<')
2928 st = ST_INF;
2929 else if (c == '=')
2930 st = ST_EQ;
2931 else if (c == '|')
2932 st = ST_OR;
2933 else if (c == '!')
2934 st = ST_NOT;
2935 else if (c == '&')
2936 st = ST_AND;
2937 else
2938 {
2939 return c;
2940 }
2941 break;
2942
2943 case ST_STRING2:
2944 if (c == '"')
2945 goto exit_loop;
2946 *p++ = c;
2947 len ++;
2948 break;
2949
2950 case ST_STRING1:
2951 if (c == '\'')
2952 goto exit_loop;
2953 else if (c == '\\')
2954 {
2955 c = ctx->buffer[ctx->index++];
2956 if (c == '\0')
2957 {
2958 nasl_perror(NULL, "Unfinished string\n");
2959 goto exit_loop; /* parse error? */
2960 }
2961 switch (c)
2962 {
2963 case '\n': /* escaped end of line */
2964 ctx->line_nb ++;
2965 break;
2966 case '\\':
2967 *p++ ='\\'; len ++;
2968 break;
2969 case 'n':
2970 *p++ = '\n'; len++;
2971 break;
2972 case 'f':
2973 *p++ = '\f'; len ++;
2974 break;
2975 case 't':
2976 *p++ = '\t'; len ++;
2977 break;
2978 case 'r':
2979 *p++ = '\r'; len++;
2980 break;
2981 case 'v':
2982 *p++ = '\v'; len ++;
2983 break;
2984 case '"':
2985 *p ++ = '"'; len ++;
2986 break;
2987 /* Not yet, as we do not return the length of the string */
2988 case '0':
2989 *p++ = '\0'; len++;
2990 break;
2991 case '\'':
2992 *p++ = '\''; len++;
2993 break;
2994
2995 case 'x':
2996 x = 0;
2997 for (i = 0; i < 2; i ++)
2998 {
2999 c = ctx->buffer[ctx->index++];
3000 if (c == '\0')
3001 {
3002 nasl_perror(NULL, "Unfinished \\x escape sequence (EOF)\n");
3003 goto exit_loop;
3004 }
3005 if (c == '\n')
3006 ctx->line_nb ++;
3007
3008 c = tolower(c);
3009 if (c >= '0' && c <= '9')
3010 x = x * 16 + (c - '0');
3011 else if (c >= 'a' && c <= 'f')
3012 x = x * 16 + 10 + (c - 'a');
3013 else
3014 {
3015 nasl_perror(NULL, "Unfinished \\x escape sequence\n");
3016 ctx->index--;
3017 if (c == '\n')
3018 ctx->line_nb --;
3019 break;
3020 }
3021 }
3022 *p++ = x; len ++;
3023 break;
3024
3025 default:
3026 nasl_perror(NULL, "Unknown escape sequence \\%c\n", c);
3027 ctx->index--;
3028 goto exit_loop;
3029 }
3030 }
3031 else
3032 {
3033 *p++ = c;
3034 len ++;
3035 }
3036 break;
3037
3038 case ST_IDENT:
3039 if (isalnum(c) || c == '_')
3040 {
3041 st = ST_IDENT;
3042 *p++ = c;
3043 len ++;
3044 }
3045 else
3046 {
3047 ctx->index--;
3048 if (c == '\n')
3049 ctx->line_nb --;
3050 goto exit_loop;
3051 }
3052 break;
3053
3054 case ST_ZERO:
3055 if (c == 'x' || c == 'X')
3056 st = ST_ZEROX;
3057 else if (isdigit(c))
3058 {
3059 if (c <= '7')
3060 st = ST_OCT;
3061 else
3062 st = ST_DEC;
3063 *p ++ = c;
3064 len ++;
3065 }
3066 else
3067 {
3068 ctx->index--;
3069 if (c == '\n')
3070 ctx->line_nb --;
3071 goto exit_loop;
3072 }
3073 break;
3074
3075 case ST_ZEROX:
3076 if (isxdigit(c))
3077 {
3078 st = ST_HEX;
3079 *p++ = c;
3080 len ++;
3081 }
3082 else
3083 {
3084 /* This should be a parse error */
3085 ctx->index--;
3086 if (c == '\n')
3087 ctx->line_nb --;
3088 goto exit_loop;
3089 }
3090 break;
3091
3092 case ST_OCT:
3093 if (c >= '0')
3094 {
3095 if (c <= '7')
3096 {
3097 *p++ = c;
3098 len ++;
3099 break;
3100 }
3101 else if (c <= '9')
3102 {
3103 *p++ = c;
3104 len ++;
3105 st = ST_DEC;
3106 break;
3107 }
3108 }
3109 ctx->index--;
3110 if (c == '\n')
3111 ctx->line_nb --;
3112 goto exit_loop;
3113
3114 case ST_DEC:
3115 if (isdigit(c))
3116 {
3117 *p++ = c;
3118 len ++;
3119 }
3120 else
3121 {
3122 ctx->index--;
3123 if (c == '\n')
3124 ctx->line_nb --;
3125 goto exit_loop;
3126 }
3127 break;
3128
3129 case ST_HEX:
3130 if (isxdigit(c))
3131 {
3132 *p++ = c;
3133 len ++;
3134 }
3135 else
3136 {
3137 ctx->index--;
3138 if (c == '\n')
3139 ctx->line_nb --;
3140 goto exit_loop;
3141 }
3142 break;
3143
3144 case ST_SPACE:
3145 if (! isspace(c))
3146 {
3147 ctx->index--;
3148 if (c == '\n')
3149 ctx->line_nb --;
3150 st = ST_START;
3151 }
3152 break;
3153
3154 case ST_COMMENT:
3155 if (c == '\n')
3156 st = ST_START;
3157 break;
3158
3159 case ST_SUP_EXCL:
3160 if (c == '<')
3161 return NOMATCH;
3162 else
3163 {
3164 ctx->index--;
3165 if (c == '\n')
3166 ctx->line_nb --;
3167 if (! isprint(c)) c = '.';
3168 g_message ("lexer error: invalid token >!%c "
3169 "parsed as >!< %c", c, c);
3170 return NOMATCH;
3171 }
3172 break;
3173
3174 case ST_SUP:
3175 if (c == '=')
3176 return SUPEQ;
3177 else if (c == '<')
3178 return MATCH;
3179 else if (c == '>')
3180 st = ST_R_SHIFT;
3181 else if (c == '!')
3182 st = ST_SUP_EXCL;
3183 else
3184 {
3185 ctx->index--;
3186 if (c == '\n')
3187 ctx->line_nb --;
3188 return '>';
3189 }
3190 break;
3191
3192 case ST_INF:
3193 if (c == '=')
3194 return INFEQ;
3195 else if (c == '<')
3196 st = ST_L_SHIFT;
3197 else
3198 {
3199 ctx->index--;
3200 if (c == '\n')
3201 ctx->line_nb --;
3202 return '<';
3203 }
3204 break;
3205
3206 case ST_R_SHIFT:
3207 if (c == '=')
3208 return R_SHIFT_EQ;
3209 else if (c == '>')
3210 st = ST_R_USHIFT;
3211 else
3212 {
3213 ctx->index--;
3214 if (c == '\n')
3215 ctx->line_nb --;
3216 return R_SHIFT;
3217 }
3218 /*NOTREACHED*/
3219 break;
3220
3221 case ST_R_USHIFT:
3222 if (c == '=')
3223 return R_USHIFT_EQ;
3224 else
3225 {
3226 ctx->index--;
3227 if (c == '\n')
3228 ctx->line_nb --;
3229 return R_USHIFT;
3230 }
3231 /*NOTREACHED*/
3232 break;
3233
3234 case ST_L_SHIFT:
3235 if (c == '=')
3236 return L_SHIFT_EQ;
3237 else
3238 {
3239 ctx->index--;
3240 if (c == '\n')
3241 ctx->line_nb --;
3242 return L_SHIFT;
3243 }
3244 /*NOTREACHED*/
3245 break;
3246
3247 case ST_AND:
3248 if (c == '&')
3249 return AND;
3250 ctx->index--;
3251 if (c == '\n')
3252 ctx->line_nb --;
3253 return '&';
3254
3255 case ST_OR:
3256 if (c == '|')
3257 return OR;
3258 ctx->index--;
3259 if (c == '\n')
3260 ctx->line_nb --;
3261 return '|';
3262
3263 case ST_NOT:
3264 if (c == '=')
3265 return NEQ;
3266 else if (c == '~')
3267 return RE_NOMATCH;
3268 ctx->index--;
3269 if (c == '\n')
3270 ctx->line_nb --;
3271 return '!';
3272
3273 case ST_EQ:
3274 if (c == '=')
3275 return EQ;
3276 else if (c == '~')
3277 return RE_MATCH;
3278 else if (c == '>')
3279 return ARROW;
3280 ctx->index--;
3281 if (c == '\n')
3282 ctx->line_nb --;
3283 return '=';
3284
3285 case ST_PLUS:
3286 if (c == '+')
3287 return PLUS_PLUS;
3288 else if (c == '=')
3289 return PLUS_EQ;
3290
3291 ctx->index--;
3292 if (c == '\n')
3293 ctx->line_nb --;
3294 return '+';
3295
3296 case ST_MINUS:
3297 if (c == '-')
3298 return MINUS_MINUS;
3299 else if (c == '=')
3300 return MINUS_EQ;
3301
3302 ctx->index--;
3303 if (c == '\n')
3304 ctx->line_nb --;
3305 return '-';
3306
3307 case ST_MULT:
3308 if (c == '=')
3309 return MULT_EQ;
3310 else if (c == '*')
3311 return EXPO;
3312 ctx->index--;
3313 if (c == '\n')
3314 ctx->line_nb --;
3315 return '*';
3316
3317 case ST_DIV:
3318 if (c == '=')
3319 return DIV_EQ;
3320
3321 ctx->index--;
3322 if (c == '\n')
3323 ctx->line_nb --;
3324 return '/';
3325
3326 case ST_MODULO:
3327 if (c == '=')
3328 return MODULO_EQ;
3329
3330 ctx->index--;
3331 if (c == '\n')
3332 ctx->line_nb --;
3333 return '%';
3334
3335 }
3336
3337 if (len >= parse_len)
3338 {
3339 int offs = p - parse_buffer;
3340 parse_len += 9092;
3341 parse_buffer = g_realloc (parse_buffer, parse_len);
3342 p = parse_buffer + offs;
3343 }
3344 }
3345
3346 exit_loop:
3347 parse_buffer[len] = '\0';
3348 switch (st)
3349 {
3350 case ST_START:
3351 case ST_COMMENT:
3352 case ST_SPACE:
3353 return 0;
3354
3355 case ST_STRING2:
3356 r = STRING2;
3357 lvalp->str = g_strdup (parse_buffer);
3358 return r;
3359
3360 case ST_STRING1:
3361 r = STRING1;
3362 lvalp->data.val = g_malloc0 (len+2);
3363 memcpy (lvalp->data.val, parse_buffer, len + 1);
3364 lvalp->data.len = len;
3365 return r;
3366
3367 case ST_IDENT:
3368 if (strcmp (parse_buffer, "if") == 0)
3369 r = IF;
3370 else if (strcmp (parse_buffer, "else") == 0)
3371 r = ELSE;
3372 else if (strcmp (parse_buffer, "for") == 0)
3373 r = FOR;
3374 else if (strcmp (parse_buffer, "while") == 0)
3375 r = WHILE;
3376 else if (strcmp (parse_buffer, "repeat") == 0)
3377 r = REPEAT;
3378 else if (strcmp (parse_buffer, "until") == 0)
3379 r = UNTIL;
3380 else if (strcmp (parse_buffer, "foreach") == 0)
3381 r = FOREACH;
3382 else if (strcmp (parse_buffer, "function") == 0)
3383 r = FUNCTION;
3384 else if (strcmp (parse_buffer, "return") == 0)
3385 r = RETURN;
3386 else if (strcmp (parse_buffer, "x") == 0)
3387 r = REP;
3388 else if (strcmp (parse_buffer, "include") == 0)
3389 r = INCLUDE;
3390 else if (strcmp (parse_buffer, "break") == 0)
3391 r = BREAK;
3392 else if (strcmp (parse_buffer, "continue") == 0)
3393 r = CONTINUE;
3394 else if (strcmp (parse_buffer, "local_var") == 0)
3395 r = LOCAL;
3396 else if (strcmp (parse_buffer, "global_var") == 0)
3397 r = GLOBAL;
3398 else
3399 {
3400 r = IDENT;
3401 lvalp->str = g_strdup (parse_buffer);
3402 return r;
3403 }
3404 return r;
3405
3406 case ST_DEC:
3407 /* -123 is parsed as "-" and "123" so that we can write "4-2" without
3408 * inserting a white space after the minus operator
3409 * Note that strtoul would also work on negative integers */
3410 lvalp->num = x = strtoul (parse_buffer, NULL, 10);
3411 return INTEGER;
3412
3413 case ST_OCT:
3414 lvalp->num = x = strtoul (parse_buffer, NULL, 8);
3415 return INTEGER;
3416
3417 case ST_HEX:
3418 lvalp->num = x = strtoul (parse_buffer, NULL, 16);
3419 return INTEGER;
3420
3421 case ST_ZEROX:
3422 nasl_perror(NULL, "Invalid token 0x parsed as 0 at line %d\n",
3423 ctx->line_nb);
3424 /* fallthrough */
3425 case ST_ZERO:
3426 lvalp->num = 0;
3427 return INTEGER;
3428 default:
3429 abort();
3430 }
3431}
void nasl_perror(lex_ctxt *lexic, char *msg,...)
Definition: nasl_debug.c:111
@ MINUS_EQ
@ PLUS_PLUS
@ R_SHIFT_EQ
@ MATCH
@ DIV_EQ
@ IF
@ MINUS_MINUS
@ R_SHIFT
@ INCLUDE
@ MODULO_EQ
@ WHILE
@ RE_NOMATCH
@ CONTINUE
@ PLUS_EQ
@ RETURN
@ ARROW
@ INTEGER
@ INFEQ
@ FOREACH
@ NOMATCH
@ EXPO
@ L_SHIFT
@ AND
@ R_USHIFT
@ ELSE
@ BREAK
@ OR
@ REPEAT
@ STRING1
@ EQ
@ UNTIL
@ FOR
@ R_USHIFT_EQ
@ FUNCTION
@ NEQ
@ L_SHIFT_EQ
@ REP
@ LOCAL
@ MULT_EQ
@ RE_MATCH
@ STRING2
@ SUPEQ
@ IDENT
@ GLOBAL
long int num
struct YYSTYPE::asciiz data

References AND, ARROW, BREAK, naslctxt::buffer, CONTINUE, YYSTYPE::data, DIV_EQ, ELSE, EQ, EXPO, FOR, FOREACH, FUNCTION, GLOBAL, IDENT, IF, INCLUDE, naslctxt::index, INFEQ, INTEGER, L_SHIFT, L_SHIFT_EQ, YYSTYPE::asciiz::len, len, naslctxt::line_nb, LOCAL, MATCH, MINUS_EQ, MINUS_MINUS, MODULO_EQ, MULT_EQ, nasl_perror(), NEQ, NOMATCH, YYSTYPE::num, OR, parse_buffer, parse_len, PLUS_EQ, PLUS_PLUS, R_SHIFT, R_SHIFT_EQ, R_USHIFT, R_USHIFT_EQ, RE_MATCH, RE_NOMATCH, REP, REPEAT, RETURN, ST_AND, ST_COMMENT, ST_DEC, ST_DIV, ST_EQ, ST_HEX, ST_IDENT, ST_INF, ST_L_SHIFT, ST_MINUS, ST_MODULO, ST_MULT, ST_NOT, ST_OCT, ST_OR, ST_PLUS, ST_R_SHIFT, ST_R_USHIFT, ST_SPACE, ST_START, ST_STRING1, ST_STRING2, ST_SUP, ST_SUP_EXCL, ST_ZERO, ST_ZEROX, YYSTYPE::str, STRING1, STRING2, SUPEQ, UNTIL, YYSTYPE::asciiz::val, and WHILE.

Referenced by nasllex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nasl_clean_ctx()

void nasl_clean_ctx ( naslctxt c)

Definition at line 2808 of file nasl_grammar.tab.c.

2809{
2810 deref_cell(c->tree);
2811 g_free (c->buffer);
2812}
void deref_cell(tree_cell *c)
Definition: nasl_tree.c:181

References naslctxt::buffer, deref_cell(), and naslctxt::tree.

Referenced by exec_nasl_script().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nasl_clean_inc()

void nasl_clean_inc ( void  )

Definition at line 2818 of file nasl_grammar.tab.c.

2819{
2820 if (!includes_hash)
2821 return;
2822 g_hash_table_destroy (includes_hash);
2823 includes_hash = NULL;
2824}
GHashTable * includes_hash

References includes_hash.

Referenced by plugins_reload_from_dir().

Here is the caller graph for this function:

◆ nasl_get_include_order()

int nasl_get_include_order ( const char *  c)

Definition at line 2827 of file nasl_grammar.tab.c.

2828{
2829 tree_cell *ctx;
2830 if (!includes_hash)
2831 return -2;
2832
2833 if ((ctx = g_hash_table_lookup (includes_hash, c))) {
2834 return ctx->include_order;
2835 }
2836 return -1;
2837}
Definition: nasl_tree.h:94
int include_order
Definition: nasl_tree.h:100

References TC::include_order, and includes_hash.

Referenced by check_called_files(), and nasl_lint_call().

Here is the caller graph for this function:

◆ naslerror()

static void naslerror ( naslctxt parm,
int *  error_counter,
const char *  s 
)
static

Definition at line 2526 of file nasl_grammar.tab.c.

2527{
2528 (void) parm;
2529 (*error_counter)++;
2530 g_message ("Parse error at or near line %d:", LNB);
2531 g_message (" %s", s);
2532}
#define LNB

References LNB.

◆ nasllex()

static int nasllex ( YYSTYPE lvalp,
void *  parm,
int *  err_c 
)
static

Definition at line 3434 of file nasl_grammar.tab.c.

3435{
3436 #pragma GCC diagnostic push
3437 #pragma GCC diagnostic ignored "-Wunused-parameter"
3438 (void) err_c;
3439 #pragma GCC diagnostic pop
3440 int x = mylex (lvalp, parm);
3441 return x;
3442}
static int mylex(YYSTYPE *lvalp, void *parm)

References mylex().

Here is the call graph for this function:

◆ yy_reduce_print()

static void yy_reduce_print ( yy_state_t yyssp,
YYSTYPE yyvsp,
int  yyrule,
naslctxt parm,
int *  err_c 
)
static

Definition at line 1227 of file nasl_grammar.tab.c.

1229{
1230 int yylno = yyrline[yyrule];
1231 int yynrhs = yyr2[yyrule];
1232 int yyi;
1233 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1234 yyrule - 1, yylno);
1235 /* The symbols being reduced. */
1236 for (yyi = 0; yyi < yynrhs; yyi++)
1237 {
1238 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1239 yy_symbol_print (stderr,
1240 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1241 &yyvsp[(yyi + 1) - (yynrhs)], parm, err_c);
1242 YYFPRINTF (stderr, "\n");
1243 }
1244}
static const yytype_int16 yyrline[]
#define YY_ACCESSING_SYMBOL(State)
static const yytype_int8 yyr2[]
static void yy_symbol_print(FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep, naslctxt *parm, int *err_c)

References YY_ACCESSING_SYMBOL, yy_symbol_print(), YYFPRINTF, yyr2, and yyrline.

Here is the call graph for this function:

◆ yy_stack_print()

static void yy_stack_print ( yy_state_t yybottom,
yy_state_t yytop 
)
static

Definition at line 1204 of file nasl_grammar.tab.c.

1205{
1206 YYFPRINTF (stderr, "Stack now");
1207 for (; yybottom <= yytop; yybottom++)
1208 {
1209 int yybot = *yybottom;
1210 YYFPRINTF (stderr, " %d", yybot);
1211 }
1212 YYFPRINTF (stderr, "\n");
1213}

References YYFPRINTF.

◆ yy_symbol_print()

static void yy_symbol_print ( FILE *  yyo,
yysymbol_kind_t  yykind,
YYSTYPE const *const  yyvaluep,
naslctxt parm,
int *  err_c 
)
static

Definition at line 1188 of file nasl_grammar.tab.c.

1190{
1191 YYFPRINTF (yyo, "%s %s (",
1192 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1193
1194 yy_symbol_value_print (yyo, yykind, yyvaluep, parm, err_c);
1195 YYFPRINTF (yyo, ")");
1196}
static const char * yysymbol_name(yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED
#define YYNTOKENS
static void yy_symbol_value_print(FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep, naslctxt *parm, int *err_c)

References yy_symbol_value_print(), YYFPRINTF, YYNTOKENS, and yysymbol_name().

Referenced by yy_reduce_print().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yy_symbol_value_print()

static void yy_symbol_value_print ( FILE *  yyo,
yysymbol_kind_t  yykind,
YYSTYPE const *const  yyvaluep,
naslctxt parm,
int *  err_c 
)
static

Definition at line 1164 of file nasl_grammar.tab.c.

1166{
1167 FILE *yyoutput = yyo;
1168 YY_USE (yyoutput);
1169 YY_USE (parm);
1170 YY_USE (err_c);
1171 if (!yyvaluep)
1172 return;
1173# ifdef YYPRINT
1174 if (yykind < YYNTOKENS)
1175 YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
1176# endif
1178 YY_USE (yykind);
1180}
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
#define YY_USE(E)

References YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END, YY_USE, and YYNTOKENS.

Referenced by yy_symbol_print().

Here is the caller graph for this function:

◆ yydestruct()

static void yydestruct ( const char *  yymsg,
yysymbol_kind_t  yykind,
YYSTYPE yyvaluep,
naslctxt parm,
int *  err_c 
)
static

Definition at line 1289 of file nasl_grammar.tab.c.

1291{
1292 YY_USE (yyvaluep);
1293 YY_USE (parm);
1294 YY_USE (err_c);
1295 if (!yymsg)
1296 yymsg = "Deleting";
1297 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1298
1300 YY_USE (yykind);
1302}
#define YY_SYMBOL_PRINT(Title, Kind, Value, Location)

References YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END, YY_SYMBOL_PRINT, and YY_USE.

Referenced by yyparse().

Here is the caller graph for this function:

◆ yyparse()

int yyparse ( naslctxt parm,
int *  err_c 
)

Definition at line 1314 of file nasl_grammar.tab.c.

1315{
1316/* Lookahead token kind. */
1317int yychar;
1318
1319
1320/* The semantic value of the lookahead symbol. */
1321/* Default value used for initialization, for pacifying older GCCs
1322 or non-GCC compilers. */
1323YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1324YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1325
1326 /* Number of syntax errors so far. */
1327 int yynerrs = 0;
1328
1329 yy_state_fast_t yystate = 0;
1330 /* Number of tokens to shift before error messages enabled. */
1331 int yyerrstatus = 0;
1332
1333 /* Refer to the stacks through separate pointers, to allow yyoverflow
1334 to reallocate them elsewhere. */
1335
1336 /* Their size. */
1337 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1338
1339 /* The state stack: array, bottom, top. */
1340 yy_state_t yyssa[YYINITDEPTH];
1341 yy_state_t *yyss = yyssa;
1342 yy_state_t *yyssp = yyss;
1343
1344 /* The semantic value stack: array, bottom, top. */
1345 YYSTYPE yyvsa[YYINITDEPTH];
1346 YYSTYPE *yyvs = yyvsa;
1347 YYSTYPE *yyvsp = yyvs;
1348
1349 int yyn;
1350 /* The return value of yyparse. */
1351 int yyresult;
1352 /* Lookahead symbol kind. */
1354 /* The variables used to return semantic value and location from the
1355 action routines. */
1356 YYSTYPE yyval;
1357
1358
1359
1360#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1361
1362 /* The number of symbols on the RHS of the reduced rule.
1363 Keep to zero when no symbol should be popped. */
1364 int yylen = 0;
1365
1366 YYDPRINTF ((stderr, "Starting parse\n"));
1367
1368 yychar = YYEMPTY; /* Cause a token to be read. */
1369 goto yysetstate;
1370
1371
1372/*------------------------------------------------------------.
1373| yynewstate -- push a new state, which is found in yystate. |
1374`------------------------------------------------------------*/
1375yynewstate:
1376 /* In all cases, when you get here, the value and location stacks
1377 have just been pushed. So pushing a state here evens the stacks. */
1378 yyssp++;
1379
1380
1381/*--------------------------------------------------------------------.
1382| yysetstate -- set current state (the top of the stack) to yystate. |
1383`--------------------------------------------------------------------*/
1384yysetstate:
1385 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1386 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1388 *yyssp = YY_CAST (yy_state_t, yystate);
1390 YY_STACK_PRINT (yyss, yyssp);
1391
1392 if (yyss + yystacksize - 1 <= yyssp)
1393#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1394 goto yyexhaustedlab;
1395#else
1396 {
1397 /* Get the current used size of the three stacks, in elements. */
1398 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1399
1400# if defined yyoverflow
1401 {
1402 /* Give user a chance to reallocate the stack. Use copies of
1403 these so that the &'s don't force the real ones into
1404 memory. */
1405 yy_state_t *yyss1 = yyss;
1406 YYSTYPE *yyvs1 = yyvs;
1407
1408 /* Each stack pointer address is followed by the size of the
1409 data in use in that stack, in bytes. This used to be a
1410 conditional around just the two extra args, but that might
1411 be undefined if yyoverflow is a macro. */
1412 yyoverflow (YY_("memory exhausted"),
1413 &yyss1, yysize * YYSIZEOF (*yyssp),
1414 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1415 &yystacksize);
1416 yyss = yyss1;
1417 yyvs = yyvs1;
1418 }
1419# else /* defined YYSTACK_RELOCATE */
1420 /* Extend the stack our own way. */
1421 if (YYMAXDEPTH <= yystacksize)
1422 goto yyexhaustedlab;
1423 yystacksize *= 2;
1424 if (YYMAXDEPTH < yystacksize)
1425 yystacksize = YYMAXDEPTH;
1426
1427 {
1428 yy_state_t *yyss1 = yyss;
1429 union yyalloc *yyptr =
1430 YY_CAST (union yyalloc *,
1431 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1432 if (! yyptr)
1433 goto yyexhaustedlab;
1436# undef YYSTACK_RELOCATE
1437 if (yyss1 != yyssa)
1438 YYSTACK_FREE (yyss1);
1439 }
1440# endif
1441
1442 yyssp = yyss + yysize - 1;
1443 yyvsp = yyvs + yysize - 1;
1444
1446 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1447 YY_CAST (long, yystacksize)));
1449
1450 if (yyss + yystacksize - 1 <= yyssp)
1451 YYABORT;
1452 }
1453#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1454
1455 if (yystate == YYFINAL)
1456 YYACCEPT;
1457
1458 goto yybackup;
1459
1460
1461/*-----------.
1462| yybackup. |
1463`-----------*/
1464yybackup:
1465 /* Do appropriate processing given the current state. Read a
1466 lookahead token if we need one and don't already have one. */
1467
1468 /* First try to decide what to do without reference to lookahead token. */
1469 yyn = yypact[yystate];
1470 if (yypact_value_is_default (yyn))
1471 goto yydefault;
1472
1473 /* Not known => get a lookahead token if don't already have one. */
1474
1475 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1476 if (yychar == YYEMPTY)
1477 {
1478 YYDPRINTF ((stderr, "Reading a token\n"));
1479 yychar = yylex (&yylval, parm, err_c);
1480 }
1481
1482 if (yychar <= YYEOF)
1483 {
1484 yychar = YYEOF;
1485 yytoken = YYSYMBOL_YYEOF;
1486 YYDPRINTF ((stderr, "Now at end of input.\n"));
1487 }
1488 else if (yychar == YYerror)
1489 {
1490 /* The scanner already issued an error message, process directly
1491 to error recovery. But do not keep the error token as
1492 lookahead, it is too special and may lead us to an endless
1493 loop in error recovery. */
1494 yychar = YYUNDEF;
1495 yytoken = YYSYMBOL_YYerror;
1496 goto yyerrlab1;
1497 }
1498 else
1499 {
1500 yytoken = YYTRANSLATE (yychar);
1501 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1502 }
1503
1504 /* If the proper action on seeing token YYTOKEN is to reduce or to
1505 detect an error, take that action. */
1506 yyn += yytoken;
1507 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1508 goto yydefault;
1509 yyn = yytable[yyn];
1510 if (yyn <= 0)
1511 {
1512 if (yytable_value_is_error (yyn))
1513 goto yyerrlab;
1514 yyn = -yyn;
1515 goto yyreduce;
1516 }
1517
1518 /* Count tokens shifted since error; after three, turn off error
1519 status. */
1520 if (yyerrstatus)
1521 yyerrstatus--;
1522
1523 /* Shift the lookahead token. */
1524 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1525 yystate = yyn;
1527 *++yyvsp = yylval;
1529
1530 /* Discard the shifted token. */
1531 yychar = YYEMPTY;
1532 goto yynewstate;
1533
1534
1535/*-----------------------------------------------------------.
1536| yydefault -- do the default action for the current state. |
1537`-----------------------------------------------------------*/
1538yydefault:
1539 yyn = yydefact[yystate];
1540 if (yyn == 0)
1541 goto yyerrlab;
1542 goto yyreduce;
1543
1544
1545/*-----------------------------.
1546| yyreduce -- do a reduction. |
1547`-----------------------------*/
1548yyreduce:
1549 /* yyn is the number of a rule to reduce with. */
1550 yylen = yyr2[yyn];
1551
1552 /* If YYLEN is nonzero, implement the default value of the action:
1553 '$$ = $1'.
1554
1555 Otherwise, the following line sets YYVAL to garbage.
1556 This behavior is undocumented and Bison
1557 users should not rely upon it. Assigning to YYVAL
1558 unconditionally makes the parser a bit smaller, and it avoids a
1559 GCC warning that YYVAL may be used uninitialized. */
1560 yyval = yyvsp[1-yylen];
1561
1562
1563 YY_REDUCE_PRINT (yyn);
1564 switch (yyn)
1565 {
1566 case 2: /* tiptop: instr_decl_list */
1567#line 153 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1568 {
1569 ((naslctxt*)parm)->tree = (yyvsp[0].node);
1570 }
1571#line 1572 "nasl_grammar.tab.c"
1572 break;
1573
1574 case 3: /* instr_decl_list: instr_decl */
1575#line 158 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1576 {
1578 (yyval.node)->line_nb = LNB;
1579 (yyval.node)->link[0] = (yyvsp[0].node);
1580 }
1581#line 1582 "nasl_grammar.tab.c"
1582 break;
1583
1584 case 4: /* instr_decl_list: instr_decl instr_decl_list */
1585#line 164 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1586 {
1588 (yyval.node)->line_nb = LNB;
1589 (yyval.node)->link[0] = (yyvsp[-1].node);
1590 (yyval.node)->link[1] = (yyvsp[0].node);
1591 }
1592#line 1593 "nasl_grammar.tab.c"
1593 break;
1594
1595 case 7: /* func_decl: FUNCTION identifier '(' arg_decl ')' block */
1596#line 174 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1597 {
1598 nasl_set_function_filename ((yyvsp[-4].str));
1600 (yyval.node)->name = LN;
1601 (yyval.node)->line_nb = LNB;
1602 (yyval.node)->x.str_val = (yyvsp[-4].str);
1603 (yyval.node)->link[0] = (yyvsp[-2].node);
1604 (yyval.node)->link[1] = (yyvsp[0].node);
1605 }
1606#line 1607 "nasl_grammar.tab.c"
1607 break;
1608
1609 case 8: /* arg_decl: %empty */
1610#line 184 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1611 { (yyval.node) = NULL; }
1612#line 1613 "nasl_grammar.tab.c"
1613 break;
1614
1615 case 9: /* arg_decl: arg_decl_1 */
1616#line 184 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1617 { (yyval.node) = (yyvsp[0].node); }
1618#line 1619 "nasl_grammar.tab.c"
1619 break;
1620
1621 case 10: /* arg_decl_1: identifier */
1622#line 186 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1623 {
1624 (yyval.node) = alloc_typed_cell (NODE_DECL);
1625 (yyval.node)->name = LN;
1626 (yyval.node)->line_nb = LNB;
1627 (yyval.node)->x.str_val = (yyvsp[0].str);
1628 }
1629#line 1630 "nasl_grammar.tab.c"
1630 break;
1631
1632 case 11: /* arg_decl_1: identifier ',' arg_decl_1 */
1633#line 193 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1634 {
1635 (yyval.node) = alloc_typed_cell (NODE_DECL);
1636 (yyval.node)->name = LN;
1637 (yyval.node)->line_nb = LNB;
1638 (yyval.node)->x.str_val = (yyvsp[-2].str);
1639 (yyval.node)->link[0] = (yyvsp[0].node);
1640 }
1641#line 1642 "nasl_grammar.tab.c"
1642 break;
1643
1644 case 12: /* block: '{' instr_list '}' */
1645#line 202 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1646 { (yyval.node) = (yyvsp[-1].node); }
1647#line 1648 "nasl_grammar.tab.c"
1648 break;
1649
1650 case 13: /* block: '{' '}' */
1651#line 202 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1652 { (yyval.node) = NULL; }
1653#line 1654 "nasl_grammar.tab.c"
1654 break;
1655
1656 case 15: /* instr_list: instr instr_list */
1657#line 205 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1658 {
1659 if ((yyvsp[-1].node) == NULL)
1660 (yyval.node) = (yyvsp[0].node);
1661 else
1662 {
1664 (yyval.node)->name = LN;
1665 (yyval.node)->line_nb = LNB;
1666 (yyval.node)->link[0] = (yyvsp[-1].node);
1667 (yyval.node)->link[1] = (yyvsp[0].node);
1668 }
1669 }
1670#line 1671 "nasl_grammar.tab.c"
1671 break;
1672
1673 case 16: /* instr: simple_instr ';' */
1674#line 219 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1675 { (yyval.node) = (yyvsp[-1].node); }
1676#line 1677 "nasl_grammar.tab.c"
1677 break;
1678
1679 case 20: /* instr: error ';' */
1680#line 220 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1681 {yyerrok;}
1682#line 1683 "nasl_grammar.tab.c"
1683 break;
1684
1685 case 29: /* simple_instr: BREAK */
1686#line 226 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1687 {
1688 (yyval.node) = alloc_typed_cell (NODE_BREAK);
1689 (yyval.node)->name = LN;
1690 (yyval.node)->line_nb = LNB;
1691 }
1692#line 1693 "nasl_grammar.tab.c"
1693 break;
1694
1695 case 30: /* simple_instr: CONTINUE */
1696#line 231 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1697 {
1699 (yyval.node)->name = LN;
1700 (yyval.node)->line_nb = LNB;
1701 }
1702#line 1703 "nasl_grammar.tab.c"
1703 break;
1704
1705 case 31: /* simple_instr: %empty */
1706#line 236 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1707 { (yyval.node) = NULL; }
1708#line 1709 "nasl_grammar.tab.c"
1709 break;
1710
1711 case 32: /* ret: RETURN expr */
1712#line 240 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1713 {
1714 (yyval.node) = alloc_typed_cell (NODE_RETURN);
1715 (yyval.node)->name = LN;
1716 (yyval.node)->line_nb = LNB;
1717 (yyval.node)->link[0] = (yyvsp[0].node);
1718 }
1719#line 1720 "nasl_grammar.tab.c"
1720 break;
1721
1722 case 33: /* ret: RETURN */
1723#line 247 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1724 {
1725 (yyval.node) = alloc_typed_cell (NODE_RETURN);
1726 (yyval.node)->name = LN;
1727 (yyval.node)->line_nb = LNB;
1728 }
1729#line 1730 "nasl_grammar.tab.c"
1730 break;
1731
1732 case 34: /* if_block: IF '(' expr ')' instr */
1733#line 255 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1734 {
1736 (yyval.node)->name = LN;
1737 (yyval.node)->line_nb = LNB;
1738 (yyval.node)->link[0] = (yyvsp[-2].node); (yyval.node)->link[1] = (yyvsp[0].node);
1739 }
1740#line 1741 "nasl_grammar.tab.c"
1741 break;
1742
1743 case 35: /* if_block: IF '(' expr ')' instr ELSE instr */
1744#line 262 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1745 {
1747 (yyval.node)->name = LN;
1748 (yyval.node)->line_nb = LNB;
1749 (yyval.node)->link[0] = (yyvsp[-4].node); (yyval.node)->link[1] = (yyvsp[-2].node); (yyval.node)->link[2] = (yyvsp[0].node);
1750 }
1751#line 1752 "nasl_grammar.tab.c"
1752 break;
1753
1754 case 40: /* for_loop: FOR '(' aff_func ';' expr ';' aff_func ')' instr */
1755#line 272 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1756 {
1757 (yyval.node) = alloc_typed_cell (NODE_FOR);
1758 (yyval.node)->name = LN;
1759 (yyval.node)->line_nb = LNB;
1760 (yyval.node)->link[0] = (yyvsp[-6].node);
1761 (yyval.node)->link[1] = (yyvsp[-4].node);
1762 (yyval.node)->link[2] = (yyvsp[-2].node);
1763 (yyval.node)->link[3] = (yyvsp[0].node);
1764 }
1765#line 1766 "nasl_grammar.tab.c"
1766 break;
1767
1768 case 41: /* while_loop: WHILE '(' expr ')' instr */
1769#line 283 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1770 {
1771 (yyval.node) = alloc_typed_cell (NODE_WHILE);
1772 (yyval.node)->name = LN;
1773 (yyval.node)->line_nb = LNB;
1774 (yyval.node)->link[0] = (yyvsp[-2].node);
1775 (yyval.node)->link[1] = (yyvsp[0].node);
1776 }
1777#line 1778 "nasl_grammar.tab.c"
1778 break;
1779
1780 case 42: /* repeat_loop: REPEAT instr UNTIL expr ';' */
1781#line 291 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1782 {
1784 (yyval.node)->name = LN;
1785 (yyval.node)->line_nb = LNB;
1786 (yyval.node)->link[0] = (yyvsp[-3].node);
1787 (yyval.node)->link[1] = (yyvsp[-1].node);
1788 }
1789#line 1790 "nasl_grammar.tab.c"
1790 break;
1791
1792 case 43: /* foreach_loop: FOREACH identifier '(' expr ')' instr */
1793#line 300 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1794 {
1796 (yyval.node)->name = LN;
1797 (yyval.node)->line_nb = LNB;
1798 (yyval.node)->x.str_val = (yyvsp[-4].str);
1799 (yyval.node)->link[0] = (yyvsp[-2].node);
1800 (yyval.node)->link[1] = (yyvsp[0].node);
1801 }
1802#line 1803 "nasl_grammar.tab.c"
1803 break;
1804
1805 case 47: /* aff_func: %empty */
1806#line 310 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1807 { (yyval.node) = NULL; }
1808#line 1809 "nasl_grammar.tab.c"
1809 break;
1810
1811 case 48: /* rep: func_call REP expr */
1812#line 314 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1813 {
1815 (yyval.node)->name = LN;
1816 (yyval.node)->line_nb = LNB;
1817 (yyval.node)->link[0] = (yyvsp[-2].node);
1818 (yyval.node)->link[1] = (yyvsp[0].node);
1819 }
1820#line 1821 "nasl_grammar.tab.c"
1821 break;
1822
1823 case 49: /* string: STRING1 */
1824#line 322 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1825 { (yyval.str) = (yyvsp[0].data).val; }
1826#line 1827 "nasl_grammar.tab.c"
1827 break;
1828
1829 case 51: /* inc: INCLUDE '(' string ')' */
1830#line 326 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1831 {
1832 char *tmp;
1833 naslctxt subctx;
1834 #pragma GCC diagnostic push
1835 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
1836 int * error_counter;
1837 #pragma GCC diagnostic pop
1838 error_counter = (int*)err_c;
1839
1840 bzero (&subctx, sizeof (subctx));
1841 subctx.always_signed = ((naslctxt*)parm)->always_signed;
1842 subctx.exec_descr = ((naslctxt*)parm)->exec_descr;
1843 subctx.kb = ((naslctxt *) parm)->kb;
1844 subctx.tree = ((naslctxt*) parm)->tree;
1845 (yyval.node) = NULL;
1846 tmp = g_strdup (nasl_get_filename (NULL));
1847 nasl_set_filename ((yyvsp[-1].str));
1848 if (!includes_hash)
1849 includes_hash = g_hash_table_new_full
1850 (g_str_hash, g_str_equal, g_free,
1851 (GDestroyNotify) deref_cell);
1852
1853 if ((subctx.tree = g_hash_table_lookup (includes_hash, (yyvsp[-1].str))))
1854 {
1855 (yyval.node) = subctx.tree;
1856 ref_cell ((yyval.node));
1857 g_free ((yyvsp[-1].str));
1858 }
1859 else if (init_nasl_ctx (&subctx, (yyvsp[-1].str)) >= 0)
1860 {
1861 if (!naslparse (&subctx, err_c))
1862 {
1863 // set the name of tree to the filename for further
1864 // identification of origin (e.g. whos is calling a func).
1865 subctx.tree->name = (yyvsp[-1].str);
1867 (yyval.node) = subctx.tree;
1868 g_hash_table_insert (includes_hash, (yyvsp[-1].str), (yyval.node));
1869 ref_cell ((yyval.node));
1870 }
1871 else
1872 {
1873 nasl_perror (NULL, "%s: Parse error at or near line %d\n", (yyvsp[-1].str),
1874 subctx.line_nb);
1875 g_free ((yyvsp[-1].str));
1876 }
1877 g_free (subctx.buffer);
1878 }
1879 else
1880 {
1881 g_free((yyvsp[-1].str));
1882 g_free (tmp);
1883 return -2;
1884 }
1885 nasl_set_filename (tmp);
1886 g_free (tmp);
1887 }
1888#line 1889 "nasl_grammar.tab.c"
1889 break;
1890
1891 case 52: /* func_call: identifier '(' arg_list ')' */
1892#line 386 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1893 {
1895 (yyval.node)->name = LN;
1896 (yyval.node)->line_nb = LNB;
1897 (yyval.node)->x.str_val = (yyvsp[-3].str);
1898 (yyval.node)->link[0] = (yyvsp[-1].node);
1899 }
1900#line 1901 "nasl_grammar.tab.c"
1901 break;
1902
1903 case 54: /* arg_list: %empty */
1904#line 394 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1905 { (yyval.node) = NULL; }
1906#line 1907 "nasl_grammar.tab.c"
1907 break;
1908
1909 case 56: /* arg_list_1: arg ',' arg_list_1 */
1910#line 396 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1911 {
1912 (yyvsp[-2].node)->link[1] = (yyvsp[0].node);
1913 (yyval.node) = (yyvsp[-2].node);
1914 }
1915#line 1916 "nasl_grammar.tab.c"
1916 break;
1917
1918 case 57: /* arg: expr */
1919#line 402 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1920 {
1921 (yyval.node) = alloc_typed_cell (NODE_ARG);
1922 (yyval.node)->name = LN;
1923 (yyval.node)->line_nb = LNB;
1924 (yyval.node)->link[0] = (yyvsp[0].node);
1925 }
1926#line 1927 "nasl_grammar.tab.c"
1927 break;
1928
1929 case 58: /* arg: identifier ':' expr */
1930#line 409 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1931 {
1932 (yyval.node) = alloc_typed_cell (NODE_ARG);
1933 (yyval.node)->name = LN;
1934 (yyval.node)->line_nb = LNB;
1935 (yyval.node)->x.str_val = (yyvsp[-2].str);
1936 (yyval.node)->link[0] = (yyvsp[0].node);
1937 }
1938#line 1939 "nasl_grammar.tab.c"
1939 break;
1940
1941 case 59: /* aff: lvalue '=' expr */
1942#line 419 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1943 {
1944 (yyval.node) = alloc_expr_cell(LNB, NODE_AFF, (yyvsp[-2].node), (yyvsp[0].node));
1945 }
1946#line 1947 "nasl_grammar.tab.c"
1947 break;
1948
1949 case 60: /* aff: lvalue PLUS_EQ expr */
1950#line 422 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1951 { (yyval.node) = alloc_expr_cell(LNB, NODE_PLUS_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1952#line 1953 "nasl_grammar.tab.c"
1953 break;
1954
1955 case 61: /* aff: lvalue MINUS_EQ expr */
1956#line 423 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1957 { (yyval.node) = alloc_expr_cell(LNB, NODE_MINUS_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1958#line 1959 "nasl_grammar.tab.c"
1959 break;
1960
1961 case 62: /* aff: lvalue MULT_EQ expr */
1962#line 424 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1963 { (yyval.node) = alloc_expr_cell(LNB, NODE_MULT_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1964#line 1965 "nasl_grammar.tab.c"
1965 break;
1966
1967 case 63: /* aff: lvalue DIV_EQ expr */
1968#line 425 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1969 { (yyval.node) = alloc_expr_cell(LNB, NODE_DIV_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1970#line 1971 "nasl_grammar.tab.c"
1971 break;
1972
1973 case 64: /* aff: lvalue MODULO_EQ expr */
1974#line 426 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1975 { (yyval.node) = alloc_expr_cell(LNB, NODE_MODULO_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1976#line 1977 "nasl_grammar.tab.c"
1977 break;
1978
1979 case 65: /* aff: lvalue R_SHIFT_EQ expr */
1980#line 427 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1981 { (yyval.node) = alloc_expr_cell(LNB, NODE_R_SHIFT_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1982#line 1983 "nasl_grammar.tab.c"
1983 break;
1984
1985 case 66: /* aff: lvalue R_USHIFT_EQ expr */
1986#line 428 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1987 { (yyval.node) = alloc_expr_cell(LNB, NODE_R_USHIFT_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1988#line 1989 "nasl_grammar.tab.c"
1989 break;
1990
1991 case 67: /* aff: lvalue L_SHIFT_EQ expr */
1992#line 429 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1993 { (yyval.node) = alloc_expr_cell(LNB, NODE_L_SHIFT_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
1994#line 1995 "nasl_grammar.tab.c"
1995 break;
1996
1997 case 68: /* lvalue: identifier */
1998#line 433 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
1999 { (yyval.node) = alloc_typed_cell (NODE_VAR);
2000 (yyval.node)->line_nb = LNB;
2001 (yyval.node)->x.str_val = (yyvsp[0].str);
2002 }
2003#line 2004 "nasl_grammar.tab.c"
2004 break;
2005
2006 case 71: /* identifier: REP */
2007#line 438 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2008 { (yyval.str) = strdup("x"); }
2009#line 2010 "nasl_grammar.tab.c"
2010 break;
2011
2012 case 72: /* array_elem: identifier '[' array_index ']' */
2013#line 441 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2014 {
2016 (yyval.node)->line_nb = LNB;
2017 (yyval.node)->x.str_val = (yyvsp[-3].str);
2018 (yyval.node)->link[0] = (yyvsp[-1].node);
2019 }
2020#line 2021 "nasl_grammar.tab.c"
2021 break;
2022
2023 case 74: /* post_pre_incr: PLUS_PLUS lvalue */
2024#line 451 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2025 { (yyval.node) = alloc_expr_cell(LNB, EXPR_INCR, NULL, (yyvsp[0].node)); }
2026#line 2027 "nasl_grammar.tab.c"
2027 break;
2028
2029 case 75: /* post_pre_incr: MINUS_MINUS lvalue */
2030#line 452 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2031 {(yyval.node) = alloc_expr_cell(LNB, EXPR_DECR, NULL, (yyvsp[0].node)); }
2032#line 2033 "nasl_grammar.tab.c"
2033 break;
2034
2035 case 76: /* post_pre_incr: lvalue PLUS_PLUS */
2036#line 453 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2037 { (yyval.node)= alloc_expr_cell(LNB, EXPR_INCR, (yyvsp[-1].node), NULL); }
2038#line 2039 "nasl_grammar.tab.c"
2039 break;
2040
2041 case 77: /* post_pre_incr: lvalue MINUS_MINUS */
2042#line 454 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2043 { (yyval.node)= alloc_expr_cell(LNB, EXPR_DECR, (yyvsp[-1].node), NULL); }
2044#line 2045 "nasl_grammar.tab.c"
2045 break;
2046
2047 case 78: /* expr: '(' expr ')' */
2048#line 458 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2049 { (yyval.node) = (yyvsp[-1].node); }
2050#line 2051 "nasl_grammar.tab.c"
2051 break;
2052
2053 case 79: /* expr: expr AND expr */
2054#line 459 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2055 { (yyval.node) = alloc_expr_cell(LNB, EXPR_AND, (yyvsp[-2].node), (yyvsp[0].node)); }
2056#line 2057 "nasl_grammar.tab.c"
2057 break;
2058
2059 case 80: /* expr: '!' expr */
2060#line 460 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2061 { (yyval.node) = alloc_expr_cell(LNB, EXPR_NOT, (yyvsp[0].node), NULL); }
2062#line 2063 "nasl_grammar.tab.c"
2063 break;
2064
2065 case 81: /* expr: expr OR expr */
2066#line 461 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2067 { (yyval.node) = alloc_expr_cell(LNB, EXPR_OR, (yyvsp[-2].node), (yyvsp[0].node)); }
2068#line 2069 "nasl_grammar.tab.c"
2069 break;
2070
2071 case 82: /* expr: expr '+' expr */
2072#line 462 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2073 { (yyval.node) = alloc_expr_cell(LNB, EXPR_PLUS, (yyvsp[-2].node), (yyvsp[0].node)); }
2074#line 2075 "nasl_grammar.tab.c"
2075 break;
2076
2077 case 83: /* expr: expr '-' expr */
2078#line 463 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2079 { (yyval.node) = alloc_expr_cell(LNB, EXPR_MINUS, (yyvsp[-2].node), (yyvsp[0].node)); }
2080#line 2081 "nasl_grammar.tab.c"
2081 break;
2082
2083 case 84: /* expr: '-' expr */
2084#line 464 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2085 { (yyval.node) = alloc_expr_cell(LNB, EXPR_U_MINUS, (yyvsp[0].node), NULL);}
2086#line 2087 "nasl_grammar.tab.c"
2087 break;
2088
2089 case 85: /* expr: '~' expr */
2090#line 465 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2091 { (yyval.node) = alloc_expr_cell(LNB, EXPR_BIT_NOT, (yyvsp[0].node), NULL);}
2092#line 2093 "nasl_grammar.tab.c"
2093 break;
2094
2095 case 86: /* expr: expr '*' expr */
2096#line 466 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2097 { (yyval.node) = alloc_expr_cell(LNB, EXPR_MULT, (yyvsp[-2].node), (yyvsp[0].node)); }
2098#line 2099 "nasl_grammar.tab.c"
2099 break;
2100
2101 case 87: /* expr: expr EXPO expr */
2102#line 467 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2103 { (yyval.node) = alloc_expr_cell(LNB, EXPR_EXPO, (yyvsp[-2].node), (yyvsp[0].node)); }
2104#line 2105 "nasl_grammar.tab.c"
2105 break;
2106
2107 case 88: /* expr: expr '/' expr */
2108#line 468 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2109 { (yyval.node) = alloc_expr_cell(LNB, EXPR_DIV, (yyvsp[-2].node), (yyvsp[0].node)); }
2110#line 2111 "nasl_grammar.tab.c"
2111 break;
2112
2113 case 89: /* expr: expr '%' expr */
2114#line 469 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2115 { (yyval.node) = alloc_expr_cell(LNB, EXPR_MODULO, (yyvsp[-2].node), (yyvsp[0].node)); }
2116#line 2117 "nasl_grammar.tab.c"
2117 break;
2118
2119 case 90: /* expr: expr '&' expr */
2120#line 470 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2121 { (yyval.node) = alloc_expr_cell(LNB, EXPR_BIT_AND, (yyvsp[-2].node), (yyvsp[0].node)); }
2122#line 2123 "nasl_grammar.tab.c"
2123 break;
2124
2125 case 91: /* expr: expr '^' expr */
2126#line 471 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2127 { (yyval.node) = alloc_expr_cell(LNB, EXPR_BIT_XOR, (yyvsp[-2].node), (yyvsp[0].node)); }
2128#line 2129 "nasl_grammar.tab.c"
2129 break;
2130
2131 case 92: /* expr: expr '|' expr */
2132#line 472 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2133 { (yyval.node) = alloc_expr_cell(LNB, EXPR_BIT_OR, (yyvsp[-2].node), (yyvsp[0].node)); }
2134#line 2135 "nasl_grammar.tab.c"
2135 break;
2136
2137 case 93: /* expr: expr R_SHIFT expr */
2138#line 473 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2139 { (yyval.node) = alloc_expr_cell(LNB, EXPR_R_SHIFT, (yyvsp[-2].node), (yyvsp[0].node)); }
2140#line 2141 "nasl_grammar.tab.c"
2141 break;
2142
2143 case 94: /* expr: expr R_USHIFT expr */
2144#line 474 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2145 { (yyval.node) = alloc_expr_cell(LNB, EXPR_R_USHIFT, (yyvsp[-2].node), (yyvsp[0].node)); }
2146#line 2147 "nasl_grammar.tab.c"
2147 break;
2148
2149 case 95: /* expr: expr L_SHIFT expr */
2150#line 475 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2151 { (yyval.node) = alloc_expr_cell(LNB, EXPR_L_SHIFT, (yyvsp[-2].node), (yyvsp[0].node)); }
2152#line 2153 "nasl_grammar.tab.c"
2153 break;
2154
2155 case 97: /* expr: expr MATCH expr */
2156#line 477 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2157 { (yyval.node) = alloc_expr_cell(LNB, COMP_MATCH, (yyvsp[-2].node), (yyvsp[0].node)); }
2158#line 2159 "nasl_grammar.tab.c"
2159 break;
2160
2161 case 98: /* expr: expr NOMATCH expr */
2162#line 478 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2163 { (yyval.node) = alloc_expr_cell(LNB, COMP_NOMATCH, (yyvsp[-2].node), (yyvsp[0].node)); }
2164#line 2165 "nasl_grammar.tab.c"
2165 break;
2166
2167 case 99: /* expr: expr RE_MATCH string */
2168#line 479 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2169 { (yyval.node) = alloc_RE_cell(LNB, COMP_RE_MATCH, (yyvsp[-2].node), (yyvsp[0].str), ERRC); }
2170#line 2171 "nasl_grammar.tab.c"
2171 break;
2172
2173 case 100: /* expr: expr RE_NOMATCH string */
2174#line 480 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2175 { (yyval.node) = alloc_RE_cell(LNB, COMP_RE_NOMATCH, (yyvsp[-2].node), (yyvsp[0].str), ERRC); }
2176#line 2177 "nasl_grammar.tab.c"
2177 break;
2178
2179 case 101: /* expr: expr '<' expr */
2180#line 481 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2181 { (yyval.node) = alloc_expr_cell(LNB, COMP_LT, (yyvsp[-2].node), (yyvsp[0].node)); }
2182#line 2183 "nasl_grammar.tab.c"
2183 break;
2184
2185 case 102: /* expr: expr '>' expr */
2186#line 482 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2187 { (yyval.node) = alloc_expr_cell(LNB, COMP_GT, (yyvsp[-2].node), (yyvsp[0].node)); }
2188#line 2189 "nasl_grammar.tab.c"
2189 break;
2190
2191 case 103: /* expr: expr EQ expr */
2192#line 483 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2193 { (yyval.node) = alloc_expr_cell(LNB, COMP_EQ, (yyvsp[-2].node), (yyvsp[0].node)); }
2194#line 2195 "nasl_grammar.tab.c"
2195 break;
2196
2197 case 104: /* expr: expr NEQ expr */
2198#line 484 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2199 { (yyval.node) = alloc_expr_cell(LNB, COMP_NE, (yyvsp[-2].node), (yyvsp[0].node)); }
2200#line 2201 "nasl_grammar.tab.c"
2201 break;
2202
2203 case 105: /* expr: expr SUPEQ expr */
2204#line 485 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2205 { (yyval.node) = alloc_expr_cell(LNB, COMP_GE, (yyvsp[-2].node), (yyvsp[0].node)); }
2206#line 2207 "nasl_grammar.tab.c"
2207 break;
2208
2209 case 106: /* expr: expr INFEQ expr */
2210#line 486 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2211 { (yyval.node) = alloc_expr_cell(LNB, COMP_LE, (yyvsp[-2].node), (yyvsp[0].node)); }
2212#line 2213 "nasl_grammar.tab.c"
2213 break;
2214
2215 case 112: /* const_array: '[' list_array_data ']' */
2216#line 490 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2217 { (yyval.node) = make_array_from_elems((yyvsp[-1].node)); }
2218#line 2219 "nasl_grammar.tab.c"
2219 break;
2220
2221 case 113: /* list_array_data: array_data */
2222#line 492 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2223 { (yyval.node) = (yyvsp[0].node); }
2224#line 2225 "nasl_grammar.tab.c"
2225 break;
2226
2227 case 114: /* list_array_data: array_data ',' list_array_data */
2228#line 493 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2229 {
2230 (yyvsp[-2].node)->link[1] = (yyvsp[0].node); (yyval.node) = (yyvsp[-2].node);
2231 }
2232#line 2233 "nasl_grammar.tab.c"
2233 break;
2234
2235 case 115: /* array_data: simple_array_data */
2236#line 497 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2237 {
2238 (yyval.node) = alloc_typed_cell(ARRAY_ELEM);
2239 (yyval.node)->link[0] = (yyvsp[0].node);
2240 }
2241#line 2242 "nasl_grammar.tab.c"
2242 break;
2243
2244 case 116: /* array_data: string ARROW simple_array_data */
2245#line 500 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2246 {
2247 (yyval.node) = alloc_typed_cell(ARRAY_ELEM);
2248 (yyval.node)->link[0] = (yyvsp[0].node);
2249 (yyval.node)->x.str_val = (yyvsp[-2].str);
2250 }
2251#line 2252 "nasl_grammar.tab.c"
2252 break;
2253
2254 case 117: /* atom: INTEGER */
2255#line 506 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2256 { (yyval.node) = alloc_typed_cell(CONST_INT); (yyval.node)->x.i_val = (yyvsp[0].num); }
2257#line 2258 "nasl_grammar.tab.c"
2258 break;
2259
2260 case 118: /* atom: STRING2 */
2261#line 507 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2262 {
2263 (yyval.node) = alloc_typed_cell(CONST_STR); (yyval.node)->x.str_val = (yyvsp[0].str);
2264 (yyval.node)->size = strlen((yyvsp[0].str));
2265 }
2266#line 2267 "nasl_grammar.tab.c"
2267 break;
2268
2269 case 119: /* atom: STRING1 */
2270#line 511 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2271 {
2272 (yyval.node) = alloc_typed_cell(CONST_DATA); (yyval.node)->x.str_val = (yyvsp[0].data).val;
2273 (yyval.node)->size = (yyvsp[0].data).len;
2274 }
2275#line 2276 "nasl_grammar.tab.c"
2276 break;
2277
2278 case 121: /* var: var_name */
2279#line 519 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2280 {
2281 (yyval.node) = alloc_typed_cell (NODE_VAR);
2282 (yyval.node)->line_nb = LNB;
2283 (yyval.node)->x.str_val = (yyvsp[0].str);
2284 }
2285#line 2286 "nasl_grammar.tab.c"
2286 break;
2287
2288 case 125: /* ipaddr: INTEGER '.' INTEGER '.' INTEGER '.' INTEGER */
2289#line 529 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2290 {
2291 char *s = g_strdup_printf ("%ld.%ld.%ld.%ld", (yyvsp[-6].num), (yyvsp[-4].num), (yyvsp[-2].num), (yyvsp[0].num));
2292 (yyval.node) = alloc_typed_cell (CONST_STR);
2293 (yyval.node)->line_nb = LNB;
2294 (yyval.node)->x.str_val = s;
2295 (yyval.node)->size = strlen(s);
2296 }
2297#line 2298 "nasl_grammar.tab.c"
2298 break;
2299
2300 case 126: /* loc: LOCAL arg_decl */
2301#line 539 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2302 {
2303 (yyval.node) = alloc_typed_cell (NODE_LOCAL);
2304 (yyval.node)->line_nb = LNB;
2305 (yyval.node)->link[0] = (yyvsp[0].node);
2306 }
2307#line 2308 "nasl_grammar.tab.c"
2308 break;
2309
2310 case 127: /* glob: GLOBAL arg_decl */
2311#line 547 "/builddir/build/BUILD/openvas-scanner-22.7.9/nasl/nasl_grammar.y"
2312 {
2313 (yyval.node) = alloc_typed_cell (NODE_GLOBAL);
2314 (yyval.node)->line_nb = LNB;
2315 (yyval.node)->link[0] = (yyvsp[0].node);
2316 }
2317#line 2318 "nasl_grammar.tab.c"
2318 break;
2319
2320
2321#line 2322 "nasl_grammar.tab.c"
2322
2323 default: break;
2324 }
2325 /* User semantic actions sometimes alter yychar, and that requires
2326 that yytoken be updated with the new translation. We take the
2327 approach of translating immediately before every use of yytoken.
2328 One alternative is translating here after every semantic action,
2329 but that translation would be missed if the semantic action invokes
2330 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2331 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2332 incorrect destructor might then be invoked immediately. In the
2333 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2334 to an incorrect destructor call or verbose syntax error message
2335 before the lookahead is translated. */
2336 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
2337
2338 YYPOPSTACK (yylen);
2339 yylen = 0;
2340
2341 *++yyvsp = yyval;
2342
2343 /* Now 'shift' the result of the reduction. Determine what state
2344 that goes to, based on the state we popped back to and the rule
2345 number reduced by. */
2346 {
2347 const int yylhs = yyr1[yyn] - YYNTOKENS;
2348 const int yyi = yypgoto[yylhs] + *yyssp;
2349 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2350 ? yytable[yyi]
2351 : yydefgoto[yylhs]);
2352 }
2353
2354 goto yynewstate;
2355
2356
2357/*--------------------------------------.
2358| yyerrlab -- here on detecting error. |
2359`--------------------------------------*/
2360yyerrlab:
2361 /* Make sure we have latest lookahead translation. See comments at
2362 user semantic actions for why this is necessary. */
2363 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
2364 /* If not already recovering from an error, report this error. */
2365 if (!yyerrstatus)
2366 {
2367 ++yynerrs;
2368 yyerror (parm, err_c, YY_("syntax error"));
2369 }
2370
2371 if (yyerrstatus == 3)
2372 {
2373 /* If just tried and failed to reuse lookahead token after an
2374 error, discard it. */
2375
2376 if (yychar <= YYEOF)
2377 {
2378 /* Return failure if at end of input. */
2379 if (yychar == YYEOF)
2380 YYABORT;
2381 }
2382 else
2383 {
2384 yydestruct ("Error: discarding",
2385 yytoken, &yylval, parm, err_c);
2386 yychar = YYEMPTY;
2387 }
2388 }
2389
2390 /* Else will try to reuse lookahead token after shifting the error
2391 token. */
2392 goto yyerrlab1;
2393
2394
2395/*---------------------------------------------------.
2396| yyerrorlab -- error raised explicitly by YYERROR. |
2397`---------------------------------------------------*/
2398yyerrorlab:
2399 /* Pacify compilers when the user code never invokes YYERROR and the
2400 label yyerrorlab therefore never appears in user code. */
2401 if (0)
2402 YYERROR;
2403
2404 /* Do not reclaim the symbols of the rule whose action triggered
2405 this YYERROR. */
2406 YYPOPSTACK (yylen);
2407 yylen = 0;
2408 YY_STACK_PRINT (yyss, yyssp);
2409 yystate = *yyssp;
2410 goto yyerrlab1;
2411
2412
2413/*-------------------------------------------------------------.
2414| yyerrlab1 -- common code for both syntax error and YYERROR. |
2415`-------------------------------------------------------------*/
2416yyerrlab1:
2417 yyerrstatus = 3; /* Each real token shifted decrements this. */
2418
2419 /* Pop stack until we find a state that shifts the error token. */
2420 for (;;)
2421 {
2422 yyn = yypact[yystate];
2423 if (!yypact_value_is_default (yyn))
2424 {
2425 yyn += YYSYMBOL_YYerror;
2426 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2427 {
2428 yyn = yytable[yyn];
2429 if (0 < yyn)
2430 break;
2431 }
2432 }
2433
2434 /* Pop the current state because it cannot handle the error token. */
2435 if (yyssp == yyss)
2436 YYABORT;
2437
2438
2439 yydestruct ("Error: popping",
2440 YY_ACCESSING_SYMBOL (yystate), yyvsp, parm, err_c);
2441 YYPOPSTACK (1);
2442 yystate = *yyssp;
2443 YY_STACK_PRINT (yyss, yyssp);
2444 }
2445
2447 *++yyvsp = yylval;
2449
2450
2451 /* Shift the error token. */
2452 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2453
2454 yystate = yyn;
2455 goto yynewstate;
2456
2457
2458/*-------------------------------------.
2459| yyacceptlab -- YYACCEPT comes here. |
2460`-------------------------------------*/
2461yyacceptlab:
2462 yyresult = 0;
2463 goto yyreturn;
2464
2465
2466/*-----------------------------------.
2467| yyabortlab -- YYABORT comes here. |
2468`-----------------------------------*/
2469yyabortlab:
2470 yyresult = 1;
2471 goto yyreturn;
2472
2473
2474#if !defined yyoverflow
2475/*-------------------------------------------------.
2476| yyexhaustedlab -- memory exhaustion comes here. |
2477`-------------------------------------------------*/
2478yyexhaustedlab:
2479 yyerror (parm, err_c, YY_("memory exhausted"));
2480 yyresult = 2;
2481 goto yyreturn;
2482#endif
2483
2484
2485/*-------------------------------------------------------.
2486| yyreturn -- parsing is finished, clean up and return. |
2487`-------------------------------------------------------*/
2488yyreturn:
2489 if (yychar != YYEMPTY)
2490 {
2491 /* Make sure we have latest lookahead translation. See comments at
2492 user semantic actions for why this is necessary. */
2493 yytoken = YYTRANSLATE (yychar);
2494 yydestruct ("Cleanup: discarding lookahead",
2495 yytoken, &yylval, parm, err_c);
2496 }
2497 /* Do not reclaim the symbols of the rule whose action triggered
2498 this YYABORT or YYACCEPT. */
2499 YYPOPSTACK (yylen);
2500 YY_STACK_PRINT (yyss, yyssp);
2501 while (yyssp != yyss)
2502 {
2503 yydestruct ("Cleanup: popping",
2504 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, parm, err_c);
2505 YYPOPSTACK (1);
2506 }
2507#ifndef yyoverflow
2508 if (yyss != yyssa)
2509 YYSTACK_FREE (yyss);
2510#endif
2511
2512 return yyresult;
2513}
int naslparse(naslctxt *, int *)
void nasl_set_function_filename(const char *function)
Definition: nasl_debug.c:99
const char * nasl_get_filename(const char *function)
Definition: nasl_debug.c:60
#define YYMAXDEPTH
#define YYSTACK_FREE
#define yyerrok
#define YY_ASSERT(E)
static const yytype_int8 yydefact[]
#define YYNSTATES
#define YY_IGNORE_USELESS_CAST_END
#define YYABORT
#define YYSTACK_BYTES(N)
#define YY_REDUCE_PRINT(Rule)
static const yytype_int16 yypact[]
#define yylex
static const yytype_uint8 yydefgoto[]
#define YYFINAL
static const yytype_int16 yypgoto[]
#define YY_INITIAL_VALUE(Value)
int init_nasl_ctx(naslctxt *pc, const char *name)
Initialize a NASL context for a NASL file.
#define YY_STACK_PRINT(Bottom, Top)
#define YY_IGNORE_USELESS_CAST_BEGIN
static void yydestruct(const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, naslctxt *parm, int *err_c)
#define LN
#define yynerrs
static const yytype_int16 yytable[]
#define YYACCEPT
#define yytable_value_is_error(Yyn)
#define YYTRANSLATE(YYX)
#define ERRC
static const yytype_int8 yyr1[]
#define YYPOPSTACK(N)
int yy_state_fast_t
#define YYLAST
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
#define yypact_value_is_default(Yyn)
#define YYINITDEPTH
static const yytype_int16 yycheck[]
#define YYSTACK_ALLOC
#define YYDPRINTF(Args)
#define yyerror
@ YYEOF
@ YYerror
@ YYUNDEF
void ref_cell(tree_cell *c)
Definition: nasl_tree.c:167
tree_cell * alloc_RE_cell(int lnb, int t, tree_cell *l, char *re_str, int *err_c)
Definition: nasl_tree.c:36
tree_cell * alloc_expr_cell(int lnb, int t, tree_cell *l, tree_cell *r)
Definition: nasl_tree.c:63
tree_cell * alloc_typed_cell(int typ)
Definition: nasl_tree.c:28
@ NODE_FOR
Definition: nasl_tree.h:16
@ NODE_ARRAY_EL
Definition: nasl_tree.h:29
@ NODE_L_SHIFT_EQ
Definition: nasl_tree.h:41
@ NODE_PLUS_EQ
Definition: nasl_tree.h:35
@ NODE_FUN_CALL
Definition: nasl_tree.h:22
@ COMP_LE
Definition: nasl_tree.h:73
@ NODE_R_SHIFT_EQ
Definition: nasl_tree.h:42
@ COMP_GT
Definition: nasl_tree.h:76
@ NODE_LOCAL
Definition: nasl_tree.h:32
@ CONST_DATA
Definition: nasl_tree.h:82
@ NODE_AFF
Definition: nasl_tree.h:30
@ EXPR_MODULO
Definition: nasl_tree.h:54
@ COMP_RE_MATCH
Definition: nasl_tree.h:69
@ NODE_MULT_EQ
Definition: nasl_tree.h:37
@ COMP_NE
Definition: nasl_tree.h:75
@ NODE_VAR
Definition: nasl_tree.h:31
@ NODE_R_USHIFT_EQ
Definition: nasl_tree.h:43
@ NODE_ARG
Definition: nasl_tree.h:24
@ NODE_CONTINUE
Definition: nasl_tree.h:27
@ COMP_EQ
Definition: nasl_tree.h:74
@ EXPR_MULT
Definition: nasl_tree.h:52
@ NODE_FUN_DEF
Definition: nasl_tree.h:21
@ COMP_GE
Definition: nasl_tree.h:77
@ ARRAY_ELEM
Definition: nasl_tree.h:85
@ NODE_REPEAT_UNTIL
Definition: nasl_tree.h:19
@ NODE_REPEATED
Definition: nasl_tree.h:20
@ EXPR_BIT_NOT
Definition: nasl_tree.h:60
@ EXPR_R_SHIFT
Definition: nasl_tree.h:64
@ EXPR_DIV
Definition: nasl_tree.h:53
@ COMP_RE_NOMATCH
Definition: nasl_tree.h:70
@ NODE_RETURN
Definition: nasl_tree.h:25
@ EXPR_BIT_XOR
Definition: nasl_tree.h:59
@ NODE_FOREACH
Definition: nasl_tree.h:18
@ NODE_IF_ELSE
Definition: nasl_tree.h:14
@ NODE_DIV_EQ
Definition: nasl_tree.h:38
@ NODE_MINUS_EQ
Definition: nasl_tree.h:36
@ COMP_NOMATCH
Definition: nasl_tree.h:68
@ COMP_MATCH
Definition: nasl_tree.h:67
@ EXPR_NOT
Definition: nasl_tree.h:47
@ EXPR_PLUS
Definition: nasl_tree.h:49
@ EXPR_L_SHIFT
Definition: nasl_tree.h:63
@ NODE_DECL
Definition: nasl_tree.h:23
@ CONST_STR
Definition: nasl_tree.h:80
@ EXPR_BIT_AND
Definition: nasl_tree.h:57
@ EXPR_EXPO
Definition: nasl_tree.h:55
@ EXPR_INCR
Definition: nasl_tree.h:61
@ NODE_INSTR_L
Definition: nasl_tree.h:15
@ EXPR_BIT_OR
Definition: nasl_tree.h:58
@ EXPR_U_MINUS
Definition: nasl_tree.h:51
@ COMP_LT
Definition: nasl_tree.h:72
@ EXPR_OR
Definition: nasl_tree.h:46
@ NODE_BREAK
Definition: nasl_tree.h:26
@ EXPR_DECR
Definition: nasl_tree.h:62
@ EXPR_R_USHIFT
Definition: nasl_tree.h:65
@ NODE_GLOBAL
Definition: nasl_tree.h:33
@ CONST_INT
Definition: nasl_tree.h:79
@ NODE_WHILE
Definition: nasl_tree.h:17
@ EXPR_MINUS
Definition: nasl_tree.h:50
@ NODE_MODULO_EQ
Definition: nasl_tree.h:39
@ EXPR_AND
Definition: nasl_tree.h:45
tree_cell * make_array_from_elems(tree_cell *el)
Definition: nasl_var.c:1323
long int i_val
Definition: nasl_tree.h:104
char * name
Definition: nasl_tree.h:97
char * str_val
Definition: nasl_tree.h:103
tree_cell * node
YYSTYPE yyvs_alloc
yy_state_t yyss_alloc

References alloc_expr_cell(), alloc_RE_cell(), alloc_typed_cell(), naslctxt::always_signed, ARRAY_ELEM, naslctxt::buffer, COMP_EQ, COMP_GE, COMP_GT, COMP_LE, COMP_LT, COMP_MATCH, COMP_NE, COMP_NOMATCH, COMP_RE_MATCH, COMP_RE_NOMATCH, CONST_DATA, CONST_INT, CONST_STR, YYSTYPE::data, deref_cell(), ERRC, naslctxt::exec_descr, EXPR_AND, EXPR_BIT_AND, EXPR_BIT_NOT, EXPR_BIT_OR, EXPR_BIT_XOR, EXPR_DECR, EXPR_DIV, EXPR_EXPO, EXPR_INCR, EXPR_L_SHIFT, EXPR_MINUS, EXPR_MODULO, EXPR_MULT, EXPR_NOT, EXPR_OR, EXPR_PLUS, EXPR_R_SHIFT, EXPR_R_USHIFT, EXPR_U_MINUS, TC::i_val, include_order, TC::include_order, includes_hash, init_nasl_ctx(), naslctxt::kb, naslctxt::line_nb, LN, LNB, make_array_from_elems(), name, TC::name, nasl_get_filename(), nasl_perror(), nasl_set_filename(), nasl_set_function_filename(), naslparse(), YYSTYPE::node, NODE_AFF, NODE_ARG, NODE_ARRAY_EL, NODE_BREAK, NODE_CONTINUE, NODE_DECL, NODE_DIV_EQ, NODE_FOR, NODE_FOREACH, NODE_FUN_CALL, NODE_FUN_DEF, NODE_GLOBAL, NODE_IF_ELSE, NODE_INSTR_L, NODE_L_SHIFT_EQ, NODE_LOCAL, NODE_MINUS_EQ, NODE_MODULO_EQ, NODE_MULT_EQ, NODE_PLUS_EQ, NODE_R_SHIFT_EQ, NODE_R_USHIFT_EQ, NODE_REPEAT_UNTIL, NODE_REPEATED, NODE_RETURN, NODE_VAR, NODE_WHILE, YYSTYPE::num, ref_cell(), YYSTYPE::str, TC::str_val, naslctxt::tree, YY_, YY_ACCESSING_SYMBOL, YY_ASSERT, YY_CAST, YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END, YY_IGNORE_USELESS_CAST_BEGIN, YY_IGNORE_USELESS_CAST_END, YY_INITIAL_VALUE, YY_REDUCE_PRINT, YY_STACK_PRINT, YY_SYMBOL_PRINT, YYABORT, YYACCEPT, yycheck, yydefact, yydefgoto, yydestruct(), YYDPRINTF, YYEMPTY, YYEOF, yyerrok, yyerror, YYERROR, YYerror, YYFINAL, YYINITDEPTH, YYLAST, yylex, YYMAXDEPTH, yynerrs, YYNSTATES, YYNTOKENS, yypact, yypact_value_is_default, yypgoto, YYPOPSTACK, YYPTRDIFF_T, yyr1, yyr2, YYSIZE_T, YYSIZEOF, yyalloc::yyss_alloc, YYSTACK_ALLOC, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, YYSYMBOL_YYEMPTY, YYSYMBOL_YYEOF, YYSYMBOL_YYerror, yytable, yytable_value_is_error, YYTRANSLATE, YYUNDEF, and yyalloc::yyvs_alloc.

Here is the call graph for this function:

◆ yysymbol_name()

static const char * yysymbol_name ( yysymbol_kind_t  yysymbol)
static

Definition at line 703 of file nasl_grammar.tab.c.

704{
705 return yytname[yysymbol];
706}
static const char *const yytname[]

References yytname.

Referenced by yy_symbol_print().

Here is the caller graph for this function:

Variable Documentation

◆ checksum_algorithm

int checksum_algorithm = GCRY_MD_NONE
static

Definition at line 2579 of file nasl_grammar.tab.c.

Referenced by init_nasl_ctx(), and load_checksums().

◆ inc_dirs

GSList* inc_dirs = NULL
static

Definition at line 2534 of file nasl_grammar.tab.c.

Referenced by add_nasl_inc_dir(), and init_nasl_ctx().

◆ include_order

int include_order = 0
static

Definition at line 112 of file nasl_grammar.tab.c.

Referenced by init_nasl_ctx(), and yyparse().

◆ includes_hash

GHashTable* includes_hash = NULL

Definition at line 116 of file nasl_grammar.tab.c.

Referenced by nasl_clean_inc(), nasl_get_include_order(), and yyparse().

◆ parse_buffer

char* parse_buffer = NULL
static

Definition at line 109 of file nasl_grammar.tab.c.

Referenced by init_nasl_ctx(), and mylex().

◆ parse_len

int parse_len = 0
static

Definition at line 111 of file nasl_grammar.tab.c.

Referenced by init_nasl_ctx(), and mylex().

◆ yycheck

const yytype_int16 yycheck[]
static

Definition at line 922 of file nasl_grammar.tab.c.

Referenced by yyparse().

◆ yydebug

int yydebug

Definition at line 1254 of file nasl_grammar.tab.c.

◆ yydefact

const yytype_int8 yydefact[]
static
Initial value:
=
{
0, 0, 0, 71, 0, 0, 0, 0, 29, 30,
0, 33, 0, 8, 8, 0, 0, 70, 0, 0,
2, 0, 6, 17, 5, 0, 25, 18, 19, 36,
37, 38, 39, 23, 26, 24, 21, 0, 68, 69,
22, 27, 28, 20, 0, 47, 0, 0, 0, 0,
119, 118, 117, 0, 0, 0, 0, 0, 123, 108,
124, 122, 96, 32, 111, 110, 107, 121, 109, 0,
126, 9, 10, 127, 74, 68, 75, 13, 0, 0,
1, 4, 16, 0, 76, 77, 0, 0, 0, 0,
0, 0, 0, 0, 0, 54, 0, 0, 0, 46,
44, 45, 0, 0, 0, 8, 0, 84, 0, 119,
118, 117, 0, 0, 113, 120, 115, 80, 85, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 49, 50, 0, 0, 12, 15, 48,
60, 61, 62, 63, 64, 67, 65, 66, 59, 0,
53, 55, 124, 57, 0, 73, 0, 0, 0, 0,
0, 0, 0, 78, 0, 112, 0, 103, 104, 105,
106, 81, 79, 97, 98, 95, 93, 94, 87, 99,
100, 101, 102, 92, 91, 90, 82, 83, 86, 88,
89, 51, 11, 52, 0, 0, 72, 34, 0, 42,
0, 41, 0, 0, 116, 114, 56, 58, 0, 47,
43, 7, 0, 35, 0, 0, 0, 125, 40
}

Definition at line 767 of file nasl_grammar.tab.c.

Referenced by yyparse().

◆ yydefgoto

const yytype_uint8 yydefgoto[]
static
Initial value:
=
{
0, 19, 20, 21, 22, 70, 71, 23, 78, 24,
25, 26, 27, 28, 29, 30, 31, 32, 98, 33,
112, 34, 58, 159, 160, 161, 59, 37, 60, 61,
164, 62, 163, 64, 113, 114, 65, 116, 66, 67,
68, 41, 42
}

Definition at line 805 of file nasl_grammar.tab.c.

Referenced by yyparse().

◆ yypact

const yytype_int16 yypact[]
static
Initial value:
=
{
340, -57, -35, -77, -27, 427, -5, -15, -77, -77,
-5, 538, -13, -5, -5, -5, -5, -77, 373, 50,
-77, 111, -77, -77, -77, -12, -77, -77, -77, -77,
-77, -77, -77, -77, -77, 38, -77, 507, -39, -77,
-77, -77, -77, -77, 538, -2, 48, -8, 538, 16,
-77, -77, -16, 538, 538, 40, 538, 538, -77, -77,
124, 592, -77, 837, -77, -77, -77, -77, -77, -1,
-77, -77, 15, -77, -77, -3, -77, -77, 25, 400,
-77, -77, -77, 538, -77, -77, 538, 538, 538, 538,
538, 538, 538, 538, 538, 538, 538, 605, 26, -77,
-77, -77, 538, 538, 663, -5, 34, 65, 721, 56,
57, -77, 58, 32, 39, -77, -77, 65, 65, 538,
538, 538, 538, 538, 538, 538, 538, 538, 538, 538,
538, -1, -1, 538, 538, 538, 538, 538, 538, 538,
538, 538, 538, -77, -77, 44, -5, -77, -77, 837,
837, 837, 837, 837, 837, 837, 837, 837, 837, 45,
-77, 46, 36, 837, 49, 837, 427, 538, 466, 779,
427, 51, 47, -77, 43, -77, 40, 921, 921, 921,
921, 890, 952, 921, 921, 160, 160, 160, 65, -77,
-77, 921, 921, 404, 316, 240, 4, 4, 65, 65,
65, -77, -77, -77, 538, 538, -77, 104, 519, -77,
427, -77, 53, 69, -77, -77, -77, 837, 427, -2,
-77, -77, 55, -77, 59, 77, 427, -77, -77
}

Definition at line 737 of file nasl_grammar.tab.c.

Referenced by yyparse().

◆ yypgoto

const yytype_int16 yypgoto[]
static
Initial value:
=
{
-77, -77, 118, -77, -77, -11, -6, -71, 63, 14,
-77, -77, -77, -77, -77, -77, -77, -77, -76, -77,
-65, -77, 2, -77, -60, -77, 31, 24, 0, 12,
-77, 37, 189, -77, -31, -77, -54, -26, -77, -77,
-77, -77, -77
}

Definition at line 795 of file nasl_grammar.tab.c.

Referenced by yyparse().

◆ yyr1

const yytype_int8 yyr1[]
static
Initial value:
=
{
0, 73, 74, 75, 75, 76, 76, 77, 78, 78,
79, 79, 80, 80, 81, 81, 82, 82, 82, 82,
82, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 84, 84, 85, 85, 86, 86, 86, 86,
87, 88, 89, 90, 91, 91, 91, 91, 92, 93,
93, 94, 95, 96, 96, 97, 97, 98, 98, 99,
99, 99, 99, 99, 99, 99, 99, 99, 100, 100,
101, 101, 102, 103, 104, 104, 104, 104, 105, 105,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
105, 105, 106, 107, 107, 108, 108, 109, 109, 109,
110, 111, 111, 111, 112, 113, 114, 115
}

Definition at line 1057 of file nasl_grammar.tab.c.

Referenced by yyparse().

◆ yyr2

const yytype_int8 yyr2[]
static
Initial value:
=
{
0, 2, 1, 1, 2, 1, 1, 6, 0, 1,
1, 3, 3, 2, 1, 2, 2, 1, 1, 1,
2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 2, 1, 5, 7, 1, 1, 1, 1,
9, 5, 5, 6, 1, 1, 1, 0, 3, 1,
1, 4, 4, 1, 0, 1, 3, 1, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 1, 1,
1, 1, 4, 1, 2, 2, 2, 2, 3, 3,
2, 3, 3, 3, 2, 2, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 1, 1, 1,
1, 1, 3, 1, 3, 1, 3, 1, 1, 1,
1, 1, 1, 1, 1, 7, 2, 2
}

Definition at line 1075 of file nasl_grammar.tab.c.

Referenced by yy_reduce_print(), and yyparse().

◆ yyrline

const yytype_int16 yyrline[]
static
Initial value:
=
{
0, 152, 152, 157, 163, 170, 170, 173, 184, 184,
185, 192, 202, 202, 203, 204, 219, 219, 219, 219,
220, 224, 224, 224, 225, 225, 225, 225, 225, 226,
231, 236, 239, 246, 254, 261, 270, 270, 270, 270,
271, 282, 290, 299, 310, 310, 310, 310, 313, 322,
322, 325, 385, 394, 394, 395, 395, 401, 408, 418,
422, 423, 424, 425, 426, 427, 428, 429, 432, 436,
438, 438, 440, 448, 451, 452, 453, 454, 458, 459,
460, 461, 462, 463, 464, 465, 466, 467, 468, 469,
470, 471, 472, 473, 474, 475, 476, 477, 478, 479,
480, 481, 482, 483, 484, 485, 486, 487, 487, 487,
487, 487, 490, 492, 493, 497, 500, 506, 507, 511,
516, 518, 524, 524, 526, 528, 538, 546
}

Definition at line 652 of file nasl_grammar.tab.c.

Referenced by yy_reduce_print().

◆ yystos

const yytype_int8 yystos[]
static
Initial value:
=
{
0, 1, 3, 13, 14, 15, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 43, 64, 74,
75, 76, 77, 80, 82, 83, 84, 85, 86, 87,
88, 89, 90, 92, 94, 95, 99, 100, 101, 102,
104, 114, 115, 66, 61, 61, 82, 101, 61, 101,
44, 45, 46, 54, 61, 68, 70, 71, 95, 99,
101, 102, 104, 105, 106, 109, 111, 112, 113, 61,
78, 79, 101, 78, 100, 101, 100, 65, 81, 82,
0, 75, 66, 13, 26, 27, 32, 33, 34, 35,
36, 37, 38, 39, 47, 61, 68, 105, 91, 95,
99, 104, 16, 61, 105, 61, 72, 105, 105, 44,
45, 46, 93, 107, 108, 109, 110, 105, 105, 5,
6, 7, 8, 9, 10, 11, 12, 28, 29, 30,
31, 40, 41, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 44, 45, 93, 63, 65, 81, 105,
105, 105, 105, 105, 105, 105, 105, 105, 105, 96,
97, 98, 101, 105, 103, 105, 62, 66, 105, 105,
62, 78, 46, 62, 42, 69, 63, 105, 105, 105,
105, 105, 105, 105, 105, 105, 105, 105, 105, 93,
93, 105, 105, 105, 105, 105, 105, 105, 105, 105,
105, 62, 79, 62, 63, 67, 69, 82, 105, 66,
62, 82, 62, 72, 110, 107, 97, 105, 4, 66,
82, 80, 46, 82, 91, 72, 62, 46, 82
}

Definition at line 1029 of file nasl_grammar.tab.c.

◆ yytable

const yytype_int16 yytable[]
static

Definition at line 817 of file nasl_grammar.tab.c.

Referenced by yyparse().

◆ yytname

const char* const yytname[]
static
Initial value:
=
{
"\"end of file\"", "error", "\"invalid token\"", "IF", "ELSE", "EQ",
"NEQ", "SUPEQ", "INFEQ", "OR", "AND", "MATCH", "NOMATCH", "REP", "FOR",
"REPEAT", "UNTIL", "FOREACH", "WHILE", "BREAK", "CONTINUE", "FUNCTION",
"RETURN", "INCLUDE", "LOCAL", "GLOBAL", "PLUS_PLUS", "MINUS_MINUS",
"L_SHIFT", "R_SHIFT", "R_USHIFT", "EXPO", "PLUS_EQ", "MINUS_EQ",
"MULT_EQ", "DIV_EQ", "MODULO_EQ", "L_SHIFT_EQ", "R_SHIFT_EQ",
"R_USHIFT_EQ", "RE_MATCH", "RE_NOMATCH", "ARROW", "IDENT", "STRING1",
"STRING2", "INTEGER", "'='", "'<'", "'>'", "'|'", "'^'", "'&'", "'+'",
"'-'", "'*'", "'/'", "'%'", "NOT", "UMINUS", "BIT_NOT", "'('", "')'",
"','", "'{'", "'}'", "';'", "':'", "'['", "']'", "'!'", "'~'", "'.'",
"$accept", "tiptop", "instr_decl_list", "instr_decl", "func_decl",
"arg_decl", "arg_decl_1", "block", "instr_list", "instr", "simple_instr",
"ret", "if_block", "loop", "for_loop", "while_loop", "repeat_loop",
"foreach_loop", "aff_func", "rep", "string", "inc", "func_call",
"arg_list", "arg_list_1", "arg", "aff", "lvalue", "identifier",
"array_elem", "array_index", "post_pre_incr", "expr", "const_array",
"list_array_data", "array_data", "atom", "simple_array_data", "var",
"var_name", "ipaddr", "loc", "glob", YY_NULLPTR
}
#define YY_NULLPTR

Definition at line 680 of file nasl_grammar.tab.c.

Referenced by yysymbol_name().

◆ yytranslate

const yytype_int8 yytranslate[]
static

Definition at line 615 of file nasl_grammar.tab.c.