glsl-token-defines

1.0.0 • Public • Published

glsl-token-defines

experimental

Retrieve the values defined with preprocessor statements in a selection of GLSL tokens.

Doesn't handle full function-style macros for the time being. Patches welcome!

Usage

NPM

defs = defines(tokens)

Where tokens is an array of tokens produced by glsl-tokenizer.

Returns an dictionary object where keys are the name of the defined variable, and values are the values of the defined variable. If a variable is not assigned a value, this will be an empty string.

For example, the following:

#define PI 3.14
#define TAU (PI*2.)
#define VEC vec3(1.)
#define EMPTY

Would yield:

{
  PI: '3.14',
  TAU: '(PI*2.)',
  VEC: 'vec3(1.)',
  EMPTY: ''
}

Contributing

See stackgl/contributing for details.

License

MIT. See LICENSE.md for details.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    280,007
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    280,007

Package Sidebar

Install

npm i glsl-token-defines

Weekly Downloads

280,007

Version

1.0.0

License

MIT

Last publish

Collaborators

  • hughsk
  • mikolalysenko
  • mattdesl
  • chrisdickinson
  • yoshuawuyts
  • mikkoh
  • rezaali
  • tatumcreative
  • wwwtyro
  • thibauts
  • bpostlethwaite
  • dfcreative
  • erkaman
  • gre
  • rreusser
  • vorg
  • archmoj
  • dy