Case macro for the different kinds of jexpr structures.
This is an ACL2::fty sum-type case macro, typically introduced by fty::defflexsum or fty::deftagsum. It allows you to safely check the type of a jexpr structure, or to split into cases based on its type.
In its short form,
(jexpr-case x :literal)
is essentially just a safer alternative to writing:
(equal (jexpr-kind x) :literal)
Why is using jexpr-case safer? When we directly inspect the
kind with
In its longer form,
(jexpr-case x :literal ... :name ... :newarray ... :newarray-init ... :array ... :newclass ... :field ... :method ... :smethod ... :imethod ... :postinc ... :postdec ... :cast ... :unary ... :binary ... :instanceof ... :cond ... :paren ...)
It is also possible to consolidate ``uninteresting'' cases using
For convenience, the case macro automatically binds the fields of