pico-engine
pico-engine copied to clipboard
appears that nested compound actions aren't allowed by the parser
A simple example which gets a "ParseError: Expected (
[at line 8 col 22]"
ruleset compound_action {
rule every_in_choose {
select when compound test_noop
pre {
cv = event:attrs{"msg_type"} || "rumor"
}
choose cv {
rumor => every {noop()}
seen => noop()
}
}
}
Nonsensical example distilled from a real case where we need a compound action inside a branch of a choose
The question is, partly, why would we be expecting a left parenthesis at that point?
Using defaction
s would be the workaround
After discussion with Matthew, decided that this would be a difficult thing to change in the parser/compiler, so we won't address it for now.
A real example is
every {
authz(netid) setting(answer)
choose answer {
ADMIN => send_directive("_redirect",{"url":adminURL})
VIEW => send_directive("_redirect",{"url":viewURL})
}
}
which will have to use a defaction
or two as a work-around