diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index cb1c815f2..b7c995df2 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -159,7 +159,7 @@ | ponylang | ✓ | ✓ | ✓ | | | powershell | ✓ | | | | | prisma | ✓ | ✓ | | `prisma-language-server` | -| prolog | | | | `swipl` | +| prolog | ✓ | | ✓ | `swipl` | | protobuf | ✓ | ✓ | ✓ | `bufls`, `pb` | | prql | ✓ | | | | | purescript | ✓ | ✓ | | `purescript-language-server` | diff --git a/languages.toml b/languages.toml index cc437f78c..be601852e 100644 --- a/languages.toml +++ b/languages.toml @@ -1380,6 +1380,10 @@ comment-token = "%" block-comment-tokens = { start = "/*", end = "*/" } language-servers = [ "swipl" ] +[[grammar]] +name = "prolog" +source = { git = "https://codeberg.org/foxy/tree-sitter-prolog", subpath = "grammars/prolog", rev = "93c69d2f84d8a167c0a3f4a8d51ccefe365a4dc8" } + [[language]] name = "tsq" scope = "source.tsq" @@ -3785,4 +3789,4 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "thrift" -source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-thrift" , rev = "68fd0d80943a828d9e6f49c58a74be1e9ca142cf" } \ No newline at end of file +source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-thrift" , rev = "68fd0d80943a828d9e6f49c58a74be1e9ca142cf" } diff --git a/runtime/queries/prolog/folds.scm b/runtime/queries/prolog/folds.scm new file mode 100644 index 000000000..70a401511 --- /dev/null +++ b/runtime/queries/prolog/folds.scm @@ -0,0 +1,6 @@ +[ + (directive_term) + (clause_term) + (arg_list) + (list_notation) +] @fold diff --git a/runtime/queries/prolog/highlights.scm b/runtime/queries/prolog/highlights.scm new file mode 100644 index 000000000..a078b8185 --- /dev/null +++ b/runtime/queries/prolog/highlights.scm @@ -0,0 +1,46 @@ +(comment) @comment @spell + +(atom) @constant + +((atom) @boolean + (#eq? @boolean "true")) + +((atom) @boolean + (#eq? @boolean "false")) + +(functional_notation + function: (atom) @function.call) + +(integer) @number + +(float_number) @number.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 diff --git a/runtime/queries/prolog/indents.scm b/runtime/queries/prolog/indents.scm new file mode 100644 index 000000000..a7f9b0383 --- /dev/null +++ b/runtime/queries/prolog/indents.scm @@ -0,0 +1,16 @@ +(directive_term) @indent.zero + +(clause_term) @indent.zero + +(functional_notation + (atom) + (open_ct) @indent.begin + (close) @indent.end) + +(list_notation + (open_list) @indent.begin + (close_list) @indent.end) + +(curly_bracketed_notation + (open_curly) @indent.begin + (close_curly) @indent.end) diff --git a/runtime/queries/prolog/injections.scm b/runtime/queries/prolog/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/runtime/queries/prolog/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment"))