Unnamed repository; edit this file 'description' to name the repository.
add ebnf language (#15267)
* add ebnf language * Update runtime/queries/ebnf/highlights.scm Co-authored-by: Michael Davis <[email protected]> --------- Co-authored-by: Michael Davis <[email protected]>
Milo Moisson 3 months ago
parent 45c7c6a · commit 5e37559
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml15
-rw-r--r--runtime/queries/c/highlights.scm1
-rw-r--r--runtime/queries/ebnf/highlights.scm34
4 files changed, 50 insertions, 1 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 768a9084..a3294acd 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -60,6 +60,7 @@
| dune | ✓ | | | | | |
| dunstrc | ✓ | | | | | |
| earthfile | ✓ | ✓ | ✓ | | | `earthlyls` |
+| ebnf | ✓ | | | | | `ebnfer` |
| edoc | ✓ | | | | | |
| eex | ✓ | | | | | |
| eiffel | ✓ | ✓ | ✓ | | | `eiffel-language-server` |
diff --git a/languages.toml b/languages.toml
index 297aa454..3fa0c386 100644
--- a/languages.toml
+++ b/languages.toml
@@ -176,6 +176,7 @@ teal-language-server = { command = "teal-language-server" }
wasm-language-tools = { command = "wat_server" }
sourcepawn-studio = { command = "sourcepawn-studio" }
luau = { command = "luau-lsp", args = ["lsp"] }
+ebnfer = { command = "ebnfer" }
zizmor = { command = "zizmor", args = ["--lsp"]}
[language-server.actions-language-server]
@@ -5384,6 +5385,20 @@ name = "gnuplot"
source = { git = "https://codeberg.org/maribu/tree-sitter-gnuplot", rev = "21a3a3929facb964b3592daeb69119294ff84cf2" }
[[language]]
+name = "ebnf"
+scope = "source.ebnf"
+file-types = ["ebnf"]
+injection-regex = "ebnf"
+language-servers = ["ebnfer"]
+indent = { tab-width = 4, unit = " " }
+block-comment-tokens = { end = "*)", start = "(*" }
+
+
+[[grammar]]
+name = "ebnf"
+source = { git = "https://github.com/RubixDev/ebnf/", rev = "8e635b0b723c620774dfb8abf382a7f531894b40", subpath = "crates/tree-sitter-ebnf" }
+
+[[language]]
name = "drools"
scope = "source.drools"
file-types = ["drl"]
diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm
index 706e68b7..2cb05217 100644
--- a/runtime/queries/c/highlights.scm
+++ b/runtime/queries/c/highlights.scm
@@ -1,4 +1,3 @@
-
(identifier) @variable
((identifier) @constant
diff --git a/runtime/queries/ebnf/highlights.scm b/runtime/queries/ebnf/highlights.scm
new file mode 100644
index 00000000..5089073c
--- /dev/null
+++ b/runtime/queries/ebnf/highlights.scm
@@ -0,0 +1,34 @@
+;; Simple tokens
+(terminal) @string
+
+(special_sequence) @string.special
+
+(integer) @constant.numeric.integer
+
+(comment) @comment.block
+
+;; Identifiers
+(identifier) @identifier
+
+;; Punctuation
+[
+ ";"
+ ","
+] @punctuation.delimiter
+
+[
+ "|"
+ "*"
+ "-"
+] @operator
+
+"=" @keyword.operator
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket