This request captures features from a script that lived outside of Verible, but some developers found useful.
The script (by @jonmayergoogle ) would automatically add comments after ifdefelsifelseendif directives that reflected the condition under which the section was active, and served as a readability aid.
Test cases and examples
/* Hello, world. */
alpha
`ifdef FOO
/*
beta
`ifndef BAR
*/
luke
`ifdef BUM // is BUM defined
wookie
`endif // this comment gets removed
r2d2
`endif
wedge
The implementation for this would be based on an unpreprocessed token stream. No syntactic validation is needed, as this is purely a transformation based on preprocessing tokens. The simplicity of this task means that we don't need a full syntax tree transformation/rewriting framework.
Summary
This request captures features from a script that lived outside of Verible, but some developers found useful. The script (by @jonmayergoogle ) would automatically add comments after
ifdef
elsif
else
endif
directives that reflected the condition under which the section was active, and served as a readability aid.Test cases and examples
would automatically become annotated like:
Proposal
The implementation for this would be based on an unpreprocessed token stream. No syntactic validation is needed, as this is purely a transformation based on preprocessing tokens. The simplicity of this task means that we don't need a full syntax tree transformation/rewriting framework.
Additional context
cl/629042737 (Google)