
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
glsl-token-scope
Advanced tools
Infer the scope of each token in an array of GLSL tokens.
scope(tokens)
Where tokens
is an array of tokens returned from
glsl-tokenizer
. Each token will
be modified in-place, and given scope
and stack
properties.
token.scope
is a unique number for the token's current scope.
token.stack
is an array containing the scopes available to the current token.
Note that you must first determine the scope depth of each token using
glsl-token-depth
var tokenize = require('glsl-tokenizer/string')
var depth = require('glsl-token-depth')
var scope = require('glsl-token-scope')
var fs = require('fs')
var src = fs.readFileSync('shader.frag', 'utf8')
var tokens = tokenize(src)
depth(tokens)
scope(tokens)
tokens[0].scope // 0
tokens[1].scope // 0
tokens[2].scope // 1
tokens[3].scope // 1
tokens[4].scope // 0
tokens[5].scope // 2
// ...
tokens[0].stack // [0]
tokens[1].stack // [0]
tokens[2].stack // [0, 1]
tokens[3].stack // [0, 1]
tokens[4].stack // [0]
tokens[5].stack // [0, 2]
// ...
MIT. See LICENSE.md for details.
FAQs
Infer the scope of each token in an array of GLSL tokens
The npm package glsl-token-scope receives a total of 222,457 weekly downloads. As such, glsl-token-scope popularity was classified as popular.
We found that glsl-token-scope demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.