diff options
| author | ObserverOfTime <chronobserver@disroot.org> | 2023-08-04 14:50:28 +0300 |
|---|---|---|
| committer | ObserverOfTime <chronobserver@disroot.org> | 2023-08-13 10:34:57 +0300 |
| commit | 5b3dd8cff1064db583ddd3edd314e94a02ea1bef (patch) | |
| tree | 2a8ae4546d07a867531e7f861e48c004050ecf7f /queries/xml | |
| parent | fixup: php injections (diff) | |
| download | nvim-treesitter-5b3dd8cff1064db583ddd3edd314e94a02ea1bef.tar nvim-treesitter-5b3dd8cff1064db583ddd3edd314e94a02ea1bef.tar.gz nvim-treesitter-5b3dd8cff1064db583ddd3edd314e94a02ea1bef.tar.bz2 nvim-treesitter-5b3dd8cff1064db583ddd3edd314e94a02ea1bef.tar.lz nvim-treesitter-5b3dd8cff1064db583ddd3edd314e94a02ea1bef.tar.xz nvim-treesitter-5b3dd8cff1064db583ddd3edd314e94a02ea1bef.tar.zst nvim-treesitter-5b3dd8cff1064db583ddd3edd314e94a02ea1bef.zip | |
feat: add xml & dtd parsers
Diffstat (limited to 'queries/xml')
| -rw-r--r-- | queries/xml/folds.scm | 5 | ||||
| -rw-r--r-- | queries/xml/highlights.scm | 53 | ||||
| -rw-r--r-- | queries/xml/indents.scm | 16 | ||||
| -rw-r--r-- | queries/xml/injections.scm | 29 |
4 files changed, 103 insertions, 0 deletions
diff --git a/queries/xml/folds.scm b/queries/xml/folds.scm new file mode 100644 index 000000000..494e8c00a --- /dev/null +++ b/queries/xml/folds.scm @@ -0,0 +1,5 @@ +[ + (element) + (doctypedecl) + (Comment) +] @fold diff --git a/queries/xml/highlights.scm b/queries/xml/highlights.scm new file mode 100644 index 000000000..e47636ac4 --- /dev/null +++ b/queries/xml/highlights.scm @@ -0,0 +1,53 @@ +; inherits: dtd + +;; XML declaration + +(XMLDecl "standalone" @tag.attribute) + +(XMLDecl [ "yes" "no" ] @boolean) + +;; Processing instructions + +(XmlModelPI "xml-model" @preproc) + +(StyleSheetPI "xml-stylesheet" @preproc) + +(PseudoAtt (Name) @tag.attribute) + +(PseudoAtt (PseudoAttValue) @string) + +;; Doctype declaration + +(doctypedecl "DOCTYPE" @define) + +(doctypedecl (Name) @type.definition) + +;; Tags + +(STag (Name) @tag) + +(ETag (Name) @tag) + +(EmptyElemTag (Name) @tag) + +;; Attributes + +(Attribute (Name) @tag.attribute) + +(Attribute (AttValue) @string) + +;; Text + +(CharData) @text @spell + +((CDSect + (CDStart) @text.environment + (CData) @text.literal + "]]>" @text.environment) + (#set! "priority" 105)) + +;; Delimiters & punctuation + +[ "<" "</" "/>" ] @tag.delimiter + +"]" @punctuation.bracket diff --git a/queries/xml/indents.scm b/queries/xml/indents.scm new file mode 100644 index 000000000..24cd75cfa --- /dev/null +++ b/queries/xml/indents.scm @@ -0,0 +1,16 @@ +(element) @indent.begin + +[ + (Attribute) + (AttlistDecl) + (contentspec) +] @indent.align + +(ETag) @indent.dedent + +(doctypedecl) @indent.ignore + +[ + (Comment) + (ERROR) +] @indent.auto diff --git a/queries/xml/injections.scm b/queries/xml/injections.scm new file mode 100644 index 000000000..99b3a9cc8 --- /dev/null +++ b/queries/xml/injections.scm @@ -0,0 +1,29 @@ +((Comment) @injection.content + (#set! injection.language "comment")) + +; SVG style +((element + (STag (Name) @_name) + (content) @injection.content) + (#eq? @_name "style") + (#set! injection.combined) + (#set! injection.include-children) + (#set! injection.language "css")) + +; SVG script +((element + (STag (Name) @_name) + (content) @injection.content) + (#eq? @_name "script") + (#set! injection.combined) + (#set! injection.include-children) + (#set! injection.language "javascript")) + +; phpMyAdmin dump +((element + (STag (Name) @_name) + (content) @injection.content) + (#eq? @_name "pma:table") + (#set! injection.combined) + (#set! injection.include-children) + (#set! injection.language "sql")) |
