Skip to content

Instantly share code, notes, and snippets.

@andy0130tw
Created July 7, 2025 06:22
Show Gist options
  • Save andy0130tw/ee358e7a4963280cf430f58f5b99aebb to your computer and use it in GitHub Desktop.
Save andy0130tw/ee358e7a4963280cf430f58f5b99aebb to your computer and use it in GitHub Desktop.
Sublime Syntax definition of ASCII ("Old-Style") Property List, converted via ST4 from textmate/property-list.tmbundle
%YAML 1.2
---
# http://www.sublimetext.com/docs/syntax.html
name: Property List (Old-Style)
file_extensions:
- plist
# from: https://github.com/textmate/property-list.tmbundle/blob/master/Syntaxes/Property%20List%20(Old-Style).tmLanguage
# warning: pop pattern contains \G, this will not work as expected if it's intended to refer to the begin regex: (?!\G)
first_line_match: \A// .*?\b(?i:property list)\b
scope: source.plist
contexts:
main:
- match: '(?=\(|\{)'
push:
- match: (?=not)possible
pop: true
- include: dictionary
- include: array
- include: comment
- include: stray
- include: comment
- include: stray
comment:
- match: /\*
captures:
0: punctuation.definition.comment.begin.plist
push:
- meta_scope: comment.block.plist
- match: \*/
captures:
0: punctuation.definition.comment.begin.plist
pop: true
- match: '(^[ \t]+)?(?=//)'
captures:
1: punctuation.whitespace.comment.leading.plist
push:
- match: (?!\G)
pop: true
- match: //
captures:
0: punctuation.definition.comment.plist
push:
- meta_scope: comment.line.double-slash.plist
- match: \n
pop: true
array:
- match: \G\(
captures:
0: punctuation.definition.array.begin.plist
push:
- meta_scope: meta.scope.array.plist
- match: \)
captures:
0: punctuation.definition.array.end.plist
pop: true
- include: array_item
- include: comment
- include: stray
array_item:
- match: '(?=<|\(|\{|"|''|[-a-zA-Z0-9_.])'
push:
- meta_scope: meta.scope.array-item.plist
- match: ',|(?=\))'
captures:
0: punctuation.separator.array.plist
pop: true
- include: dictionary
- include: array
- include: string
- include: binary
- include: comment
- include: stray
binary:
- match: \G<
captures:
1: punctuation.definition.data.plist
push:
- meta_scope: meta.binary-data.plist
- meta_content_scope: constant.numeric.base64.plist
- match: (=?)\s*(>)
captures:
1: punctuation.terminator.data.plist
2: punctuation.definition.data.plist
pop: true
- match: '[^A-Za-z0-9+/ \n]'
scope: invalid.illegal.invalid-character.plist
dictionary:
- match: '\G\{'
captures:
0: punctuation.definition.dictionary.begin.plist
push:
- meta_scope: meta.scope.dictionary.plist
- match: '\}'
captures:
0: punctuation.definition.dictionary.end.plist
pop: true
- include: dictionary_item
- include: comment
- include: stray
dictionary_item:
- match: '(?>((")((?:[^"\\]|\\.)*)("))|(('')((?:[^''\\]|\\.)*)(''))|([-a-zA-Z0-9_.]+))'
captures:
1: string.quoted.double.plist
2: punctuation.definition.string.begin.plist
3: constant.other.key.plist
4: punctuation.definition.string.end.plist
5: string.quoted.single.plist
6: punctuation.definition.string.begin.plist
7: constant.other.key.plist
8: punctuation.definition.string.end.plist
9: constant.other.key.plist
push:
- meta_scope: 'meta.scope.dictionary-item.${3/[[\s\x20-\x7F]&&[:^alnum:]]//g}${7/[[\s\x20-\x7F]&&[:^alnum:]]//g}${9/[[\s\x20-\x7F]&&[:^alnum:]]//g}.plist'
- match: ';|(?=\})'
captures:
0: punctuation.separator.dictionary.plist
pop: true
- include: dictionary_item_contents
dictionary_item_contents:
- match: '='
push:
- match: '(?=;|\})'
pop: true
- match: '(?=<|\(|\{|"|''|[-a-zA-Z0-9_.])'
push:
- match: '(?=;|\})'
pop: true
- include: dictionary
- include: array
- include: string
- include: binary
- include: stray
- include: stray_alpha
- include: stray
stray:
- match: \S
push:
- meta_scope: invalid.illegal.character-not-allowed-here.plist
- match: '(?=\{|\(|/\*|//|"|''|<|,|;|\)|\}|=)'
pop: true
stray_alpha:
- match: \S
push:
- meta_scope: invalid.illegal.character-not-allowed-here.plist
- match: '(?=\{|\(|/\*|//|"|''|<|,|;|\)|\}|=|\b[a-zA-Z0-9]|[-_.])'
pop: true
string:
- match: \G'
captures:
0: punctuation.definition.string.begin.plist
push:
- meta_scope: string.quoted.single.plist
- match: '''(?!'')'
captures:
0: punctuation.definition.string.end.plist
pop: true
- include: string-contents
- match: \G"
captures:
0: punctuation.definition.string.begin.plist
push:
- meta_scope: string.quoted.double.plist
- match: '"'
captures:
0: punctuation.definition.string.end.plist
pop: true
- include: string-contents
- match: '\G[-+]?\d+(\.\d*)?(E[-+]\d+)?(?!\w)'
scope: constant.numeric.plist
- match: '\G[-a-zA-Z0-9_.]+'
scope: string.unquoted.plist
string-contents:
- match: '\\([uU](\h{4}|\h{2})|\d{1,3}|.)'
scope: constant.character.escape.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment