pico-engine icon indicating copy to clipboard operation
pico-engine copied to clipboard

appears that nested compound actions aren't allowed by the parser

Open b1conrad opened this issue 4 years ago • 4 comments

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

b1conrad avatar Dec 28 '20 23:12 b1conrad

The question is, partly, why would we be expecting a left parenthesis at that point?

b1conrad avatar Dec 28 '20 23:12 b1conrad

Using defactions would be the workaround

b1conrad avatar Dec 29 '20 00:12 b1conrad

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.

b1conrad avatar Jan 05 '21 08:01 b1conrad

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

b1conrad avatar Mar 06 '21 03:03 b1conrad