Case macro for the different kinds of plexeme 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 plexeme structure, or to split into cases based on its type.
In its short form,
(plexeme-case x :header)
is essentially just a safer alternative to writing:
(equal (plexeme-kind x) :header)
Why is using plexeme-case safer? When we directly inspect the
kind with
In its longer form,
(plexeme-case x :header ... :ident ... :number ... :char ... :string ... :punctuator ... :other ... :block-comment ... :line-comment ... :newline ... :spaces ... :horizontal-tab ... :vertical-tab ... :form-feed ...)
It is also possible to consolidate ``uninteresting'' cases using
For convenience, the case macro automatically binds the fields of