aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFanda Vacek2022-05-01 14:34:46 +0000
committerGitHub2022-05-01 14:34:46 +0000
commit166818359030cd1649327160c9020d943a8de244 (patch)
tree035f3756290d151247ff164711f55227ca4ed91f
parentede01b5f1eb072022cb320d7ffddd0ecf6e1dab6 (diff)
feat(lang): Cpon lang support (#2355)
Co-authored-by: Fanda Vacek <fvacek@elektroline.cz>
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml14
-rw-r--r--runtime/queries/cpon/highlights.scm26
-rw-r--r--runtime/queries/cpon/indents.scm12
4 files changed, 53 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index ca2be23b..5c5ecaaf 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -6,6 +6,7 @@
| cairo | ✓ | | | |
| cmake | ✓ | ✓ | ✓ | `cmake-language-server` |
| comment | ✓ | | | |
+| cpon | ✓ | | ✓ | |
| cpp | ✓ | ✓ | ✓ | `clangd` |
| css | ✓ | | | `vscode-css-language-server` |
| dart | ✓ | | ✓ | `dart` |
diff --git a/languages.toml b/languages.toml
index f065b109..10f8f844 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1289,3 +1289,17 @@ indent = { tab-width = 4, unit = " " }
[[grammar]]
name = "cairo"
source = { git = "https://github.com/archseer/tree-sitter-cairo", rev = "5155c6eb40db6d437f4fa41b8bcd8890a1c91716" }
+
+[[language]]
+name = "cpon"
+scope = "scope.cpon"
+injection-regex = "^cpon$"
+file-types = ["cpon", "cp"]
+roots = []
+auto-format = true
+comment-token = "//"
+indent = { tab-width = 2, unit = " " }
+
+[[grammar]]
+name = "cpon"
+source = { git = "https://github.com/fvacek/tree-sitter-cpon", rev = "11ba46a4de3eb86934003133099c9963a60f9687" }
diff --git a/runtime/queries/cpon/highlights.scm b/runtime/queries/cpon/highlights.scm
new file mode 100644
index 00000000..f85caf46
--- /dev/null
+++ b/runtime/queries/cpon/highlights.scm
@@ -0,0 +1,26 @@
+[
+ (true)
+ (false)
+] @constant.builtin.boolean
+(null) @constant.builtin
+(number) @constant.numeric
+(pair
+ key: (_) @keyword)
+(ipair
+ key: (_) @keyword)
+(mpair
+ key: (_) @keyword)
+
+(string) @string
+(escape_sequence) @constant.character.escape
+(ERROR) @error
+
+"," @punctuation.delimiter
+[
+ "["
+ "]"
+ "{"
+ "}"
+ "<"
+ ">"
+] @punctuation.bracket
diff --git a/runtime/queries/cpon/indents.scm b/runtime/queries/cpon/indents.scm
new file mode 100644
index 00000000..53c82767
--- /dev/null
+++ b/runtime/queries/cpon/indents.scm
@@ -0,0 +1,12 @@
+[
+ (meta)
+ (map)
+ (imap)
+ (array)
+] @indent
+
+[
+ "]"
+ "}"
+ ">"
+] @outdent