glsl-token-scope

WebJar for glsl-token-scope

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

glsl-token-scope
Последняя версия

Последняя версия

1.1.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

glsl-token-scope
WebJar for glsl-token-scope
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/glslify/glsl-token-scope

Скачать glsl-token-scope

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/glsl-token-scope/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>glsl-token-scope</artifactId>
    <version>1.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/glsl-token-scope/
implementation 'org.webjars.npm:glsl-token-scope:1.1.2'
// https://jarcasting.com/artifacts/org.webjars.npm/glsl-token-scope/
implementation ("org.webjars.npm:glsl-token-scope:1.1.2")
'org.webjars.npm:glsl-token-scope:jar:1.1.2'
<dependency org="org.webjars.npm" name="glsl-token-scope" rev="1.1.2">
  <artifact name="glsl-token-scope" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='glsl-token-scope', version='1.1.2')
)
libraryDependencies += "org.webjars.npm" % "glsl-token-scope" % "1.1.2"
[org.webjars.npm/glsl-token-scope "1.1.2"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

glsl-token-scope

experimental

Infer the scope of each token in an array of GLSL tokens.

Usage

NPM

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]
// ...

See Also

License

MIT. See LICENSE.md for details.

org.webjars.npm

Версии библиотеки

Версия
1.1.2