New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

glsl-tokenizer

Package Overview
Dependencies
Maintainers
17
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glsl-tokenizer

r/w stream of glsl tokens

  • 2.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
17
Created

What is glsl-tokenizer?

The glsl-tokenizer npm package is a tool for tokenizing GLSL (OpenGL Shading Language) code. It breaks down GLSL code into a stream of tokens, which can then be used for further processing, such as parsing, analysis, or transformation.

What are glsl-tokenizer's main functionalities?

Tokenizing GLSL code

This feature allows you to tokenize a GLSL shader code. The code sample reads a GLSL file, tokenizes its content, and prints the tokens to the console.

const tokenize = require('glsl-tokenizer');
const fs = require('fs');

const glslCode = fs.readFileSync('shader.glsl', 'utf8');
const tokens = tokenize(glslCode);
console.log(tokens);

Handling different types of tokens

This feature demonstrates how to handle different types of tokens produced by the tokenizer. The code sample tokenizes a simple GLSL code snippet and prints the type and data of each token.

const tokenize = require('glsl-tokenizer');

const glslCode = 'void main() { gl_FragColor = vec4(1.0); }';
const tokens = tokenize(glslCode);

for (const token of tokens) {
  console.log(`Type: ${token.type}, Data: ${token.data}`);
}

Customizing tokenization

This feature shows how to customize the tokenization process by specifying options. The code sample tokenizes GLSL code with a specified GLSL version.

const tokenize = require('glsl-tokenizer');

const glslCode = 'void main() { gl_FragColor = vec4(1.0); }';
const tokens = tokenize(glslCode, { version: '300 es' });

console.log(tokens);

Other packages similar to glsl-tokenizer

Keywords

FAQs

Package last updated on 06 Oct 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc