From 2b16fd43f901753fcedd87b9687ce535c4108203 Mon Sep 17 00:00:00 2001
From: Jaden <thejadenjack@gmail.com>
Date: Wed, 24 Aug 2022 07:51:10 -0700
Subject: [PATCH] feat(lang): Add esdl grammar (#3526)

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

diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 62d7a04f..12a42931 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -24,6 +24,7 @@
 | elvish | ✓ |  |  | `elvish` |
 | erb | ✓ |  |  |  |
 | erlang | ✓ | ✓ |  | `erlang_ls` |
+| esdl | ✓ |  |  |  |
 | fish | ✓ | ✓ | ✓ |  |
 | fortran | ✓ |  | ✓ | `fortls` |
 | gdscript | ✓ |  | ✓ |  |
diff --git a/languages.toml b/languages.toml
index cf834d35..cfacf27f 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1664,3 +1664,16 @@ indent = { tab-width = 4, unit = "    " }
 [[grammar]]
 name = "xit"
 source = { git = "https://github.com/synaptiko/tree-sitter-xit", rev = "7d7902456061bc2ad21c64c44054f67b5515734c" }
+
+[[language]]
+name = "esdl"
+scope = "source.esdl"
+injection-regex = "esdl"
+file-types = ["esdl"]
+comment-token = "#"
+indent = { tab-width = 2, unit = "  " }
+roots = ["edgedb.toml"]
+
+[[grammar]]
+name ="esdl"
+source = { git = "https://github.com/greym0uth/tree-sitter-esdl", rev = "b840c8a8028127e0a7c6e6c45141adade2bd75cf" }
diff --git a/runtime/queries/esdl/highlights.scm b/runtime/queries/esdl/highlights.scm
new file mode 100644
index 00000000..7dfde022
--- /dev/null
+++ b/runtime/queries/esdl/highlights.scm
@@ -0,0 +1,74 @@
+; Keywords
+[
+  "module"
+  "using"
+  "single"
+  "multi"
+  "link"
+  "property"
+  "constraint"
+  "tuple"
+  "annotation"
+  "abstract"
+  "scalar"
+  "type"
+  "required"
+  "optional"
+  "extension"
+  "function"
+] @keyword
+
+(modifier) @keyword
+(extending) @keyword
+
+(module name: (identifier) @namespace)
+(object_type) @type
+
+(comment) @comment
+
+; Properties
+(property) @variable.other.member
+(link) @variable.other.member
+(annotation) @variable.other.member
+
+(identifier) @variable
+(string) @string
+(edgeql_fragment) @string
+; Builtins
+
+(type) @type
+[
+  "str"
+  "bool"
+  "int16"
+  "int32"
+  "int64"
+  "float32"
+  "float64"
+  "bigint"
+  "decimal"
+  "json"
+  "uuid"
+  "bytes"
+  "datetime"
+  "duration"
+  "sequence"
+  "anytype"
+] @type.builtin
+
+(true) @constant.builtin
+(false) @constant.builtin
+(null) @constant.builtin
+
+; Delimiters
+[
+  ";"
+  ","
+] @punctuation.delimiter
+
+; Operators
+[
+  "->"
+  ":="
+] @operator
+