JSPM

glsl-token-defines

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

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

Package Exports

  • glsl-token-defines

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-token-defines) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.