/ piacw.com / dev / final / node_modules / glsl-token-depth /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[TXT]LICENSE.md2 years ago1.2K0fb859dc fixed mobile overflwo options [كارل مبارك]
[TXT]README.md2 years ago1.1K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]index.js2 years ago1.3K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]package.json2 years ago1.6K0fb859dc fixed mobile overflwo options [كارل مبارك]
README.md

glsl-token-depth

experimental

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

NPM

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 = require('glsl-tokenizer/string')
var depth    = require('glsl-token-depth')
var fs       = require('fs')

var src = fs.readFileSync('shader.frag', 'utf8')
var tokens = tokenize(src)

depth(tokens)

tokens[0].depth // 0
tokens[1].depth // 0
tokens[2].depth // 0
tokens[3].depth // 0
tokens[4].depth // 1
// ...

See Also

License

MIT. See LICENSE.md for details.

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80