Implements page 644 of IEEE 1800-2012.
`` is now overloaded with the Icarus-specific "stringify" expansions.
It is now used as indicated in 1800-2012 when appearing inside a macro
definition, and the Icarus way when not. To do so, it uses the fact
that istack->file is NULL iff we are processing expanded macro text,
which is a bit of hack but seems to work as is.
" and`" on the other hand are treated the same inside and outside of macro definitions.
The versions of VCS, NCVerilog, and ModelSim that I have didn't agree on the handling of these sequences outside of macros (they had spotty and inconsistent handling of these sequences in general). While the standard seems to indicate that these sequences should only be handled specially inside macro definitions, I have followed what VCS does and allowed them anywhere. This makes sense to me as it doesn't force me to define a macro to stringify a macro expansion (i.e.
`foo can now also be written"
foo" anywhere). I also did it this way to make the implementation cleaner. I initially had the
" and`" actions only do the transformations if istack->file was NULL and just ECHO otherwise. However, the semantics of this wasn't clear, should it move into the CSTRING start condition? Doesn't seem like that was what was intended. In any case, passing it through as is would certainly result in a syntax error once it hit the compiler proper, so I don't think handling them outside of macro definitions eliminates a use case.
Comments or suggested changes are welcome, especially regarding the hack-ish check of istack->file == NULL, the handling of
w.r.t. the Icarus meaning of, and the handling of
" and`" outside of macro defintions.
Log in to post a comment.