Skip to content

Commit c877555

Browse files
authored
feat(grammar): port remaining grammar changes for 1.6.0 (#359)
1 parent f3d1620 commit c877555

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

tree-sitter-tact/grammar.js

+27-2
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,18 @@ module.exports = grammar({
218218
asm_arrangement_rets: ($) =>
219219
seq("->", repeat1(alias($._decimal_integer, $.integer))),
220220

221+
// NOTE:
222+
// The following asm-related pieces intentionally differ from the grammar.gg.
223+
// This is done to provide a better API for the language server.
224+
//
225+
// There's no catch because there's no well-defined Tact assembly syntax
226+
// that we've agreed upon — the current parser in the compiler
227+
// simply produces a large string to be passed as-is to the rest of the pipeline.
228+
//
229+
// Therefore, most of the things below would be internally refactored and/or removed completely once there's a proper definition of the Tact assembly.
230+
// (That does NOT require Fift removal, a first step might be just
231+
// converting our syntax to bits of the Fift syntax seen below)
232+
//
221233
asm_function_body: ($) => seq("{", repeat($.asm_expression), "}"),
222234

223235
// Zero or more arguments, followed by a TVM instruction
@@ -379,7 +391,7 @@ module.exports = grammar({
379391
field("body", alias($.struct_body, $.message_body)),
380392
),
381393

382-
message_value: ($) => seq("(", $.integer, ")"),
394+
message_value: ($) => seq("(", $._expression, ")"),
383395

384396
struct_body: ($) => seq("{", semicolonSepWithTrailing($.field), "}"),
385397

@@ -602,7 +614,20 @@ module.exports = grammar({
602614
field("left", $._path_expression),
603615
field(
604616
"operator",
605-
choice("+=", "-=", "*=", "/=", "%=", "&=", "|=", "^="),
617+
choice(
618+
"+=",
619+
"-=",
620+
"*=",
621+
"/=",
622+
"%=",
623+
"&=",
624+
"|=",
625+
"^=",
626+
"||=",
627+
"&&=",
628+
">>=",
629+
"<<=",
630+
),
606631
),
607632
field("right", $._expression),
608633
),

0 commit comments

Comments
 (0)