-
Notifications
You must be signed in to change notification settings - Fork 326
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
Parser: implement import #3627
Parser: implement import #3627
Conversation
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.
Please create Tree.Import
and capture the import info in there.
We are implementing this sort of thing with "macros" (MultiSegmentApp) |
If I properly remember our yesterday conversation, then |
" type Baz", | ||
]; | ||
#[rustfmt::skip] | ||
let expected = block![ |
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.
+1, thanks for this test.
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.
Looks fine. Chatting with Kaz over the table revealed that import
is a Java keyword and we need to prefix the field with something. Otherwise OK.
@@ -106,7 +106,9 @@ impl FromMeta { | |||
let mut fields = Vec::with_capacity(fields_.size_hint().0); | |||
for field in fields_ { | |||
let meta::Field { name, type_, hide, .. } = field; | |||
let name = name.to_camel_case().expect("Unimplemented: Tuples."); | |||
let mut name_ = meta::FieldName::from_snake_case("field"); |
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 change renamed even the public getters. Now I see Line.getFieldExpression()
methods & co. Workarounded by aa2b63a#r940901973
…tions and signatures; fix field names (#3653) Implements: - UUIDs: https://www.pivotaltracker.com/story/show/182931137 - Comments: https://www.pivotaltracker.com/story/show/182981779 - Type annotations and signatures: https://www.pivotaltracker.com/story/show/182497454 - Fix getter names (#3627 (comment)). # Important Notes - I can't fully test UUIDs; I have tested that the data obtained in Rust matches my understanding of how the format is supposed to work. What remains to be tested is that the data in Java matches the way the old parser handles the format. So @JaroslavTulach, let me know if you see any cases where I'm not returning the same values. - This implementation of type annotations and signatures accepts any expression in type context. It would probably be nice to narrow this down at some point, but for now I have no design info on what specifically should be allowed in type expressions; this implementation should be at least an incremental improvement.
Pull Request Description
Based on usage; I believe this handles every case in current
.enso
files.Important Notes
import
is a built-in macro, so an import statement parses as aMultiSegmentApp
.import
syntax will have a segment whose leading keyword isimport
; howeverimport
macros can be identified more efficiently by looking at only the first keyword. AMultiSegmentApp
is an import if and only if its first keyword is in the set { "polyglot", "from", "import" }.Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide dist
and./run ide watch
.[ci no changelog needed]