Skip to content

Verilog: Fix function parse when return type contains :: #4111

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

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

roccomao
Copy link
Contributor

This is a fix for #4109, and this TODO list (#2674) now can be checked:

We should ignore any return type of a function. We only need to parse the class_scope before the function or task name.

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.85%. Comparing base (b6d1cac) to head (68ef8d6).
Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4111   +/-   ##
=======================================
  Coverage   85.85%   85.85%           
=======================================
  Files         239      239           
  Lines       58629    58652   +23     
=======================================
+ Hits        50333    50356   +23     
  Misses       8296     8296           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@roccomao roccomao force-pushed the fix-function-parse branch 2 times, most recently from fc5125c to 05c2091 Compare November 12, 2024 10:20
@masatake masatake requested a review from hirooih November 12, 2024 18:14
@masatake
Copy link
Member

Much easier to read!

@roccomao
Copy link
Contributor Author

Aha! Thanks for your detailed review and guidance, it helped me a lot. 😄

@hirooih
Copy link
Contributor

hirooih commented Nov 12, 2024

@roccomao,

Thanks a lot!
I will review your fix this evening.

Copy link
Contributor

@hirooih hirooih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roccomao,

Thank you for your great fix.
You also fix the bug of currentContext->virtual in dropContex().

I've added a note on your comment. Please fix it.

I still don't understand how getFirstClassNameIndex() works well. I may be able to simply it some more, but not sure yet. Let me some more time to think about it.

@roccomao
Copy link
Contributor Author

At first, I just added as detailed a description and test cases as possible to submit an issue, hoping to help developers analyze the problem. Suddenly, I wanted to see how it was implemented. The clear implementation code structure makes it understandable to newbies, so I raised this PR and received detailed review and guidance. Thanks a lot!

You also fix the bug of currentContext->virtual in dropContex().

This is mentioned in 6de290bc detailed commit messages.

I still don't understand how getFirstClassNameIndex() works well. I may be able to simply it some more, but not sure yet. Let me some more time to think about it.

In fact, we only add the class scope to the token before ::, and :: can only appear before the return type and function name. So how to separate the return type and function name? If they both contain ::, then there are at least two adjacent tokens between the two :: that is exactly the split point. This is my implementation idea.

@roccomao
Copy link
Contributor Author

Comments and test cases were updated.

@roccomao
Copy link
Contributor Author

Refer to PR #4116, the class now supports final_specifier. Similarly, the class method now supports dynamic_override_specifiers. The current implementation of this PR is actually unaffected. Anyway, let's update the comments again and add a few test cases.

latest IEEE Std 1800-2023 8.3 Syntax:

dynamic_override_specifiers ::= [ initial_or_extends_specifier ] [ final_specifier ]
    initial_or_extends_specifier ::= : initial | : extends
    final_specifier ::= : final

In addition, the implementation of the getFirstClassNameIndex function was refactored.

@roccomao roccomao requested a review from hirooih November 15, 2024 18:23
@hirooih
Copy link
Contributor

hirooih commented Nov 16, 2024

Again thank you very much for your great work!

@hirooih hirooih merged commit 748a0e1 into universal-ctags:master Nov 16, 2024
69 checks passed
@roccomao
Copy link
Contributor Author

Fixed #4109

❤️ Many Thanks to the reviewers, you helped me a lot. Now let's close the associated issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants