changeset 6689:5360cbc0b31e

Add Prolog tree-sitter grammar (#11611)
author Max <max@mkor.je>
date Sun, 06 Apr 2025 16:43:53 +0000
parents 6e430ee8bbed
children 053fee8e9b8a
files book/src/generated/lang-support.md languages.toml runtime/queries/prolog/folds.scm runtime/queries/prolog/highlights.scm runtime/queries/prolog/indents.scm runtime/queries/prolog/injections.scm
diffstat 6 files changed, 68 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/book/src/generated/lang-support.md	Sun Apr 06 12:41:53 2025 -0400
+++ b/book/src/generated/lang-support.md	Sun Apr 06 16:43:53 2025 +0000
@@ -175,7 +175,7 @@
 | ponylang | ✓ | ✓ | ✓ |  |
 | powershell | ✓ |  |  |  |
 | prisma | ✓ | ✓ |  | `prisma-language-server` |
-| prolog |  |  |  | `swipl` |
+| prolog | ✓ |  | ✓ | `swipl` |
 | protobuf | ✓ | ✓ | ✓ | `buf`, `pb`, `protols` |
 | prql | ✓ |  |  |  |
 | purescript | ✓ | ✓ |  | `purescript-language-server` |
--- a/languages.toml	Sun Apr 06 12:41:53 2025 -0400
+++ b/languages.toml	Sun Apr 06 16:43:53 2025 +0000
@@ -1501,6 +1501,10 @@
 block-comment-tokens = { start = "/*", end = "*/" }
 language-servers = [ "swipl" ]
 
+[[grammar]]
+name = "prolog"
+source = { git = "https://codeberg.org/foxy/tree-sitter-prolog", subpath = "grammars/prolog", rev = "d8d415f6a1cf80ca138524bcc395810b176d40fa" }
+
 [[language]]
 name = "tsq"
 scope = "source.tsq"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/queries/prolog/folds.scm	Sun Apr 06 16:43:53 2025 +0000
@@ -0,0 +1,6 @@
+[
+  (directive_term)
+  (clause_term)
+  (arg_list)
+  (list_notation)
+] @fold
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/queries/prolog/highlights.scm	Sun Apr 06 16:43:53 2025 +0000
@@ -0,0 +1,43 @@
+(comment) @comment
+
+(atom) @constant
+
+((atom) @constant.builtin.boolean
+  (#any-of? @constant.builtin.boolean "true" "false"))
+
+(functional_notation
+  function: (atom) @function)
+
+(integer) @constant.numeric.integer
+
+(float_number) @constant.numeric.float
+
+(directive_head) @operator
+
+(operator_notation
+  operator: _ @operator)
+
+[
+ (open)
+ (open_ct)
+ (close)
+ (open_list)
+ "|"
+ (close_list)
+ (open_curly)
+ (close_curly)
+] @punctuation.bracket
+
+[
+ (arg_list_separator)
+ (comma)
+ (end)
+ (list_notation_separator)
+] @punctuation.delimiter
+
+(operator_notation
+  operator: (semicolon) @punctuation.delimiter)
+
+(double_quoted_list_notation) @string
+
+(variable_term) @variable
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/queries/prolog/indents.scm	Sun Apr 06 16:43:53 2025 +0000
@@ -0,0 +1,12 @@
+(functional_notation
+  (atom)
+  (open_ct) @indent
+  (close) @outdent)
+
+(list_notation
+  (open_list) @indent
+  (close_list) @outdent)
+
+(curly_bracketed_notation
+  (open_curly) @indent
+  (close_curly) @outdent)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/queries/prolog/injections.scm	Sun Apr 06 16:43:53 2025 +0000
@@ -0,0 +1,2 @@
+((comment) @injection.content
+  (#set! injection.language "comment"))