mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-08-26 00:54:49 +00:00
ssfilter: Eliminate shift/reduce conflicts
The problematic bit was the 'expr: expr expr' rule. Fix this by making 'expr' token represent a single filter only and introduce a new token 'exprlist' to represent a combination of filters. Signed-off-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
parent
8ee38d833c
commit
b2038cc0b2
@ -42,7 +42,7 @@ static void yyerror(char *s)
|
||||
%nonassoc '!'
|
||||
|
||||
%%
|
||||
applet: null expr
|
||||
applet: null exprlist
|
||||
{
|
||||
*yy_ret = $2;
|
||||
$$ = $2;
|
||||
@ -51,6 +51,32 @@ applet: null expr
|
||||
;
|
||||
null: /* NOTHING */ { $$ = NULL; }
|
||||
;
|
||||
exprlist: expr
|
||||
| '!' expr
|
||||
{
|
||||
$$ = alloc_node(SSF_NOT, $2);
|
||||
}
|
||||
| '(' exprlist ')'
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| exprlist '|' expr
|
||||
{
|
||||
$$ = alloc_node(SSF_OR, $1);
|
||||
$$->post = $3;
|
||||
}
|
||||
| exprlist '&' expr
|
||||
{
|
||||
$$ = alloc_node(SSF_AND, $1);
|
||||
$$->post = $3;
|
||||
}
|
||||
| exprlist expr
|
||||
{
|
||||
$$ = alloc_node(SSF_AND, $1);
|
||||
$$->post = $2;
|
||||
}
|
||||
;
|
||||
|
||||
expr: DCOND HOSTCOND
|
||||
{
|
||||
$$ = alloc_node(SSF_DCOND, $2);
|
||||
@ -128,30 +154,6 @@ expr: DCOND HOSTCOND
|
||||
{
|
||||
$$ = alloc_node(SSF_S_AUTO, NULL);
|
||||
}
|
||||
| expr '|' expr
|
||||
{
|
||||
$$ = alloc_node(SSF_OR, $1);
|
||||
$$->post = $3;
|
||||
}
|
||||
| expr expr
|
||||
{
|
||||
$$ = alloc_node(SSF_AND, $1);
|
||||
$$->post = $2;
|
||||
}
|
||||
| expr '&' expr
|
||||
|
||||
{
|
||||
$$ = alloc_node(SSF_AND, $1);
|
||||
$$->post = $3;
|
||||
}
|
||||
| '!' expr
|
||||
{
|
||||
$$ = alloc_node(SSF_NOT, $2);
|
||||
}
|
||||
| '(' expr ')'
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
;
|
||||
%%
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user