mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Prepend and creation of empty path should work, but it has strange
syntax for now.
This commit is contained in:
parent
f421cfdd80
commit
afc54517db
@ -73,6 +73,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
|
|||||||
DEFINED,
|
DEFINED,
|
||||||
ADD, DELETE, CONTAINS, RESET,
|
ADD, DELETE, CONTAINS, RESET,
|
||||||
APPEND, MATCH,
|
APPEND, MATCH,
|
||||||
|
EMPTY,
|
||||||
FILTER, WHERE)
|
FILTER, WHERE)
|
||||||
|
|
||||||
%nonassoc THEN
|
%nonassoc THEN
|
||||||
@ -418,6 +419,9 @@ term:
|
|||||||
/* Paths */
|
/* Paths */
|
||||||
| term '.' APPEND '(' term ')' { }
|
| term '.' APPEND '(' term ')' { }
|
||||||
| term '.' RESET { }
|
| term '.' RESET { }
|
||||||
|
|
||||||
|
| EMPTY { $$ = f_new_inst(); $$->code = 'E'; $$->aux = T_PATH; }
|
||||||
|
|
||||||
/* | term '.' LEN { $$->code = P('P','l'); } */
|
/* | term '.' LEN { $$->code = P('P','l'); } */
|
||||||
|
|
||||||
/* function_call is inlined here */
|
/* function_call is inlined here */
|
||||||
|
@ -453,6 +453,22 @@ interpret(struct f_inst *what)
|
|||||||
res.val.px.ip = ipa_and(mask, v1.val.px.ip);
|
res.val.px.ip = ipa_and(mask, v1.val.px.ip);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'E': /* Create empty attribute */
|
||||||
|
res.type = what->aux;
|
||||||
|
res.val.ad = adata_empty(f_pool);
|
||||||
|
break;
|
||||||
|
case P('A','p'): /* Path prepend */
|
||||||
|
TWOARGS;
|
||||||
|
if (v1.type != T_PATH)
|
||||||
|
runtime("Can't prepend to non-path");
|
||||||
|
if (v2.type != T_INT)
|
||||||
|
runtime("Can't prepend non-integer");
|
||||||
|
|
||||||
|
res.type = T_PATH;
|
||||||
|
res.val.ad = as_path_prepend(f_pool, v1.val.ad, v2.val.i);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
bug( "Unknown instruction %d (%c)", what->code, what->code & 0xff);
|
bug( "Unknown instruction %d (%c)", what->code, what->code & 0xff);
|
||||||
}
|
}
|
||||||
@ -519,7 +535,7 @@ i_same(struct f_inst *f1, struct f_inst *f2)
|
|||||||
break;
|
break;
|
||||||
case 'p': ONEARG; break;
|
case 'p': ONEARG; break;
|
||||||
case '?': TWOARGS; break;
|
case '?': TWOARGS; break;
|
||||||
case '0': break;
|
case '0': case 'E': break;
|
||||||
case P('p',','): ONEARG; A2_SAME; break;
|
case P('p',','): ONEARG; A2_SAME; break;
|
||||||
case 'a': A2_SAME; break;
|
case 'a': A2_SAME; break;
|
||||||
case P('e','a'): A2_SAME; break;
|
case P('e','a'): A2_SAME; break;
|
||||||
@ -535,6 +551,7 @@ i_same(struct f_inst *f1, struct f_inst *f2)
|
|||||||
break;
|
break;
|
||||||
case P('S','W'): ONEARG; if (!same_tree(f1->a2.p, f2->a2.p)) return 0; break;
|
case P('S','W'): ONEARG; if (!same_tree(f1->a2.p, f2->a2.p)) return 0; break;
|
||||||
case P('i','M'): TWOARGS; break;
|
case P('i','M'): TWOARGS; break;
|
||||||
|
case P('A','p'): TWOARGS; break;
|
||||||
default:
|
default:
|
||||||
bug( "Unknown instruction %d in same (%c)", f1->code, f1->code & 0xff);
|
bug( "Unknown instruction %d in same (%c)", f1->code, f1->code & 0xff);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user