-
Notifications
You must be signed in to change notification settings - Fork 9
Port driver to transformation DSL (BIP-5) #19
Conversation
* port annotations * update driver files * serialize positions for all AST nodes * preserve nil fields in native AST Signed-off-by: Denys Smirnov <denys@sourced.tech>
Signed-off-by: Denys Smirnov <denys@sourced.tech>
Signed-off-by: Denys Smirnov <denys@sourced.tech>
Signed-off-by: Denys Smirnov <denys@sourced.tech>
{Mappings(Annotations...)}, | ||
{ | ||
Mappings( | ||
AnnotateIfNoRoles("FieldList", role.Incomplete), |
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.
The Incomplete
role must not be applied automatically. It's used by the driver programmer to mark roles that doesn't express the full semantic information for any reason (usually because of lack of more specific roles).
PTAL: https://github.com/bblfsh/documentation/blob/master/proposals/bip-002.md
driver/normalizer/annotation.go
Outdated
{ | ||
Mappings( | ||
AnnotateIfNoRoles("FieldList", role.Incomplete), | ||
Unannotated(), |
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.
The Unannotated role on the other side should be applied automatically. Having do add a Transformer in the driver breaks a little BIP-2 since it should be automatically done despite whatever the driver programmer does, but I guess we can work with this (opening an issue if the current SDK get's merged) until we find a way to apply it automatically.
(same for the other drivers).
Review status: 0 of 141 files reviewed at latest revision, 2 unresolved discussions, some commit checks broke. driver/normalizer/annotation.go, line 20 at r1 (raw file): Previously, juanjux (Juanjo Alvarez Martinez) wrote…
This is exactly what it's used here for. driver/normalizer/annotation.go, line 21 at r1 (raw file): Previously, juanjux (Juanjo Alvarez Martinez) wrote…
I agree that this should be added automatically, but for now I'm waiting for you to verify that it works well for Python and PHP. The reason why it might not work, is because it adds this role to every node without roles, and may touch some nodes that was not meant to be annotated at all (legacy On the other hand I think better sollution would be to return Comments from Reviewable |
Review status: 0 of 141 files reviewed at latest revision, 1 unresolved discussion, some commit checks broke. driver/normalizer/annotation.go, line 20 at r1 (raw file): Previously, dennwc (Denys Smirnov) wrote…
The List role is for arrays, list, etc, data structures, not for list of items in the UAST or arguments. driver/normalizer/annotation.go, line 21 at r1 (raw file): Previously, dennwc (Denys Smirnov) wrote…
Seem to work pretty well! I found a crashing bug while fixing a node that was unannotated because it didn't match the structure of some of it's use in the native AST but I don't think is related (I'll tell you tomorrow since I don't want to interfere much with your OSD). Comments from Reviewable |
Review status: 0 of 141 files reviewed at latest revision, 2 unresolved discussions, some commit checks broke. driver/normalizer/annotation.go, line 20 at r1 (raw file): Previously, juanjux (Juanjo Alvarez Martinez) wrote…
This is why I omitted it, yes. Do you consider this resolved? driver/normalizer/annotation.go, line 21 at r1 (raw file): Previously, juanjux (Juanjo Alvarez Martinez) wrote…
OK. And what do you think about moving this logic to Comments from Reviewable |
Review status: 0 of 141 files reviewed at latest revision, 2 unresolved discussions, some commit checks broke. driver/normalizer/annotation.go, line 21 at r1 (raw file): Previously, dennwc (Denys Smirnov) wrote…
It's probably the perfect place AFAIK. Comments from Reviewable |
Review status: 0 of 141 files reviewed at latest revision, 1 unresolved discussion, some commit checks broke. driver/normalizer/annotation.go, line 20 at r1 (raw file): Previously, dennwc (Denys Smirnov) wrote…
No, since it still auto applies the incomplete role in this specific case (FieldList with no roles) :) (or maybe I'm not understanding what it does.) Comments from Reviewable |
Review status: 0 of 141 files reviewed at latest revision, 2 unresolved discussions, some commit checks broke. driver/normalizer/annotation.go, line 20 at r1 (raw file): Previously, juanjux (Juanjo Alvarez Martinez) wrote…
Again, as I said, this is intentional - driver/normalizer/annotation.go, line 21 at r1 (raw file): Previously, juanjux (Juanjo Alvarez Martinez) wrote…
OK, will change it in SDK Comments from Reviewable |
Signed-off-by: Denys Smirnov <denys@sourced.tech>
Review status: 0 of 141 files reviewed at latest revision, 2 unresolved discussions, some commit checks broke. driver/normalizer/annotation.go, line 21 at r1 (raw file): Previously, dennwc (Denys Smirnov) wrote…
Done. Comments from Reviewable |
Signed-off-by: Denys Smirnov <denys@sourced.tech>
Signed-off-by: Denys Smirnov <denys@sourced.tech>
Related to bblfsh/sdk#243.
Signed-off-by: Denys Smirnov denys@sourced.tech