textmate_grammar.engine.plist¶
Faithful port of microsoft/vscode-textmate src/plist.ts (v9.3.2).
A very fast dependency-free property-list (XML) parser for TextMate grammars.
It is deliberately not a general XML parser: it understands exactly the tags
TextMate grammars use (dict, array, key, string, real,
integer, date, data, true, false, plist) and skips
processing instructions, comments and doctypes. Semantics shipped here match
the TypeScript implementation 1:1, including its errors and quirks:
Quirks preserved: closing tags and the
plisttag are matched by string prefix (</dictionary>closes as</dict>); unterminated values at EOF are accepted; there is no CDATA support (<![CDATA[...]]>is skipped to the next>like a comment); named entities only cover&<>"', while numeric entities are decimal&#NNN;and lowercase-hex&#xNNN;(uppercase hex digits are not decoded;Jstays literal);<true>/<false>ignore their text content;<integer>values always yield a JSnumber(a Pythonfloat).Locations (
$vscodeTextmateLocationentries) are only produced in theparse_with_locationdebug path, exactly like upstream.Errors are
ValueErrorwith the upstream message format:Near offset <pos>: <message> ~~~<50 chars of input>~~~
See plist.ts in microsoft/vscode-textmate for the reference implementation.
Module Contents¶
Functions¶
Parse |
|
A very fast plist parser ( |
Data¶
API¶
- textmate_grammar.engine.plist.PLIST_LOCATION_KEY = '$vscodeTextmateLocation'¶