Advertisement
Guest User

Sublime XML

a guest
Jun 12th, 2015
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 5.10 KB | None | 0 0
  1. %YAML 1.2
  2. ---
  3. name: XML
  4. file_extensions:
  5.   - xml
  6.   - xsd
  7.   - tld
  8.   - dtml
  9.   - rss
  10.   - opml
  11. first_line_match: '^<\?xml '
  12. scope: text.xml
  13. contexts:
  14.  main:
  15.    - match: '(<\?)\s*([-_a-zA-Z0-9]+)'
  16.      captures:
  17.        1: punctuation.definition.tag.begin.xml
  18.        2: entity.name.tag.xml
  19.      push:
  20.        - meta_scope: meta.tag.preprocessor.xml
  21.        - match: (\?>)
  22.           pop: true
  23.         - match: " ([a-zA-Z-]+)"
  24.           scope: entity.other.attribute-name.xml
  25.         - include: doublequotedString
  26.         - include: singlequotedString
  27.     - match: '(<!)(DOCTYPE)\s+([:a-zA-Z_][:a-zA-Z0-9_.-]*)'
  28.      captures:
  29.        1: punctuation.definition.tag.begin.xml
  30.        2: keyword.doctype.xml
  31.        3: variable.documentroot.xml
  32.      push:
  33.        - meta_scope: meta.tag.sgml.doctype.xml
  34.        - match: \s*(>)
  35.           pop: true
  36.         - include: internalSubset
  37.     - match: "<!--"
  38.      captures:
  39.        0: punctuation.definition.comment.xml
  40.      push:
  41.        - meta_scope: comment.block.xml
  42.        - match: "-->"
  43.           pop: true
  44.     - match: '(<)((?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]+))(?=(\s[^>]*)?></\2>)'
  45.       captures:
  46.         1: punctuation.definition.tag.begin.xml
  47.         3: entity.name.tag.namespace.xml
  48.         4: entity.name.tag.xml
  49.         5: punctuation.separator.namespace.xml
  50.         6: entity.name.tag.localname.xml
  51.       push:
  52.         - meta_scope: meta.tag.no-content.xml
  53.         - match: "(>)(<)(/)(?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]+)(>)"
  54.           captures:
  55.             1: punctuation.definition.tag.end.xml
  56.             2: punctuation.definition.tag.begin.xml meta.scope.between-tag-pair.xml
  57.             3: punctuation.definition.tag.begin.xml
  58.             4: entity.name.tag.namespace.xml
  59.             5: entity.name.tag.xml
  60.             6: punctuation.separator.namespace.xml
  61.             7: entity.name.tag.localname.xml
  62.             8: punctuation.definition.tag.end.xml
  63.           pop: true
  64.         - include: tagStuff
  65.     - match: "(</?)(?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]+)"
  66.      captures:
  67.        1: punctuation.definition.tag.begin.xml
  68.        2: entity.name.tag.namespace.xml
  69.        3: entity.name.tag.xml
  70.        4: punctuation.separator.namespace.xml
  71.        5: entity.name.tag.localname.xml
  72.      push:
  73.        - meta_scope: meta.tag.xml
  74.        - match: (/?>)
  75.           captures:
  76.             1: punctuation.definition.tag.end.xml
  77.           pop: true
  78.         - include: tagStuff
  79.     - include: entity
  80.     - include: bare-ampersand
  81.     - match: '<!\[CDATA\['
  82.      captures:
  83.        0: punctuation.definition.string.begin.xml
  84.      push:
  85.        - meta_scope: string.unquoted.cdata.xml
  86.        - match: "]]>"
  87.           captures:
  88.             0: punctuation.definition.string.end.xml
  89.           pop: true
  90.   EntityDecl:
  91.     - match: '(<!)(ENTITY)\s+(%\s+)?([:a-zA-Z_][:a-zA-Z0-9_.-]*)(\s+(?:SYSTEM|PUBLIC)\s+)?'
  92.      captures:
  93.        1: punctuation.definition.tag.begin.xml
  94.        2: keyword.entity.xml
  95.        3: punctuation.definition.entity.xml
  96.        4: variable.entity.xml
  97.        5: keyword.entitytype.xml
  98.      push:
  99.        - match: (>)
  100.           pop: true
  101.         - include: doublequotedString
  102.         - include: singlequotedString
  103.   bare-ampersand:
  104.     - match: "&"
  105.      scope: invalid.illegal.bad-ampersand.xml
  106.  doublequotedString:
  107.    - match: '"'
  108.      captures:
  109.        0: punctuation.definition.string.begin.xml
  110.      push:
  111.        - meta_scope: string.quoted.double.xml
  112.        - match: '"'
  113.          captures:
  114.            0: punctuation.definition.string.end.xml
  115.          pop: true
  116.        - include: entity
  117.        - include: bare-ampersand
  118.  entity:
  119.    - match: "(&)([:a-zA-Z_][:a-zA-Z0-9_.-]*|#[0-9]+|#x[0-9a-fA-F]+)(;)"
  120.       scope: constant.character.entity.xml
  121.       captures:
  122.         1: punctuation.definition.constant.xml
  123.         3: punctuation.definition.constant.xml
  124.   internalSubset:
  125.     - match: '(\[)'
  126.       captures:
  127.         1: punctuation.definition.constant.xml
  128.       push:
  129.         - meta_scope: meta.internalsubset.xml
  130.         - match: '(\])'
  131.           pop: true
  132.         - include: EntityDecl
  133.         - include: parameterEntity
  134.   parameterEntity:
  135.     - match: "(%)([:a-zA-Z_][:a-zA-Z0-9_.-]*)(;)"
  136.       scope: constant.character.parameter-entity.xml
  137.       captures:
  138.         1: punctuation.definition.constant.xml
  139.         3: punctuation.definition.constant.xml
  140.   singlequotedString:
  141.     - match: "'"
  142.       captures:
  143.         0: punctuation.definition.string.begin.xml
  144.       push:
  145.         - meta_scope: string.quoted.single.xml
  146.         - match: "'"
  147.           captures:
  148.             0: punctuation.definition.string.end.xml
  149.           pop: true
  150.         - include: entity
  151.         - include: bare-ampersand
  152.   tagStuff:
  153.     - match: ' (?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9]+)\s*='
  154.       captures:
  155.         1: entity.other.attribute-name.namespace.xml
  156.         2: entity.other.attribute-name.xml
  157.         3: punctuation.separator.namespace.xml
  158.         4: entity.other.attribute-name.localname.xml
  159.     - include: doublequotedString
  160.     - include: singlequotedString
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement