xml.jsf.in (5199B)
1 # Improved XML highlighter by: Brian Candler <B.Candler@pobox.com> 2 3 # Define no. sync lines 4 # You can say: 5 # -200 means 200 lines 6 # - means always start parsing from beginning of file when we lose sync 7 # if nothing is specified, the default is -50 8 9 - 10 11 # Define colors 12 # 13 # bold inverse blink dim underline italic 14 # white cyan magenta blue yellow green red black 15 # bg_white bg_cyan bg_magenta bg_blue bg_yellow bg_green bg_red bg_black 16 17 # The underlines are here right now just because I want to distinguish which 18 # bits have been coloured (say) CdataStart, CdataBody, CdataEnd. And that's 19 # because I think it may be useful to make that distinction for some people. 20 21 =Idle 22 =Error red bold 23 =Tag blue 24 =Attr cyan 25 =Constant blue bold 26 =EntityRef magenta 27 =Decl cyan 28 =CommentStart green 29 =CommentBody green 30 =CommentEnd green 31 =PIStart magenta bold 32 =PIBody magenta 33 =PIEnd magenta bold 34 =CdataStart blue bold 35 =CdataBody bold 36 =CdataEnd blue bold 37 38 # http://www.w3.org/TR/2004/REC-xml-20040204/ 39 # 40 # NOTE: For UNICODE compatibility, the ranges 41 # "A-Za-z_:" -- first character of Name 42 # "A-Za-z0-9._:-" -- subsequent characters of Name 43 # ought to be replaced with some appropriate Unicode character classes 44 # 45 # Actually the standard tells you which characters to use, see: 46 # http://www.w3.org/TR/xml11/#NT-NameStartChar 47 48 :content Idle 49 * content 50 "<" tag recolor=-1 51 "&" entityref recolor=-1 52 53 # > is allowed 54 # ">" error noeat recolor=-1 55 56 57 # In several contexts a space is an error, and since a coloured space is 58 # not visible, we colour the next non-space character as well. 59 60 :error Error 61 * error_visible noeat recolor=-1 62 " \t\r\n" error 63 64 :error_visible Error 65 * content 66 67 # Matched: & 68 69 :entityref EntityRef 70 * error noeat recolor=-1 71 "-.:\c" entityref 72 "#" entityref 73 ";" content 74 75 # Matched: < 76 77 :tag Tag 78 * error noeat recolor=-1 79 "/" end_tag 80 ":\i" start_or_empty_tag 81 "?" pi_start recolor=-2 82 "!" decl recolor=-2 buffer 83 84 # Matched: </ 85 86 :end_tag Tag 87 * error noeat recolor=-1 88 ":\i" end_tag2 89 90 :end_tag2 Tag 91 * error noeat recolor=-1 92 "-.:\c" end_tag2 93 " \t\r\n" end_tag2_sp recolor=-1 94 ">" content 95 96 :end_tag2_sp Idle 97 * end_tag3 noeat 98 99 :end_tag3 Tag 100 * error noeat recolor=-1 101 " \t\r\n" end_tag3_sp recolor=-1 102 ">" content 103 104 :end_tag3_sp Idle 105 * end_tag_3 noeat 106 107 # Matched: <tag 108 109 :start_or_empty_tag Tag 110 * error noeat recolor=-1 111 "-.:\c" start_or_empty_tag 112 "/" empty_tag 113 " \t\r\n" start_or_empty_tag_sp recolor=-1 114 ">" content 115 116 :start_or_empty_tag_sp Idle 117 * tag_space noeat 118 119 # Matched: <tag/ 120 121 :empty_tag Tag 122 * error noeat recolor=-1 123 ">" content 124 125 # Matched: <tag SPACE 126 127 :tag_space Attr 128 * error noeat recolor=-1 129 " \t\r\n" tag_space_sp recolor=-1 130 ":\i" attr 131 "/" empty_tag recolor=-1 132 ">" close_tag recolor=-1 133 134 :tag_space_sp Idle 135 * tag_space noeat 136 137 # Matched: <tag attr 138 139 :attr Attr 140 * error noeat recolor=-1 141 "-.:\c" attr 142 " \t\r\n" attr_sp recolor=-1 143 "=" string 144 145 :attr_sp Idle 146 * attr_before noeat 147 148 :attr_before Attr 149 * error noeat recolor=-1 150 " \t\r\n" attr_sp recolor=-1 151 "=" string 152 153 # Matched: <tag attr= 154 155 :string Attr 156 * error noeat recolor=-1 157 " \t\r\n" string_sp recolor=-1 158 "\"" astring recolor=-1 159 "'" bstring recolor=-1 160 161 :string_sp Idle 162 * string noeat 163 164 # Matched: <tag attr=" 165 166 :astring Constant 167 * astring 168 "<" error noeat recolor=-1 169 "&" achar recolor=-1 170 "\"" endstring 171 172 # ">" error noeat recolor=-1 173 174 175 :bstring Constant 176 * bstring 177 "<" error noeat recolor=-1 178 "&" bchar recolor=-1 179 "'" endstring 180 181 # ">" error noeat recolor=-1 182 183 184 :achar EntityRef 185 * error noeat recolor=-1 186 "-.:\c" achar 187 "#" achar 188 ";" astring 189 190 :bchar EntityRef 191 * error noeat recolor=-1 192 "-.:\c" bchar 193 "#" bchar 194 ";" bstring 195 196 # Matched: <tag attr="foo" 197 198 :endstring Attr 199 * error noeat recolor=-1 200 " \t\r\n" tag_space_sp 201 "/" empty_tag recolor=-1 202 ">" close_tag recolor=-1 203 204 # This state is just to recolor the final ">" at the end of <tag attr="val"> 205 206 :close_tag Tag 207 * content noeat 208 209 # Matched: <? 210 211 :pi_start PIStart 212 * pi noeat recolor=-1 213 214 :pi PIBody 215 * pi 216 "?" pi2 217 218 :pi2 PIBody 219 * pi 220 ">" pi_end recolor=-2 221 222 :pi_end PIEnd 223 * content noeat recolor=-1 224 225 # Matched: <! 226 227 :decl Decl 228 * decl strings 229 "!--" comment_start recolor=-5 230 "![CDATA[" cdata_start recolor=-10 231 done 232 # "<" decl_nest 233 ">" content 234 235 # We allow one level of <...> nesting within declarations 236 237 :decl_nest Decl 238 * decl_nest 239 ">" decl 240 241 # Matched: <!-- 242 243 :comment_start CommentStart 244 * comment noeat 245 246 :comment CommentBody 247 * comment 248 "-" comment2 249 250 :comment2 CommentBody 251 * comment 252 "-" comment3 253 254 :comment3 CommentBody 255 * comment_error noeat recolor=-3 256 ">" comment_end recolor=-3 257 258 :comment_end CommentEnd 259 * content noeat recolor=-1 260 261 # For compatibility, the string "--" (double-hyphen) MUST NOT occur within 262 # comments. [http://www.w3.org/TR/REC-xml/ section 2.5] 263 264 :comment_error Error 265 * comment 266 "-" comment_error 267 ">" comment_end recolor=-3 268 269 # Matched: <![CDATA[ 270 271 :cdata_start CdataStart 272 * cdata noeat 273 274 :cdata CdataBody 275 * cdata 276 "]" cdata2 277 278 :cdata2 CdataBody 279 * cdata 280 "]" cdata3 281 282 :cdata3 CdataBody 283 * cdata 284 "]" cdata3 285 ">" cdata_end recolor=-3 286 287 :cdata_end CdataEnd 288 * content noeat recolor=-1