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

Fix regex for VHDL component instantiations #990

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

javValverde
Copy link

  • Add comments to the multiline regex
  • Extend unittest for vhdl_parser

- Add comments to the multiline regex
- Extend unittest for vhdl_parser
(?:(?:[a-zA-Z]\w*)\.)? # Optional library name
([a-zA-Z]\w*)\s* # Capture component name
(?:generic|port)\s+map\s* # Generic/port map
\(.*?\)\s*; # Open and closing brackets
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than allowing anything between the opening and closing brackets I would suggest extending the previously more restrictive expression with what is needed to pass the new test case:

([\s\w=>,.)(+-'"*/]*)

I cannot recall if the more restrictive expression is there for a reason that is not made explicit in the test cases. For that reason I prefer a more defensive modification.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry for the delayed reply.
I will modify the regex as you suggested, but I guess there will be other cases in which it won't work

In the mean time I've monkey patched vhdl_parser.py and am matching everything inside the brackets.

@eine eine added this to the v5.0.0 milestone Mar 11, 2024
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.

None yet

3 participants