glsl-tokenizer

WebJar for glsl-tokenizer

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

glsl-tokenizer
Last Version

Last Version

2.1.5
Release Date

Release Date

Type

Type

jar
Description

Description

glsl-tokenizer
WebJar for glsl-tokenizer
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/glslify/glsl-tokenizer

Download glsl-tokenizer

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : through2 jar [0.6.3,0.7)

Project Modules

There are no modules declared in this project.

glsl-tokenizer Build Status

Maps GLSL string data into GLSL tokens, either synchronously or using a streaming API.

var tokenString = require('glsl-tokenizer/string')
var tokenStream = require('glsl-tokenizer/stream')
var fs = require('fs')

// Synchronously:
var tokens = tokenString(fs.readFileSync('some.glsl'))

// Streaming API:
fs.createReadStream('some.glsl')
  .pipe(tokenStream())
  .on('data', function(token) {
    console.log(token.data, token.position, token.type)
  })

API

tokens = require('glsl-tokenizer/string')(src, [opt])

Returns an array of tokens given the GLSL source string src

You can specify opt.version string to use different keywords/builtins, such as '300 es' for WebGL2. Otherwise, will assume GLSL 100 (WebGL1).

var tokens = tokenizer(src, {
  version: '300 es'
})

stream = require('glsl-tokenizer/stream')([opt])

Emits 'data' events whenever a token is parsed with a token object as output.

As above, you can specify opt.version.

Tokens

{ 'type': TOKEN_TYPE
, 'data': "string of constituent data"
, 'position': integer position within the GLSL source
, 'line': line number within the GLSL source
, 'column': column number within the GLSL source }

The available token types are:

  • block-comment: /* ... */
  • line-comment: // ... \n
  • preprocessor: # ... \n
  • operator: Any operator. If it looks like punctuation, it's an operator.
  • float: Optionally suffixed with f
  • ident: User defined identifier.
  • builtin: Builtin function.
  • eof: Emitted on end; data will === '(eof)'.
  • integer
  • whitespace
  • keyword

License

MIT, see LICENSE.md for further information.

org.webjars.npm

Versions

Version
2.1.5
2.1.4
2.1.2