|
| 1 | +;; XML declaration |
| 2 | + |
| 3 | +(XMLDecl "xml" @keyword) |
| 4 | + |
| 5 | +(XMLDecl [ "version" "encoding" "standalone" ] @property) |
| 6 | + |
| 7 | +(XMLDecl (EncName) @string.special) |
| 8 | + |
| 9 | +(XMLDecl (VersionNum) @number) |
| 10 | + |
| 11 | +(XMLDecl [ "yes" "no" ] @boolean) |
| 12 | + |
| 13 | +;; Processing instructions |
| 14 | + |
| 15 | +(PI) @embedded |
| 16 | + |
| 17 | +(PI (PITarget) @keyword) |
| 18 | + |
| 19 | +;; Element declaration |
| 20 | + |
| 21 | +(elementdecl |
| 22 | + "ELEMENT" @keyword |
| 23 | + (Name) @tag) |
| 24 | + |
| 25 | +(contentspec |
| 26 | + (_ (Name) @property)) |
| 27 | + |
| 28 | +"#PCDATA" @type.builtin |
| 29 | + |
| 30 | +[ "EMPTY" "ANY" ] @string |
| 31 | + |
| 32 | +[ "*" "?" "+" ] @operator |
| 33 | + |
| 34 | +;; Entity declaration |
| 35 | + |
| 36 | +(GEDecl |
| 37 | + "ENTITY" @keyword |
| 38 | + (Name) @constant) |
| 39 | + |
| 40 | +(GEDecl (EntityValue) @string) |
| 41 | + |
| 42 | +(NDataDecl |
| 43 | + "NDATA" @keyword |
| 44 | + (Name) @label) |
| 45 | + |
| 46 | +;; Parsed entity declaration |
| 47 | + |
| 48 | +(PEDecl |
| 49 | + "ENTITY" @keyword |
| 50 | + "%" @operator |
| 51 | + (Name) @constant) |
| 52 | + |
| 53 | +(PEDecl (EntityValue) @string) |
| 54 | + |
| 55 | +;; Notation declaration |
| 56 | + |
| 57 | +(NotationDecl |
| 58 | + "NOTATION" @keyword |
| 59 | + (Name) @constant) |
| 60 | + |
| 61 | +(NotationDecl |
| 62 | + (ExternalID |
| 63 | + (SystemLiteral (URI) @string.special))) |
| 64 | + |
| 65 | +;; Attlist declaration |
| 66 | + |
| 67 | +(AttlistDecl |
| 68 | + "ATTLIST" @keyword |
| 69 | + (Name) @tag) |
| 70 | + |
| 71 | +(AttDef (Name) @property) |
| 72 | + |
| 73 | +(AttDef (Enumeration (Nmtoken) @string)) |
| 74 | + |
| 75 | +[ |
| 76 | + (StringType) |
| 77 | + (TokenizedType) |
| 78 | +] @type.builtin |
| 79 | + |
| 80 | +(NotationType "NOTATION" @type.builtin) |
| 81 | + |
| 82 | +[ |
| 83 | + "#REQUIRED" |
| 84 | + "#IMPLIED" |
| 85 | + "#FIXED" |
| 86 | +] @attribute |
| 87 | + |
| 88 | +;; Entities |
| 89 | + |
| 90 | +(EntityRef) @constant |
| 91 | + |
| 92 | +((EntityRef) @constant.builtin |
| 93 | + (#any-of? @constant.builtin |
| 94 | + "&" "<" ">" """ "'")) |
| 95 | + |
| 96 | +(CharRef) @constant |
| 97 | + |
| 98 | +(PEReference) @constant |
| 99 | + |
| 100 | +;; External references |
| 101 | + |
| 102 | +[ "PUBLIC" "SYSTEM" ] @keyword |
| 103 | + |
| 104 | +(PubidLiteral) @string.special |
| 105 | + |
| 106 | +(SystemLiteral (URI) @markup.link) |
| 107 | + |
| 108 | +;; Processing instructions |
| 109 | + |
| 110 | +(XmlModelPI "xml-model" @keyword) |
| 111 | + |
| 112 | +(StyleSheetPI "xml-stylesheet" @keyword) |
| 113 | + |
| 114 | +(PseudoAtt (Name) @property) |
| 115 | + |
| 116 | +(PseudoAtt (PseudoAttValue) @string) |
| 117 | + |
| 118 | +;; Doctype declaration |
| 119 | + |
| 120 | +(doctypedecl "DOCTYPE" @keyword) |
| 121 | + |
| 122 | +(doctypedecl (Name) @type) |
| 123 | + |
| 124 | +;; Tags |
| 125 | + |
| 126 | +(STag (Name) @tag) |
| 127 | + |
| 128 | +(ETag (Name) @tag) |
| 129 | + |
| 130 | +(EmptyElemTag (Name) @tag) |
| 131 | + |
| 132 | +;; Attributes |
| 133 | + |
| 134 | +(Attribute (Name) @property) |
| 135 | + |
| 136 | +(Attribute (AttValue) @string) |
| 137 | + |
| 138 | +;; Text |
| 139 | + |
| 140 | +(CharData) @markup |
| 141 | + |
| 142 | +(CDSect |
| 143 | + (CDStart) @markup.heading |
| 144 | + (CData) @markup.raw |
| 145 | + "]]>" @markup.heading) |
| 146 | + |
| 147 | +;; Delimiters & punctuation |
| 148 | + |
| 149 | +[ |
| 150 | + "<?" "?>" |
| 151 | + "<!" "]]>" |
| 152 | + "<" ">" |
| 153 | + "</" "/>" |
| 154 | +] @punctuation.delimiter |
| 155 | + |
| 156 | +[ |
| 157 | + "(" ")" |
| 158 | + "[" "]" |
| 159 | +] @punctuation.bracket |
| 160 | + |
| 161 | +[ "\"" "'" ] @punctuation.delimiter |
| 162 | + |
| 163 | +[ "," "|" "=" ] @operator |
| 164 | + |
| 165 | +;; Misc |
| 166 | + |
| 167 | +[ "INCLUDE" "IGNORE" ] @keyword |
| 168 | + |
| 169 | +(Comment) @comment |
| 170 | + |
| 171 | +(ERROR) @error |
0 commit comments