Case macro for the different kinds of expr 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 expr structure, or to split into cases based on its type.
In its short form,
(expr-case x :ident)
is essentially just a safer alternative to writing:
(equal (expr-kind x) :ident)
Why is using expr-case safer? When we directly inspect the
kind with
In its longer form,
(expr-case x :ident ... :const ... :string ... :paren ... :gensel ... :arrsub ... :funcall ... :member ... :memberp ... :complit ... :unary ... :sizeof ... :sizeof-ambig ... :alignof ... :cast ... :binary ... :cond ... :comma ... :cast/call-ambig ... :cast/mul-ambig ... :cast/add-ambig ... :cast/sub-ambig ... :cast/and-ambig ... :stmt ... :tycompat ... :offsetof ... :va-arg ... :extension ...)
It is also possible to consolidate ``uninteresting'' cases using
For convenience, the case macro automatically binds the fields of