tokenize-postscript-pmb

0.0.6 • Public • Published

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:       (inputresult)

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

Readme

Keywords

Package Sidebar

Install

npm i tokenize-postscript-pmb

Weekly Downloads

0

Version

0.0.6

License

ISC

Last publish

Collaborators

  • mk-pmb