From 78e869542022638af482c0dd85a07086a942907a Mon Sep 17 00:00:00 2001
From: Alexander Brevig <alexanderbrevig@gmail.com>
Date: Tue, 6 Jun 2023 15:14:34 +0200
Subject: [PATCH] Add support for Forth (#7256)

---
 book/src/generated/lang-support.md   |  1 +
 languages.toml                       | 13 +++++++++++++
 runtime/queries/forth/highlights.scm |  8 ++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 runtime/queries/forth/highlights.scm

diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 59fe310f..b8753d58 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -41,6 +41,7 @@
 | erlang | ✓ | ✓ |  | `erlang_ls` |
 | esdl | ✓ |  |  |  |
 | fish | ✓ | ✓ | ✓ |  |
+| forth | ✓ |  |  |  |
 | fortran | ✓ |  | ✓ | `fortls` |
 | gdscript | ✓ | ✓ | ✓ |  |
 | git-attributes | ✓ |  |  |  |
diff --git a/languages.toml b/languages.toml
index 4930b067..219ea541 100644
--- a/languages.toml
+++ b/languages.toml
@@ -2592,3 +2592,16 @@ indent = { tab-width = 4, unit = "    " }
 [[grammar]]
 name = "blueprint"
 source = { git = "https://gitlab.com/gabmus/tree-sitter-blueprint", rev = "7f1a5df44861291d6951b6b2146a9fef4c226e14" }
+
+[[language]]
+name = "forth"
+scope = "source.forth"
+injection-regex = "forth"
+file-types = ["fs", "forth", "fth", "4th"]
+roots = []
+comment-token = "\\"
+indent = { tab-width = 3, unit = "   " }
+
+[[grammar]]
+name = "forth"
+source = { git = "https://github.com/alexanderbrevig/tree-sitter-forth", rev = "c6fae50a17763af827604627c0fa9e4604aaac0b" }
diff --git a/runtime/queries/forth/highlights.scm b/runtime/queries/forth/highlights.scm
new file mode 100644
index 00000000..7be0d132
--- /dev/null
+++ b/runtime/queries/forth/highlights.scm
@@ -0,0 +1,8 @@
+([(start_definition)(end_definition)] @keyword)
+([(lparen) (rparen)] @punctuation.bracket)
+((stack_effect_sep) @punctuation)
+((number) @constant)
+((word) @function)
+((comment) @comment)
+([(core)] @type)
+([(operator)] @operator)