prettier-plugin-glsl
Advanced tools
Comparing version 0.1.3 to 0.2.0
@@ -277,3 +277,3 @@ import { IToken } from "chevrotain"; | ||
kind: "ppInclude"; | ||
what: Token; | ||
what: string; | ||
} | ||
@@ -280,0 +280,0 @@ export type PpNode = PpDefine | PpDir | PpExtension | PpCall | PpPragma | PpInclude; |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "Prettier (https://prettier.io) plugin for GLSL (OpenGL Shading Language).", | ||
@@ -15,0 +15,0 @@ "exports": "./lib/prettier-plugin.cjs.js", |
@@ -436,3 +436,3 @@ // noinspection JSUnusedGlobalSymbols | ||
name: "NON_PP_IDENTIFIER", | ||
pattern: /\w[\w\d]*/i, | ||
pattern: /[a-z]\w*/i, | ||
categories: IDENTIFIER, | ||
@@ -439,0 +439,0 @@ }) |
@@ -367,3 +367,4 @@ import { IToken } from "chevrotain" | ||
kind: "ppInclude" | ||
what: Token | ||
// eg. '"file.glsl"' or '<common>' | ||
what: string | ||
} | ||
@@ -370,0 +371,0 @@ |
@@ -1450,3 +1450,20 @@ /* eslint-disable @typescript-eslint/member-ordering */ | ||
this.CONSUME(TOKEN.INCLUDE) | ||
const str = this.CONSUME(TOKEN.STRING) | ||
let str = "" | ||
this.OR([ | ||
{ | ||
ALT: () => { | ||
str = this.CONSUME(TOKEN.STRING).image | ||
}, | ||
}, | ||
{ | ||
ALT: () => { | ||
// three.js style import | ||
//https://github.com/mrdoob/three.js/blob/98616257db739e50513437c6913156c17a6d40e4/src/renderers/webgl/WebGLProgram.js#L239 | ||
this.CONSUME(TOKEN.LEFT_ANGLE) | ||
const t = this.CONSUME(TOKEN.IDENTIFIER) | ||
this.CONSUME(TOKEN.RIGHT_ANGLE) | ||
str = "<" + t.image + ">" | ||
}, | ||
}, | ||
]) | ||
return { kind: "ppInclude", what: str } | ||
@@ -1453,0 +1470,0 @@ }) |
@@ -1135,3 +1135,3 @@ // noinspection JSUnusedGlobalSymbols | ||
case "ppInclude": | ||
return ["#include ", n.what.image] | ||
return ["#include ", n.what] | ||
case "switchStatement": { | ||
@@ -1138,0 +1138,0 @@ return [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
551851
12133