Skip to content
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

feat: match 1.4.0 #33

Merged
merged 8 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ jobs:
test-python: false # default
test-go: false # default
test-swift: false # default

- name: Check correspondence to Ohm parser
run: |
git clone https://github.com/tact-lang/tact.git
npm run parse -- -q tact/src/grammar/test/*.tact
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ log.html
.idea/
.helix/
.vim/

# Emscripten SDK
/emsdk
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tree-sitter-tact"
description = "Tact grammar for the tree-sitter"
version = "1.3.0"
version = "1.4.0"
authors = ["Novus Nota (https://github.com/novusnota)"]
license = "MIT"
keywords = ["incremental", "parsing", "tact"]
Expand Down
2 changes: 1 addition & 1 deletion Makefile

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

40 changes: 19 additions & 21 deletions editor_queries/helix/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@
; variable.other.member
; ---------------------

(field
(storage_variable
name: (identifier) @variable.other.member)

(contract_body
(constant
name: (identifier) @variable.other.member))

(trait_body
(constant
name: (identifier) @variable.other.member))
(field
name: (identifier) @variable.other.member)

(field_access_expression
name: (identifier) @variable.other.member)
Expand Down Expand Up @@ -126,13 +121,16 @@
; string.special.path
; -------------------

(import_statement
(import
library: (string) @string.special.path)

; constant
; --------

(constant
(global_constant
name: (identifier) @constant)

(storage_constant
name: (identifier) @constant)

; constant.character.escape
Expand Down Expand Up @@ -258,7 +256,7 @@
(native_function
name: (identifier) @function)

(static_function
(global_function
name: (identifier) @function)

(static_call_expression
Expand All @@ -276,7 +274,7 @@
(external_function
"external" @function.method)

(function
(storage_function
name: (identifier) @function.method)

; function.method
Expand All @@ -300,10 +298,18 @@
"checkSignature" "checkDataSignature" "sha256"
"min" "max" "abs" "pow" "pow2" "log" "log2"
"throw" "dump" "dumpStack" "getConfigParam"
"nativeThrowWhen" "nativeThrowUnless" "nativeReserve"
"nativeThrowIf" "nativeThrowUnless" "nativeReserve"
"nativeRandomize" "nativeRandomizeLt" "nativePrepareRandom" "nativeRandom" "nativeRandomInterval")
(#is-not? local))

; attribute
; ---------

[
"@name"
"@interface"
] @attribute

; comment.block
; -------------

Expand All @@ -314,11 +320,3 @@

((comment) @comment.line
(#match? @comment.line "^//"))

; attribute
; ---------

[
"@name"
"@interface"
] @attribute
4 changes: 2 additions & 2 deletions editor_queries/helix/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; function.inside & around
; ------------------------

(static_function
(global_function
body: (_) @function.inside) @function.around

(init_function
Expand All @@ -18,7 +18,7 @@
(external_function
body: (_) @function.inside) @function.around

(function
(storage_function
body: (_) @function.inside) @function.around

; class.inside & around
Expand Down
4 changes: 2 additions & 2 deletions editor_queries/neovim/context.scm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

; functions
; ---------
(static_function
(global_function
body: (_
(_) @context.end)) @context

Expand All @@ -39,7 +39,7 @@
body: (_
(_) @context.end)) @context

(function
(storage_function
body: (_
(_) @context.end)) @context

Expand Down
2 changes: 1 addition & 1 deletion editor_queries/neovim/folds.scm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; See: https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#folds
[
; import …
(import_statement)+
(import)+
; (…, …)
(parameter_list)
(argument_list)
Expand Down
38 changes: 18 additions & 20 deletions editor_queries/neovim/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@

; string.special.path
; -------------------
(import_statement
(import
library: (string) @string.special.path)

; boolean
Expand All @@ -119,7 +119,10 @@

; constant
; --------
(constant
(global_constant
name: (identifier) @constant)

(storage_constant
name: (identifier) @constant)

; constant.builtin
Expand All @@ -144,17 +147,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
Expand Down Expand Up @@ -250,7 +248,7 @@
(native_function
name: (identifier) @function)

(static_function
(global_function
name: (identifier) @function)

(func_identifier) @function
Expand All @@ -269,7 +267,7 @@
(external_function
"external" @function.method)

(function
(storage_function
name: (identifier) @function.method)

; function.call
Expand All @@ -291,19 +289,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 "^/[*][*][^*].*[*]/$"))
20 changes: 13 additions & 7 deletions editor_queries/neovim/locals.scm
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,33 @@
; Scopes @local.scope
; -------------------------
[
(static_function)
(global_function)
(init_function)
(bounced_function)
(receive_function)
(external_function)
(function)
(storage_function)
(block_statement)
] @local.scope

; Definitions @local.definition
; ------------------------------
; variables
(storage_variable
name: (identifier) @local.definition.var)

(let_statement
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))

Expand All @@ -45,7 +51,7 @@
"external" @local.definition.method
(#set! definition.var.scope parent))

(function
(storage_function
name: (identifier) @local.definition.method
(#set! definition.var.scope parent))

Expand All @@ -56,12 +62,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
Expand Down
20 changes: 14 additions & 6 deletions editor_queries/neovim/textobjects.scm
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
; See: https://github.com/nvim-treesitter/nvim-treesitter-textobjects#built-in-textobjects
; function.inner & outer
; ----------------------
; static
(static_function
; global
(global_function
body: (_)) @function.outer

(static_function
(global_function
body: (function_body
.
"{"
Expand Down Expand Up @@ -77,10 +77,10 @@
(#make-range! "function.inner" @_start @_end))

; contract/trait function
(function
(storage_function
body: (_)) @function.outer

(function
(storage_function
body: (function_body
.
"{"
Expand Down Expand Up @@ -381,7 +381,15 @@
name: (_) @assignment.lhs
value: (_) @assignment.inner @assignment.rhs) @assignment.outer

(constant
(storage_variable
name: (_) @assignment.lhs
value: (_) @assignment.inner @assignment.rhs) @assignment.outer

(global_constant
name: (_) @assignment.lhs
value: (_) @assignment.inner @assignment.rhs) @assignment.outer

(storage_constant
name: (_) @assignment.lhs
value: (_) @assignment.inner @assignment.rhs) @assignment.outer

Expand Down
Loading