VSCode-SystemVerilog
VSCode-SystemVerilog copied to clipboard
LSP: Replace Macros with TokenStreamRewriter
To preserve the correct locations and direct link to the source, replacement of macros should happen between the lexer and the parser instead of before the lexer. This can be done with a TokenStreamRewriter, I propose the following approach:
- Add a lexer rule for macros (`
) - Replace above rule with either the content of the macro or a placeholder.
*Content of a defined macro can be obtained during indexation. **This might be a quite hard task, perhaps start with just substituting the macro for a simple 'placeholder' word