# glsl-token-depth

> Determine the scope depth of an array of GLSL tokens

Latest version **1.1.2** (published 2015-03-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install glsl-token-depth
pnpm add glsl-token-depth
yarn add glsl-token-depth
bun add glsl-token-depth
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2015-03-11 |
| First published | 2014-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Hugh Kennedy |
| Maintainers | hughsk, substack |
| Keywords | ecosystem:stackgl, tokens, glsl, syntax |

## Links

- npm: https://www.npmjs.com/package/glsl-token-depth
- Repository: https://github.com/stackgl/glsl-token-depth
- Issues: https://github.com/stackgl/glsl-token-depth/issues
- npm.io page: https://npm.io/package/glsl-token-depth

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 1.1.2 (latest) — 2015-03-11
- 1.1.1 — 2015-03-06
- 1.1.0 — 2015-01-04
- 1.0.0 — 2014-12-14

## README

# glsl-token-depth

[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)

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](https://nodei.co/npm/glsl-token-depth.png)](https://nodei.co/npm/glsl-token-depth/)

### `depth(tokens)`

Where `tokens` is an array of tokens returned from
[`glsl-tokenizer`](http://github.com/stackgl/glsl-tokenizer). Each token will
be modified in-place, and given a `depth` property.

``` javascript
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

* [stackgl/glsl-tokenizer](http://github.com/stackgl/glsl-tokenizer)

## License

MIT. See [LICENSE.md](http://github.com/stackgl/glsl-token-depth/blob/master/LICENSE.md) for details.

---
_Source: https://npm.io/package/glsl-token-depth · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
