Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match of macro definition shows a false match #235

Open
liuhuaibin opened this issue Jul 27, 2022 · 2 comments
Open

match of macro definition shows a false match #235

liuhuaibin opened this issue Jul 27, 2022 · 2 comments
Labels

Comments

@liuhuaibin
Copy link

liuhuaibin commented Jul 27, 2022

Explain the issue

in systemverilog file , when you define a macro('ifdef 'else)and appear “if” ,the macro of else can match if and also match the 'ifdef.

if(a) begin
'ifdef
'else
'endif
end

about match_word =''if(\n)?def>:'else>:'endif>,'

@andymass
Copy link
Owner

What is the expectation?

I have opened file.sv as follows (did not customize match_words, using built-in vim).

if(a) begin
`ifdef 
else
`endif
end

Match 1:

if(a)
else

Match 2:

begin
end

Match 3:

`ifdef 
`endif

@liuhuaibin
Copy link
Author

liuhuaibin commented Aug 4, 2022

First of all ,thank you very much for taking time out of your busy schedule to answer my question!
About this question ,may be you can try it that put a macro symbol before the "else" . you can see , “'else” can match “
if ”,can also match “'ifdef” .So I got the idea, how do I tie the symbol of the macro to the if so that it doesn't match the else.

if(a) begin
'ifdef
'else
'endif
end

Match 1:
'ifdef
'else
'endif

Match 2:
if (a)
else

Please try it , thank you!

@liuhuaibin liuhuaibin reopened this Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants