statechart.g 795 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Partial grammar file for Lark-parser
  2. // Concatenate this file with sccd/action_lang/parser/action_lang.g
  3. %import common.WS
  4. %ignore WS
  5. %import common.ESCAPED_STRING
  6. // A path to a state. XPath-like syntax.
  7. ?path: absolute_path | relative_path
  8. absolute_path: _PATH_SEP path_sequence
  9. relative_path: path_sequence
  10. path_sequence: (CURRENT_NODE | PARENT_NODE | IDENTIFIER) (_PATH_SEP path_sequence)?
  11. _PATH_SEP: "/"
  12. PARENT_NODE: ".."
  13. CURRENT_NODE: "."
  14. // Event declaration parsing
  15. event_decl_list: neg_event_decl ("," neg_event_decl)*
  16. ?neg_event_decl: event_decl -> pos
  17. | "not" event_decl -> neg
  18. ?event_decl: IDENTIFIER params_decl
  19. // Semantic option parsing
  20. WILDCARD: "*"
  21. ?semantic_choice: WILDCARD -> wildcard
  22. | IDENTIFIER ("," IDENTIFIER)* -> list