Parse the subset of PostScript that I understand.
npm install tokenize-postscript-pmb
tokenize-postscript-pmb
=======================
Parse the subset of PostScript that I understand.
API
---
Tokens are reported as objects that have some of these properties.
* t: type symbol.
This is the only property that's always present on every token object.
* v: value.
* x: true if the object is executable,
'//' if the object is to be executed immediately,
undefined or some other false-y value for literal objects.
* w: Whitespace that was found in front of the token.
Upgraded versions include:
* T: The type name as string, or a false-y value for unsupported types.
Usage
-----
from test/usage.js:
(input → result)
``javascript
var makeTokenizer = require('tokenize-postscript-pmb'),
psCode = fixture('input/usage.ps'),
parseOpt = { ignWsp: false },
tokenize = makeTokenizer(psCode, parseOpt),
tokens = tokenize(),
expected = fixture.json('expect/usage.tokens'),
equal = require('equal-pmb');
equal(tokenize.remainder(), '');
equal.lists(tokens, expected);
``
Known issues
------------
* needs more/better tests and docs
Reference
---------
* Syntax: PostScript Language Reference Manual (PLRM, "red book")
[version 3][plrm-v3], ch. 3.2 "Syntax".
[plrm-v3]: http://web.archive.org/web/20090205083652/http://partners.adobe.com:80/public/developer/en/ps/PLRM.pdf
[ps-faq]: http://web.archive.org/web/20170720222605/https://en.wikibooks.org/wiki/PostScript_FAQ
[ps-wp-2008]: http://web.archive.org/web/20081221010243/http://en.wikipedia.org/wiki/PostScript
License
-------
ISC