From 09700b88b41ed96391de3d2010d74dc54fd5c210 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 25 Jun 2024 09:31:11 +0200 Subject: [PATCH] feat(tact): update parser and queries --- lockfile.json | 2 +- queries/tact/folds.scm | 2 +- queries/tact/highlights.scm | 38 ++++++++++++++++++------------------- queries/tact/locals.scm | 17 ++++++++++------- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/lockfile.json b/lockfile.json index bd13e07ea..257a6ec6c 100644 --- a/lockfile.json +++ b/lockfile.json @@ -711,7 +711,7 @@ "revision": "b1170880c61355aaf38fc06f4af7d3c55abdabc4" }, "tact": { - "revision": "034df2162ed7b654efd999942e266be713c7cde0" + "revision": "91cc49a83f4f0b3a756bf7d0e65403a9cf757003" }, "tcl": { "revision": "8784024358c233efd0f3a6fd9e7a3c5852e628bc" diff --git a/queries/tact/folds.scm b/queries/tact/folds.scm index 8e286c340..03713dd7c 100644 --- a/queries/tact/folds.scm +++ b/queries/tact/folds.scm @@ -1,6 +1,6 @@ [ ; import … - (import_statement)+ + (import)+ ; (…, …) (parameter_list) (argument_list) diff --git a/queries/tact/highlights.scm b/queries/tact/highlights.scm index 394463c65..d5bec39fa 100644 --- a/queries/tact/highlights.scm +++ b/queries/tact/highlights.scm @@ -108,7 +108,7 @@ ; string.special.path ; ------------------- -(import_statement +(import library: (string) @string.special.path) ; boolean @@ -117,7 +117,10 @@ ; constant ; -------- -(constant +(global_constant + name: (identifier) @constant) + +(storage_constant name: (identifier) @constant) ; constant.builtin @@ -142,17 +145,12 @@ (field_access_expression name: (identifier) @variable.member) -(trait_body - (constant - name: (identifier) @variable.member)) - -(contract_body - (constant - name: (identifier) @variable.member)) - (field name: (identifier) @variable.member) +(storage_variable + name: (identifier) @variable.member) + ; number ; ------ (integer) @number @@ -248,7 +246,7 @@ (native_function name: (identifier) @function) -(static_function +(global_function name: (identifier) @function) (func_identifier) @function @@ -267,7 +265,7 @@ (external_function "external" @function.method) -(function +(storage_function name: (identifier) @function.method) ; function.call @@ -289,19 +287,19 @@ "contractAddress" "contractAddressExt" "emit" "cell" "ton" "dump" "dumpStack" "beginString" "beginComment" "beginTailString" "beginStringFromBuilder" "beginCell" "emptyCell" "randomInt" "random" "checkSignature" "checkDataSignature" "sha256" "min" "max" "abs" "pow" "pow2" "throw" - "nativeThrowWhen" "nativeThrowUnless" "getConfigParam" "nativeRandomize" "nativeRandomizeLt" + "nativeThrowIf" "nativeThrowUnless" "getConfigParam" "nativeRandomize" "nativeRandomizeLt" "nativePrepareRandom" "nativeRandom" "nativeRandomInterval" "nativeReserve")) -; comment -; ------- -(comment) @comment @spell - -((comment) @comment.documentation - (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) - ; attribute ; --------- [ "@name" "@interface" ] @attribute + +; comment +; ------- +(comment) @comment @spell + +((comment) @comment.documentation + (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) diff --git a/queries/tact/locals.scm b/queries/tact/locals.scm index 87ad953ff..0c1522606 100644 --- a/queries/tact/locals.scm +++ b/queries/tact/locals.scm @@ -1,12 +1,12 @@ ; Scopes @local.scope ; ------------------------- [ - (static_function) + (global_function) (init_function) (bounced_function) (receive_function) (external_function) - (function) + (storage_function) (block_statement) ] @local.scope @@ -17,11 +17,14 @@ name: (identifier) @local.definition.var) ; constants -(constant +(global_constant + name: (identifier) @local.definition.constant) + +(storage_constant name: (identifier) @local.definition.constant) ; functions -(static_function +(global_function name: (identifier) @local.definition.function (#set! definition.var.scope parent)) @@ -42,7 +45,7 @@ "external" @local.definition.method (#set! definition.var.scope parent)) -(function +(storage_function name: (identifier) @local.definition.method (#set! definition.var.scope parent)) @@ -53,12 +56,12 @@ ; user-defined types (structs and messages) (type_identifier) @local.definition.type -; fields (and properties) +; fields (of messages and structs) (field name: (identifier) @local.definition.field) ; imports -(import_statement +(import (string) @local.definition.import) ; References @local.reference