0.0.6 • Published 6 years ago

tokenize-postscript-pmb v0.0.6

Weekly downloads
7
License
ISC
Repository
github
Last release
6 years ago

tokenize-postscript-pmb

Parse the subset of PostScript that I understand.

API

Token Objects

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)

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, ch. 3.2 "Syntax".

 

License

ISC

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago