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

vhdl_parser depends on coding style to find ports/generics #58

Closed
heikoengel opened this issue Jul 8, 2015 · 4 comments
Closed

vhdl_parser depends on coding style to find ports/generics #58

heikoengel opened this issue Jul 8, 2015 · 4 comments

Comments

@heikoengel
Copy link

works:

entity tb_example_many is
  generic (runner_cfg : runner_cfg_t);
end entity;

works:

entity tb_example_many is
  generic 
  (
    runner_cfg : runner_cfg_t
  );
end entity;

does not work:

entity tb_example_many is generic
  (
    runner_cfg : runner_cfg_t
  );
end entity;

VHDL does not require a newline before generic or port but vhdl_parser.py:387 /:413 currently implement it this way.

@kraigher
Copy link
Collaborator

kraigher commented Jul 8, 2015

I have fixed the problem and added some other corner case tests.

@kraigher kraigher closed this as completed Jul 8, 2015
@kraigher
Copy link
Collaborator

kraigher commented Jul 8, 2015

Some time in the future I plan to rewrite the VHDL parser to be based on tokens by first tokenizing the input instead of the current raw regex approach. This will scale better and be more maintainable. The Verilog parser that I started working on in the systemverilog branch is already token based.

@heikoengel
Copy link
Author

thanks for the fix - that was fast...again!
Parsing VHDL can be really tricky...I think there are a few more possible pitfalls in the current implementation, but in 99% of the cases probably not worth the effort...

@kraigher
Copy link
Collaborator

kraigher commented Jul 8, 2015

Yes the current raw regexp implementation can be tricked by cleverly crafted input as it is a weak method of parsing. That is why I want to rewrite it to use proper tokenization. It has worked well in practice for the parsing needs of VUnit though.

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

No branches or pull requests

2 participants