Skip to content

Commit

Permalink
fix: erroneous parse of field parent nodes inside structs and messages
Browse files Browse the repository at this point in the history
Discovered in tact-lsp via hover event-driven debugging :)
  • Loading branch information
novusnota committed Jul 5, 2024
1 parent 121b9f5 commit 497f045
Show file tree
Hide file tree
Showing 3 changed files with 3,477 additions and 3,500 deletions.
13 changes: 7 additions & 6 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,22 +226,23 @@ module.exports = grammar({

message_value: ($) => seq("(", $.integer, ")"),

struct_body: ($) =>
seq("{", semicolonSepWithTrailing(alias($._field, $.field)), "}"),
struct_body: ($) => seq("{", semicolonSepWithTrailing($.field), "}"),

/* Fields (of messages, structs, contracts, traits) */

_field: ($) =>
field: ($) => seq(field("name", $.identifier), $._field_after_id),

storage_variable: ($) =>
seq(field("name", $.identifier), $._field_after_id, ";"),

_field_after_id: ($) =>
seq(
field("name", $.identifier),
":",
field("type", $._type),
field("tlb", optional($.tlb_serialization)),
optional(seq("=", field("value", $._expression))),
),

storage_variable: ($) => seq($._field, ";"),

/* Contracts, Traits */

contract: ($) =>
Expand Down
63 changes: 35 additions & 28 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 497f045

Please sign in to comment.