OpenVAS Libraries  9.0.3
lint.c File Reference
#include "nasl.h"
#include "nasl_tree.h"
#include "nasl_global_ctxt.h"
#include "nasl_func.h"
#include "nasl_var.h"
#include "nasl_lex_ctxt.h"
#include "exec.h"
#include "nasl_debug.h"
#include "nasl_init.h"
Include dependency graph for lint.c:

Go to the source code of this file.

Macros

#define NASL_DEBUG   0
 

Functions

tree_cellnasl_lint (lex_ctxt *lexic, tree_cell *st)
 

Macro Definition Documentation

◆ NASL_DEBUG

#define NASL_DEBUG   0

Definition at line 32 of file lint.c.

Function Documentation

◆ nasl_lint()

tree_cell* nasl_lint ( lex_ctxt lexic,
tree_cell st 
)

Definition at line 36 of file lint.c.

37 {
38  int i;
39  tree_cell *ret = FAKE_CELL;
40  nasl_func *pf;
41 
42  switch (st->type)
43  {
44  case NODE_FUN_DEF:
45  /* x.str_val = function name, [0] = argdecl, [1] = block */
46  ret = decl_nasl_func (lexic, st);
47  return ret;
48  case NODE_FUN_CALL:
49  pf = get_func_ref_by_name (lexic, st->x.str_val);
50  if (pf == NULL)
51  {
52  lexic->line_nb = st->line_nb;
53  nasl_perror (lexic, "Undefined function '%s'\n", st->x.str_val);
54  return NULL;
55  }
56  default:
57  for (i = 0; i < 4; i++)
58  if (st->link[i] != NULL && st->link[i] != FAKE_CELL)
59  if ((ret = nasl_lint (lexic, st->link[i])) == NULL)
60  return NULL;
61  return ret;
62  }
63 
64 }
#define FAKE_CELL
Definition: nasl_tree.h:120
struct TC * link[4]
Definition: nasl_tree.h:117
short type
Definition: nasl_tree.h:107
char * str_val
Definition: nasl_tree.h:113
short line_nb
Definition: nasl_tree.h:108
union TC::@7 x
Definition: nasl_tree.h:105
void nasl_perror(lex_ctxt *lexic, char *msg,...)
Definition: nasl_debug.c:94
tree_cell * nasl_lint(lex_ctxt *lexic, tree_cell *st)
Definition: lint.c:36
nasl_func * get_func_ref_by_name(lex_ctxt *ctxt, const char *name)
Definition: nasl_func.c:126
tree_cell * decl_nasl_func(lex_ctxt *lexic, tree_cell *decl_node)
Definition: nasl_func.c:111

References decl_nasl_func(), FAKE_CELL, get_func_ref_by_name(), struct_lex_ctxt::line_nb, TC::line_nb, TC::link, nasl_perror(), NODE_FUN_CALL, NODE_FUN_DEF, TC::str_val, TC::type, and TC::x.

Referenced by exec_nasl_script().

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