aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/dtd
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/dtd
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/dtd')
-rw-r--r--runtime/queries/dtd/folds.scm4
-rw-r--r--runtime/queries/dtd/highlights.scm148
-rw-r--r--runtime/queries/dtd/injections.scm2
-rw-r--r--runtime/queries/dtd/locals.scm11
4 files changed, 165 insertions, 0 deletions
diff --git a/runtime/queries/dtd/folds.scm b/runtime/queries/dtd/folds.scm
new file mode 100644
index 000000000..b1bce4ffb
--- /dev/null
+++ b/runtime/queries/dtd/folds.scm
@@ -0,0 +1,4 @@
+[
+ (conditionalSect)
+ (Comment)
+] @fold
diff --git a/runtime/queries/dtd/highlights.scm b/runtime/queries/dtd/highlights.scm
new file mode 100644
index 000000000..9afd6e38b
--- /dev/null
+++ b/runtime/queries/dtd/highlights.scm
@@ -0,0 +1,148 @@
+; Text declaration
+(TextDecl
+ "xml" @keyword.directive)
+
+(TextDecl
+ [
+ "version"
+ "encoding"
+ ] @tag.attribute)
+
+(TextDecl
+ (EncName) @string.special)
+
+(TextDecl
+ (VersionNum) @number)
+
+; Processing instructions
+(PI) @keyword.directive
+
+; Element declaration
+(elementdecl
+ "ELEMENT" @keyword.directive.define
+ (Name) @tag)
+
+(contentspec
+ (_
+ (Name) @tag.attribute))
+
+"#PCDATA" @type.builtin
+
+[
+ "EMPTY"
+ "ANY"
+] @keyword.modifier
+
+[
+ "*"
+ "?"
+ "+"
+] @character.special
+
+; Entity declaration
+(GEDecl
+ "ENTITY" @keyword.directive.define
+ (Name) @constant)
+
+(GEDecl
+ (EntityValue) @string)
+
+(NDataDecl
+ "NDATA" @keyword
+ (Name) @label)
+
+; Parsed entity declaration
+(PEDecl
+ "ENTITY" @keyword.directive.define
+ "%" @operator
+ (Name) @function.macro)
+
+(PEDecl
+ (EntityValue) @string)
+
+; Notation declaration
+(NotationDecl
+ "NOTATION" @keyword.directive
+ (Name) @label)
+
+; Attlist declaration
+(AttlistDecl
+ "ATTLIST" @keyword.directive.define
+ (Name) @tag)
+
+(AttDef
+ (Name) @tag.attribute)
+
+(AttDef
+ (Enumeration
+ (Nmtoken) @string))
+
+[
+ (StringType)
+ (TokenizedType)
+] @type.builtin
+
+(NotationType
+ "NOTATION" @type.builtin)
+
+[
+ "#REQUIRED"
+ "#IMPLIED"
+ "#FIXED"
+] @attribute
+
+; Entities
+(EntityRef) @constant
+
+((EntityRef) @constant.builtin
+ (#any-of? @constant.builtin "&amp;" "&lt;" "&gt;" "&quot;" "&apos;"))
+
+(CharRef) @character
+
+(PEReference) @function.macro
+
+; External references
+[
+ "PUBLIC"
+ "SYSTEM"
+] @keyword
+
+(PubidLiteral) @string.special
+
+(SystemLiteral
+ (URI) @string.special.url)
+
+; Delimiters & punctuation
+[
+ "<?"
+ "?>"
+ "<!"
+ ">"
+ "<!["
+ "]]>"
+] @tag.delimiter
+
+[
+ "("
+ ")"
+ "["
+] @punctuation.bracket
+
+[
+ "\""
+ "'"
+] @punctuation.delimiter
+
+[
+ ","
+ "|"
+ "="
+] @operator
+
+; Misc
+[
+ "INCLUDE"
+ "IGNORE"
+] @keyword.import
+
+(Comment) @comment @spell
diff --git a/runtime/queries/dtd/injections.scm b/runtime/queries/dtd/injections.scm
new file mode 100644
index 000000000..57fae5832
--- /dev/null
+++ b/runtime/queries/dtd/injections.scm
@@ -0,0 +1,2 @@
+((Comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/dtd/locals.scm b/runtime/queries/dtd/locals.scm
new file mode 100644
index 000000000..88246c04a
--- /dev/null
+++ b/runtime/queries/dtd/locals.scm
@@ -0,0 +1,11 @@
+(elementdecl
+ (Name) @local.definition.type)
+
+(elementdecl
+ (contentspec
+ (children
+ (Name) @local.reference)))
+
+(AttlistDecl
+ .
+ (Name) @local.reference)