difftastic/vendored_parsers/tree-sitter-xml/tree-sitter-dtd/queries/highlights.scm

123 lines
1.7 KiB
Scheme

;; XML declaration
(XMLDecl "xml" @keyword)
(XMLDecl [ "version" "encoding" ] @property)
(XMLDecl (EncName) @string.special)
(XMLDecl (VersionNum) @number)
;; Processing instructions
(PI) @embedded
(PI (PITarget) @keyword)
;; Element declaration
(elementdecl
"ELEMENT" @keyword
(Name) @tag)
(contentspec
(_ (Name) @property))
"#PCDATA" @type.builtin
[ "EMPTY" "ANY" ] @string.special.symbol
[ "*" "?" "+" ] @operator
;; Entity declaration
(GEDecl
"ENTITY" @keyword
(Name) @constant)
(GEDecl (EntityValue) @string)
(NDataDecl
"NDATA" @keyword
(Name) @label)
;; Parsed entity declaration
(PEDecl
"ENTITY" @keyword
"%" @operator
(Name) @constant)
(PEDecl (EntityValue) @string)
;; Notation declaration
(NotationDecl
"NOTATION" @keyword
(Name) @constant)
(NotationDecl
(ExternalID
(SystemLiteral (URI) @string.special)))
;; Attlist declaration
(AttlistDecl
"ATTLIST" @keyword
(Name) @tag)
(AttDef (Name) @property)
(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
"&" "<" ">" """ "'"))
(CharRef) @constant
(PEReference) @constant
;; External references
[ "PUBLIC" "SYSTEM" ] @keyword
(PubidLiteral) @string.special
(SystemLiteral (URI) @markup.link)
;; Delimiters & punctuation
[ "<?" "?>" "<!" ">" "]]>" ] @punctuation.delimiter
[ "(" ")" "[" ] @punctuation.bracket
[ "\"" "'" ] @punctuation.delimiter
[ "," "|" "=" ] @operator
;; Misc
[ "INCLUDE" "IGNORE" ] @keyword
(Comment) @comment
(ERROR) @error