mirror of https://github.com/Wilfred/difftastic/
Fix multiline comments & add highlights
parent
3644348e66
commit
eac9a3b601
@ -1 +1,122 @@
|
||||
; TODO: add queries
|
||||
;; 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
|
||||
|
||||
@ -1 +1,171 @@
|
||||
; TODO: add queries
|
||||
;; XML declaration
|
||||
|
||||
(XMLDecl "xml" @keyword)
|
||||
|
||||
(XMLDecl [ "version" "encoding" "standalone" ] @property)
|
||||
|
||||
(XMLDecl (EncName) @string.special)
|
||||
|
||||
(XMLDecl (VersionNum) @number)
|
||||
|
||||
(XMLDecl [ "yes" "no" ] @boolean)
|
||||
|
||||
;; 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)
|
||||
|
||||
;; Processing instructions
|
||||
|
||||
(XmlModelPI "xml-model" @keyword)
|
||||
|
||||
(StyleSheetPI "xml-stylesheet" @keyword)
|
||||
|
||||
(PseudoAtt (Name) @property)
|
||||
|
||||
(PseudoAtt (PseudoAttValue) @string)
|
||||
|
||||
;; Doctype declaration
|
||||
|
||||
(doctypedecl "DOCTYPE" @keyword)
|
||||
|
||||
(doctypedecl (Name) @type)
|
||||
|
||||
;; Tags
|
||||
|
||||
(STag (Name) @tag)
|
||||
|
||||
(ETag (Name) @tag)
|
||||
|
||||
(EmptyElemTag (Name) @tag)
|
||||
|
||||
;; Attributes
|
||||
|
||||
(Attribute (Name) @property)
|
||||
|
||||
(Attribute (AttValue) @string)
|
||||
|
||||
;; Text
|
||||
|
||||
(CharData) @markup
|
||||
|
||||
(CDSect
|
||||
(CDStart) @markup.heading
|
||||
(CData) @markup.raw
|
||||
"]]>" @markup.heading)
|
||||
|
||||
;; Delimiters & punctuation
|
||||
|
||||
[
|
||||
"<?" "?>"
|
||||
"<!" "]]>"
|
||||
"<" ">"
|
||||
"</" "/>"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"(" ")"
|
||||
"[" "]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "\"" "'" ] @punctuation.delimiter
|
||||
|
||||
[ "," "|" "=" ] @operator
|
||||
|
||||
;; Misc
|
||||
|
||||
[ "INCLUDE" "IGNORE" ] @keyword
|
||||
|
||||
(Comment) @comment
|
||||
|
||||
(ERROR) @error
|
||||
|
||||
Loading…
Reference in New Issue