-
Notifications
You must be signed in to change notification settings - Fork 68
Add package declaration in declarative part #307
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
dba05d4
d260d93
1ab2839
10cbd3d
7416d11
9cb1790
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -933,4 +933,40 @@ end entity y; | |
| assert_eq!(tok.kind, Context); | ||
| assert_eq!(tok.pos, code.s1("context").pos()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parse_package_declaration_and_body_in_declarative_part() { | ||
| let code = Code::new( | ||
| "\ | ||
| entity ent is | ||
| end entity; | ||
|
|
||
| architecture arch of ent is | ||
| package my_pkg is | ||
| -- ... | ||
| end my_pkg; | ||
| package body my_pkg is | ||
| -- ... | ||
| end package body; | ||
| begin | ||
| end arch; | ||
| ", | ||
| ); | ||
| let file = code.design_file(); | ||
| let (tokens, _) = &file.design_units[1]; | ||
| assert_eq!(tokens[0].kind, Architecture); | ||
| assert_eq!(tokens[5].kind, Package); | ||
| assert_eq!(tokens[6].kind, Identifier); | ||
| assert_eq!(tokens[7].kind, Is); | ||
| assert_eq!(tokens[8].kind, End); | ||
| assert_eq!(tokens[9].kind, Identifier); | ||
| assert_eq!(tokens[10].kind, SemiColon); | ||
| assert_eq!(tokens[11].kind, Package); | ||
| assert_eq!(tokens[12].kind, Body); | ||
| assert_eq!(tokens[13].kind, Identifier); | ||
| assert_eq!(tokens[14].kind, Is); | ||
| assert_eq!(tokens[15].kind, End); | ||
| assert_eq!(tokens[16].kind, Package); | ||
| assert_eq!(tokens[17].kind, Body); | ||
| } | ||
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (and the package declaration analysis) is fine, but I think that this declares them in the global namespace. As I have written in the second comment, check that this is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to resolve this next tomorrow or so. It is not exactly easy to interpret what the LRM really means, I have to say lol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, one of the hardest parts of developing a VHDL language server is interpreting the LRM :P