glsl-token-depth
Determine the scope depth of an array of GLSL tokens.
Useful for inferring the scope of variables in a GLSL shader without having to fully parse the source.
Usage
depth(tokens)
Where tokens
is an array of tokens returned from
glsl-tokenizer
. Each token will
be modified in-place, and given a depth
property.
var tokenize =var depth =var fs =var src = fsvar tokens =tokens0depth // 0tokens1depth // 0tokens2depth // 0tokens3depth // 0tokens4depth // 1// ...
See Also
License
MIT. See LICENSE.md for details.