[#720] Various parser fixes
Description
See individual commits.
Some notes:
There is a lot of weirdness around macros and braces in octez-client. It seems the reference parser either substitutes macros on the fly, or first parses to some very generic representation and then tries to fit it into a more concrete type. Either way, our setup is rather different, which leads to a lot of awkwardness. I tried my best to match, but this is a losing battle.
Long story short, with instructions that accept sequences of instructions as arguments, reference parser accepts either brace-wrapped sequences or macros that expand to sequences. If a macro consists of more than one token (e.g. IF {} {}
as opposed to FAIL
), then apparently it can be wrapped in parentheses.
Additional effort had to go into differentiating between MACRO
and {MACRO}
, which is in fact non-trivial since our types accept sequences of instructions and not singular instructions (which is correct, except macros work differently).
At this point, I wonder whether we should just make our parser as permissive as possible wrt braces and be done with it.
Related issue(s)
Resolves #720 (closed)
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.