mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Merge remote-tracking branch 'origin/master' into topic/matthias/opaque
This commit is contained in:
commit
816965f3c7
268 changed files with 2216 additions and 463 deletions
35
src/parse.y
35
src/parse.y
|
@ -32,6 +32,7 @@
|
|||
|
||||
%token TOK_NO_TEST
|
||||
|
||||
%nonassoc TOK_HOOK
|
||||
%left ',' '|'
|
||||
%right '=' TOK_ADD_TO TOK_REMOVE_FROM
|
||||
%right '?' ':'
|
||||
|
@ -56,7 +57,6 @@
|
|||
%type <re> pattern
|
||||
%type <expr> expr init anonymous_function
|
||||
%type <event_expr> event
|
||||
%type <call_expr> hook
|
||||
%type <stmt> stmt stmt_list func_body for_head
|
||||
%type <type> type opt_type enum_body
|
||||
%type <func_type> func_hdr func_params
|
||||
|
@ -119,6 +119,7 @@ extern const char* g_curr_debug_error;
|
|||
|
||||
#define YYLTYPE yyltype
|
||||
|
||||
static int in_hook = 0;
|
||||
int in_init = 0;
|
||||
int in_record = 0;
|
||||
bool resolving_global_ID = false;
|
||||
|
@ -212,7 +213,6 @@ static std::list<std::string>* concat_opt_docs (std::list<std::string>* pre,
|
|||
Val* val;
|
||||
RE_Matcher* re;
|
||||
Expr* expr;
|
||||
CallExpr* call_expr;
|
||||
EventExpr* event_expr;
|
||||
Stmt* stmt;
|
||||
ListExpr* list;
|
||||
|
@ -517,7 +517,16 @@ expr:
|
|||
| expr '(' opt_expr_list ')'
|
||||
{
|
||||
set_location(@1, @4);
|
||||
$$ = new CallExpr($1, $3);
|
||||
$$ = new CallExpr($1, $3, in_hook > 0);
|
||||
}
|
||||
|
||||
| TOK_HOOK { ++in_hook; } expr
|
||||
{
|
||||
--in_hook;
|
||||
set_location(@1, @3);
|
||||
if ( $3->Tag() != EXPR_CALL )
|
||||
$3->Error("not a valid hook call expression");
|
||||
$$ = $3;
|
||||
}
|
||||
|
||||
| expr TOK_HAS_FIELD TOK_ID
|
||||
|
@ -874,7 +883,7 @@ type:
|
|||
| TOK_HOOK '(' formal_args ')'
|
||||
{
|
||||
set_location(@1, @3);
|
||||
$$ = new FuncType($3, 0, FUNC_FLAVOR_HOOK);
|
||||
$$ = new FuncType($3, base_type(TYPE_BOOL), FUNC_FLAVOR_HOOK);
|
||||
}
|
||||
|
||||
| TOK_FILE TOK_OF type
|
||||
|
@ -1214,6 +1223,8 @@ func_hdr:
|
|||
}
|
||||
| TOK_HOOK def_global_id func_params
|
||||
{
|
||||
$3->ClearYieldType(FUNC_FLAVOR_HOOK);
|
||||
$3->SetYieldType(base_type(TYPE_BOOL));
|
||||
begin_func($2, current_module.c_str(),
|
||||
FUNC_FLAVOR_HOOK, 0, $3);
|
||||
$$ = $3;
|
||||
|
@ -1377,14 +1388,6 @@ stmt:
|
|||
brofiler.AddStmt($$);
|
||||
}
|
||||
|
||||
| TOK_HOOK hook ';' opt_no_test
|
||||
{
|
||||
set_location(@1, @4);
|
||||
$$ = new HookStmt($2);
|
||||
if ( ! $4 )
|
||||
brofiler.AddStmt($$);
|
||||
}
|
||||
|
||||
| TOK_IF '(' expr ')' stmt
|
||||
{
|
||||
set_location(@1, @4);
|
||||
|
@ -1538,14 +1541,6 @@ event:
|
|||
}
|
||||
;
|
||||
|
||||
hook:
|
||||
expr '(' opt_expr_list ')'
|
||||
{
|
||||
set_location(@1, @4);
|
||||
$$ = new CallExpr($1, $3, true);
|
||||
}
|
||||
;
|
||||
|
||||
case_list:
|
||||
case_list case
|
||||
{ $1->append($2); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue