JSPM

glsl-deparser

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4287
  • Score
    100M100P100Q134927F
  • License MIT

through stream that translates glsl-parser AST nodes into working glsl code

Package Exports

  • glsl-deparser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (glsl-deparser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

glsl-deparser

var Path = require('path')

var tokenizer = require('glsl-tokenizer')()
  , parser = require('glsl-parser')
  , deparser = require('glsl-deparser')

process.stdin
  .pipe(tokenizer)
  .pipe(parser())
  .pipe(deparser())             // <-- deparser!
  .pipe(process.stdout)

process.stdin.resume()

transform a stream of glsl-parser AST nodes into strings.

only operates on top-level statements emitted by glsl-parser, so the code it emits is executable by webgl.

api

deparser(whitespace_enabled=true, tab_text=' ')

Creates a readable/writable stream.

If no args are provided, whitespace is assumed to be enabled, and the tab text will be ' '.

If you pass false for the first arg, only syntactically significant whitespace will be emitted (it'll behave like a poor man's minifier).

If you pass true and tab text, that tab text will be used to indent code.

note

the big caveat is that preprocessor if statements (#if*, #endif) won't work unless each branch produces a parseable tree.

license

MIT