Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %YAML 1.2
- ---
- name: XML
- file_extensions:
- - xml
- - xsd
- - tld
- - dtml
- - rss
- - opml
- first_line_match: '^<\?xml '
- scope: text.xml
- contexts:
- main:
- - match: '(<\?)\s*([-_a-zA-Z0-9]+)'
- captures:
- 1: punctuation.definition.tag.begin.xml
- 2: entity.name.tag.xml
- push:
- - meta_scope: meta.tag.preprocessor.xml
- - match: (\?>)
- pop: true
- - match: " ([a-zA-Z-]+)"
- scope: entity.other.attribute-name.xml
- - include: doublequotedString
- - include: singlequotedString
- - match: '(<!)(DOCTYPE)\s+([:a-zA-Z_][:a-zA-Z0-9_.-]*)'
- captures:
- 1: punctuation.definition.tag.begin.xml
- 2: keyword.doctype.xml
- 3: variable.documentroot.xml
- push:
- - meta_scope: meta.tag.sgml.doctype.xml
- - match: \s*(>)
- pop: true
- - include: internalSubset
- - match: "<!--"
- captures:
- 0: punctuation.definition.comment.xml
- push:
- - meta_scope: comment.block.xml
- - match: "-->"
- pop: true
- - match: '(<)((?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]+))(?=(\s[^>]*)?></\2>)'
- captures:
- 1: punctuation.definition.tag.begin.xml
- 3: entity.name.tag.namespace.xml
- 4: entity.name.tag.xml
- 5: punctuation.separator.namespace.xml
- 6: entity.name.tag.localname.xml
- push:
- - meta_scope: meta.tag.no-content.xml
- - match: "(>)(<)(/)(?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]+)(>)"
- captures:
- 1: punctuation.definition.tag.end.xml
- 2: punctuation.definition.tag.begin.xml meta.scope.between-tag-pair.xml
- 3: punctuation.definition.tag.begin.xml
- 4: entity.name.tag.namespace.xml
- 5: entity.name.tag.xml
- 6: punctuation.separator.namespace.xml
- 7: entity.name.tag.localname.xml
- 8: punctuation.definition.tag.end.xml
- pop: true
- - include: tagStuff
- - match: "(</?)(?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]+)"
- captures:
- 1: punctuation.definition.tag.begin.xml
- 2: entity.name.tag.namespace.xml
- 3: entity.name.tag.xml
- 4: punctuation.separator.namespace.xml
- 5: entity.name.tag.localname.xml
- push:
- - meta_scope: meta.tag.xml
- - match: (/?>)
- captures:
- 1: punctuation.definition.tag.end.xml
- pop: true
- - include: tagStuff
- - include: entity
- - include: bare-ampersand
- - match: '<!\[CDATA\['
- captures:
- 0: punctuation.definition.string.begin.xml
- push:
- - meta_scope: string.unquoted.cdata.xml
- - match: "]]>"
- captures:
- 0: punctuation.definition.string.end.xml
- pop: true
- EntityDecl:
- - match: '(<!)(ENTITY)\s+(%\s+)?([:a-zA-Z_][:a-zA-Z0-9_.-]*)(\s+(?:SYSTEM|PUBLIC)\s+)?'
- captures:
- 1: punctuation.definition.tag.begin.xml
- 2: keyword.entity.xml
- 3: punctuation.definition.entity.xml
- 4: variable.entity.xml
- 5: keyword.entitytype.xml
- push:
- - match: (>)
- pop: true
- - include: doublequotedString
- - include: singlequotedString
- bare-ampersand:
- - match: "&"
- scope: invalid.illegal.bad-ampersand.xml
- doublequotedString:
- - match: '"'
- captures:
- 0: punctuation.definition.string.begin.xml
- push:
- - meta_scope: string.quoted.double.xml
- - match: '"'
- captures:
- 0: punctuation.definition.string.end.xml
- pop: true
- - include: entity
- - include: bare-ampersand
- entity:
- - match: "(&)([:a-zA-Z_][:a-zA-Z0-9_.-]*|#[0-9]+|#x[0-9a-fA-F]+)(;)"
- scope: constant.character.entity.xml
- captures:
- 1: punctuation.definition.constant.xml
- 3: punctuation.definition.constant.xml
- internalSubset:
- - match: '(\[)'
- captures:
- 1: punctuation.definition.constant.xml
- push:
- - meta_scope: meta.internalsubset.xml
- - match: '(\])'
- pop: true
- - include: EntityDecl
- - include: parameterEntity
- parameterEntity:
- - match: "(%)([:a-zA-Z_][:a-zA-Z0-9_.-]*)(;)"
- scope: constant.character.parameter-entity.xml
- captures:
- 1: punctuation.definition.constant.xml
- 3: punctuation.definition.constant.xml
- singlequotedString:
- - match: "'"
- captures:
- 0: punctuation.definition.string.begin.xml
- push:
- - meta_scope: string.quoted.single.xml
- - match: "'"
- captures:
- 0: punctuation.definition.string.end.xml
- pop: true
- - include: entity
- - include: bare-ampersand
- tagStuff:
- - match: ' (?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9]+)\s*='
- captures:
- 1: entity.other.attribute-name.namespace.xml
- 2: entity.other.attribute-name.xml
- 3: punctuation.separator.namespace.xml
- 4: entity.other.attribute-name.localname.xml
- - include: doublequotedString
- - include: singlequotedString
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement