aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/sparql
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/sparql
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/sparql')
-rw-r--r--runtime/queries/sparql/folds.scm26
-rw-r--r--runtime/queries/sparql/highlights.scm249
-rw-r--r--runtime/queries/sparql/indents.scm18
-rw-r--r--runtime/queries/sparql/injections.scm8
-rw-r--r--runtime/queries/sparql/locals.scm14
5 files changed, 315 insertions, 0 deletions
diff --git a/runtime/queries/sparql/folds.scm b/runtime/queries/sparql/folds.scm
new file mode 100644
index 000000000..2b93a7bc7
--- /dev/null
+++ b/runtime/queries/sparql/folds.scm
@@ -0,0 +1,26 @@
+[
+ (prologue)
+ (select_query)
+ (construct_query)
+ (describe_query)
+ (ask_query)
+ (values_clause)
+ (load)
+ (clear)
+ (drop)
+ (add)
+ (move)
+ (copy)
+ (create)
+ (insert_data)
+ (delete_data)
+ (delete_where)
+ (modify)
+ (group_graph_pattern)
+ (triples_same_subject)
+ (where_clause)
+ (delete_clause)
+ (insert_clause)
+ (data_block)
+ (blank_node_property_list)
+] @fold
diff --git a/runtime/queries/sparql/highlights.scm b/runtime/queries/sparql/highlights.scm
new file mode 100644
index 000000000..19c0257ca
--- /dev/null
+++ b/runtime/queries/sparql/highlights.scm
@@ -0,0 +1,249 @@
+[
+ (path_mod)
+ "||"
+ "&&"
+ "="
+ "<"
+ ">"
+ "<="
+ ">="
+ "+"
+ "-"
+ "*"
+ "/"
+ "!"
+ "|"
+ "^"
+] @operator
+
+[
+ "_:"
+ (namespace)
+] @module
+
+[
+ "UNDEF"
+ "a"
+] @variable.builtin
+
+[
+ "ADD"
+ "ALL"
+ "AS"
+ "ASC"
+ "ASK"
+ "BIND"
+ "BY"
+ "CLEAR"
+ "CONSTRUCT"
+ "COPY"
+ "CREATE"
+ "DEFAULT"
+ "DELETE"
+ "DELETE DATA"
+ "DELETE WHERE"
+ "DESC"
+ "DESCRIBE"
+ "DISTINCT"
+ "DROP"
+ "EXISTS"
+ "FILTER"
+ "FROM"
+ "GRAPH"
+ "GROUP"
+ "HAVING"
+ "INSERT"
+ "INSERT DATA"
+ "INTO"
+ "LIMIT"
+ "LOAD"
+ "MINUS"
+ "MOVE"
+ "NAMED"
+ "NOT"
+ "OFFSET"
+ "OPTIONAL"
+ "ORDER"
+ "PREFIX"
+ "REDUCED"
+ "SELECT"
+ "SERVICE"
+ "SILENT"
+ "UNION"
+ "USING"
+ "VALUES"
+ "WHERE"
+ "WITH"
+] @keyword
+
+(string) @string
+
+(echar) @string.escape
+
+(integer) @number
+
+[
+ (decimal)
+ (double)
+] @number.float
+
+(boolean_literal) @boolean
+
+[
+ "BASE"
+ "PREFIX"
+] @keyword
+
+[
+ "ABS"
+ "AVG"
+ "BNODE"
+ "BOUND"
+ "CEIL"
+ "CONCAT"
+ "COALESCE"
+ "CONTAINS"
+ "DATATYPE"
+ "DAY"
+ "ENCODE_FOR_URI"
+ "FLOOR"
+ "HOURS"
+ "IF"
+ "IRI"
+ "LANG"
+ "LANGMATCHES"
+ "LCASE"
+ "MD5"
+ "MINUTES"
+ "MONTH"
+ "NOW"
+ "RAND"
+ "REGEX"
+ "ROUND"
+ "SECONDS"
+ "SHA1"
+ "SHA256"
+ "SHA384"
+ "SHA512"
+ "STR"
+ "SUM"
+ "MAX"
+ "MIN"
+ "SAMPLE"
+ "GROUP_CONCAT"
+ "SEPARATOR"
+ "COUNT"
+ "STRAFTER"
+ "STRBEFORE"
+ "STRDT"
+ "STRENDS"
+ "STRLANG"
+ "STRLEN"
+ "STRSTARTS"
+ "STRUUID"
+ "TIMEZONE"
+ "TZ"
+ "UCASE"
+ "URI"
+ "UUID"
+ "YEAR"
+ "isBLANK"
+ "isIRI"
+ "isLITERAL"
+ "isNUMERIC"
+ "isURI"
+ "sameTerm"
+] @function.builtin
+
+[
+ "."
+ ","
+ ";"
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+ (nil)
+ (anon)
+] @punctuation.bracket
+
+[
+ "IN"
+ ("NOT"
+ "IN")
+] @keyword.operator
+
+(comment) @comment @spell
+
+; Could this be summarized?
+(select_clause
+ [
+ bound_variable: (var)
+ "*"
+ ] @variable.parameter)
+
+(bind
+ bound_variable: (var) @variable.parameter)
+
+(data_block
+ bound_variable: (var) @variable.parameter)
+
+(group_condition
+ bound_variable: (var) @variable.parameter)
+
+(iri_reference
+ [
+ "<"
+ ">"
+ ] @module)
+
+(lang_tag) @type
+
+(rdf_literal
+ "^^" @type
+ datatype: (_
+ [
+ "<"
+ ">"
+ (namespace)
+ ] @type) @type)
+
+(function_call
+ identifier: (_) @function)
+
+(function_call
+ identifier: (iri_reference
+ [
+ "<"
+ ">"
+ ] @function))
+
+(function_call
+ identifier: (prefixed_name
+ (namespace) @function))
+
+(base_declaration
+ (iri_reference
+ [
+ "<"
+ ">"
+ ] @variable))
+
+(prefix_declaration
+ (iri_reference
+ [
+ "<"
+ ">"
+ ] @variable))
+
+[
+ (var)
+ (blank_node_label)
+ (iri_reference)
+ (prefixed_name)
+] @variable
diff --git a/runtime/queries/sparql/indents.scm b/runtime/queries/sparql/indents.scm
new file mode 100644
index 000000000..e070546df
--- /dev/null
+++ b/runtime/queries/sparql/indents.scm
@@ -0,0 +1,18 @@
+[
+ (group_graph_pattern)
+ (triples_block)
+ (triples_template)
+ (construct_template)
+ (construct_triples)
+ (quads)
+ (data_block)
+ (blank_node_property_list)
+ (collection)
+] @indent.begin
+
+[
+ "}"
+ "]"
+ ")"
+ (triples_same_subject)
+] @indent.branch
diff --git a/runtime/queries/sparql/injections.scm b/runtime/queries/sparql/injections.scm
new file mode 100644
index 000000000..bce9a19ee
--- /dev/null
+++ b/runtime/queries/sparql/injections.scm
@@ -0,0 +1,8 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
+
+(regex_expression
+ pattern: (rdf_literal
+ value: (string) @injection.content)
+ (#offset! @injection.content 0 1 0 -1)
+ (#set! injection.language "regex"))
diff --git a/runtime/queries/sparql/locals.scm b/runtime/queries/sparql/locals.scm
new file mode 100644
index 000000000..cbb2bb252
--- /dev/null
+++ b/runtime/queries/sparql/locals.scm
@@ -0,0 +1,14 @@
+(group_graph_pattern
+ (triples_block) @local.scope)
+
+((sub_select
+ (select_clause
+ (var) @local.definition.var))
+ (#set! definition.var.scope "parent"))
+
+((select_query
+ (select_clause
+ (var) @local.definition.var))
+ (#set! definition.var.scope "parent"))
+
+(var) @local.reference