aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua8
-rw-r--r--queries/forth/folds.scm1
-rw-r--r--queries/forth/highlights.scm21
-rw-r--r--queries/forth/indents.scm3
-rw-r--r--queries/forth/injections.scm2
-rw-r--r--queries/forth/locals.scm3
8 files changed, 42 insertions, 0 deletions
diff --git a/README.md b/README.md
index 3c3f11751..c701aeed7 100644
--- a/README.md
+++ b/README.md
@@ -222,6 +222,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [firrtl](https://github.com/amaanq/tree-sitter-firrtl) (maintained by @amaanq)
- [x] [fish](https://github.com/ram02z/tree-sitter-fish) (maintained by @ram02z)
- [x] [foam](https://github.com/FoamScience/tree-sitter-foam) (experimental, maintained by @FoamScience)
+- [x] [forth](https://github.com/AlexanderBrevig/tree-sitter-forth) (maintained by @amaanq)
- [x] [fortran](https://github.com/stadelmanma/tree-sitter-fortran) (maintained by @amaanq)
- [x] [fsh](https://github.com/mgramigna/tree-sitter-fsh) (maintained by @mgramigna)
- [x] [func](https://github.com/amaanq/tree-sitter-func) (maintained by @amaanq)
diff --git a/lockfile.json b/lockfile.json
index bc090b73d..8743a10eb 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -146,6 +146,9 @@
"foam": {
"revision": "09e03445f49290450589c5d293610ab39434e3e4"
},
+ "forth": {
+ "revision": "304ed77beb113e37af38b20ff14e3c37bf350d10"
+ },
"fortran": {
"revision": "6828cf3629addb1706bdbbd33491e95f12b7042c"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index a4150c8eb..bd956ea9d 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -487,6 +487,14 @@ list.foam = {
experimental = true,
}
+list.forth = {
+ install_info = {
+ url = "https://github.com/AlexanderBrevig/tree-sitter-forth",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@amaanq" },
+}
+
list.fortran = {
install_info = {
url = "https://github.com/stadelmanma/tree-sitter-fortran",
diff --git a/queries/forth/folds.scm b/queries/forth/folds.scm
new file mode 100644
index 000000000..443abb30d
--- /dev/null
+++ b/queries/forth/folds.scm
@@ -0,0 +1 @@
+(word_definition) @fold
diff --git a/queries/forth/highlights.scm b/queries/forth/highlights.scm
new file mode 100644
index 000000000..e8c53e9ce
--- /dev/null
+++ b/queries/forth/highlights.scm
@@ -0,0 +1,21 @@
+(core) @function
+
+(operator) @operator
+
+(word) @variable
+
+((word) @constant
+ (#lua-match? @constant "^[A-Z_]+$"))
+
+(number) @number
+
+(string) @string
+
+[
+ (start_definition)
+ (end_definition)
+] @punctuation.delimiter
+
+(comment) @comment
+
+(ERROR) @error
diff --git a/queries/forth/indents.scm b/queries/forth/indents.scm
new file mode 100644
index 000000000..067755433
--- /dev/null
+++ b/queries/forth/indents.scm
@@ -0,0 +1,3 @@
+(word_definition) @indent.begin
+
+(end_definition) @indent.end @indent.branch
diff --git a/queries/forth/injections.scm b/queries/forth/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/queries/forth/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/queries/forth/locals.scm b/queries/forth/locals.scm
new file mode 100644
index 000000000..3a5e191d2
--- /dev/null
+++ b/queries/forth/locals.scm
@@ -0,0 +1,3 @@
+(word) @reference
+
+(word_definition) @scope