-
Notifications
You must be signed in to change notification settings - Fork 64
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
Add package declaration in declarative part #307
base: master
Are you sure you want to change the base?
Add package declaration in declarative part #307
Conversation
e094cc2
to
dba05d4
Compare
ee9a1af
to
d260d93
Compare
042dfbe
to
1ab2839
Compare
This is what I came up with. I am not sure if the changes in analysis/design_unit.rs are sensible. I am still not quite 100% what is going on in that particular code region tbh lol. Oh and I only added one test. Not sure if we need more. |
So far things look good to me. One thing to be wary of is that the package declaration might not be visible in the global scope. In other words,
Would mean that
would probably mean that Also, I think that we should have more tests. The main purpose of the thorough testing is for regressions, I.e. checking that things also work after auxiliary changes. I'm somewhat busy at the moment, so I can only give any further, code specific review later; latest however Sunday. That being said thanks again for taking up this issue! |
Alright thanks, I will have a look at your notes later this day. I have also pushed the Disconnection Specification to my fork. It now parses, but analysing Disconnect still does nothing for now. I will try to figure out how the analyse stuff works next, so I can try to implement it. The thing with Disconnect though is that it also depends on Guarded, which only seems partially implemented at the moment. |
self.analyze_package(unit, diagnostics)?; | ||
} | ||
Declaration::PackageBody(ref mut unit) => { | ||
self.analyze_package_body(unit, diagnostics)?; |
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
vhdl_lang/src/syntax/design_unit.rs
Outdated
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 test also doesn't do much. It just checks that the tokeniser works, but this is already tested elsewhere. Here, you should check that the AST matches, i.e., that if you parse that snippet, you will find an architecture declaration with package and package body inside. I think you can also omit the entity and just parse the architecture.
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 think I need a little help here. I have tried to do what you said but I find it very hard to fill a default ArchitectureBody with the necessary values. The other tests use this simple_architecture, but I don't think this helps me much. I have put the test I thought of in comments.
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.
All of this looks really good so far.
I have made comments where you had TODO marks and where I think some improvements could be made.
8e91c39
to
f895da6
Compare
// span: code.token_span(), | ||
// context_clause: ContextClause::default(), | ||
// ident: code.s1("arch").decl_ident(), | ||
// entity_name: None, // TODO |
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 is just the name of the entity, i.e. ent
in this example. You should simply be able to get a reference to that using WithRef::new(code.s1("ent").ident())
ab2bee2
to
95586ab
Compare
95586ab
to
5c90f11
Compare
5c90f11
to
9cb1790
Compare
This is addressing the first two tasks of #225