Skip to content

Commit 9d5ba4a

Browse files
Merge pull request #35 from ShaderFrog/typo-keywords
Addressing typo in some keywords
2 parents f84fc8a + e7e0207 commit 9d5ba4a

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"engines": {
44
"node": ">=16"
55
},
6-
"version": "5.1.1",
6+
"version": "5.2.0",
77
"type": "module",
88
"description": "A GLSL ES 1.0 and 3.0 parser and preprocessor that can preserve whitespace and comments",
99
"scripts": {

src/parser/glsl-grammar.pegjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ SAMPLERCUBESHADOW = token:"samplerCubeShadow" t:terminal { return node('keyword'
155155
SAMPLER1DARRAY = token:"sampler1DArray" t:terminal { return node('keyword', { token, whitespace: t }); }
156156
SAMPLER2DARRAY = token:"sampler2DArray" t:terminal { return node('keyword', { token, whitespace: t }); }
157157
SAMPLER1DARRAYSHADOW = token:"sampler1DArrayShadow" t:terminal { return node('keyword', { token, whitespace: t }); }
158-
SAMPLER2DARRAYSHADOW = token:"sampler2DArrayshadow" t:terminal { return node('keyword', { token, whitespace: t }); }
158+
SAMPLER2DARRAYSHADOW = token:"sampler2DArrayShadow" t:terminal { return node('keyword', { token, whitespace: t }); }
159159
ISAMPLER1D = token:"isampler1D" t:terminal { return node('keyword', { token, whitespace: t }); }
160160
ISAMPLER2D = token:"isampler2D" t:terminal { return node('keyword', { token, whitespace: t }); }
161161
ISAMPLER3D = token:"isampler3D" t:terminal { return node('keyword', { token, whitespace: t }); }
@@ -169,7 +169,7 @@ USAMPLERCUBE = token:"usamplerCube" t:terminal { return node('keyword', { token,
169169
USAMPLER1DARRAY = token:"usampler1DArray" t:terminal { return node('keyword', { token, whitespace: t }); }
170170
USAMPLER2DARRAY = token:"usampler2DArray" t:terminal { return node('keyword', { token, whitespace: t }); }
171171
SAMPLER2DRECT = token:"sampler2DRect" t:terminal { return node('keyword', { token, whitespace: t }); }
172-
SAMPLER2DRECTSHADOW = token:"sampler2DRectshadow" t:terminal { return node('keyword', { token, whitespace: t }); }
172+
SAMPLER2DRECTSHADOW = token:"sampler2DRectShadow" t:terminal { return node('keyword', { token, whitespace: t }); }
173173
ISAMPLER2DRECT = token:"isampler2DRect" t:terminal { return node('keyword', { token, whitespace: t }); }
174174
USAMPLER2DRECT = token:"usampler2DRect" t:terminal { return node('keyword', { token, whitespace: t }); }
175175
SAMPLERBUFFER = token:"samplerBuffer" t:terminal { return node('keyword', { token, whitespace: t }); }

src/parser/parse.test.ts

+12
Original file line numberDiff line numberDiff line change
@@ -428,3 +428,15 @@ test('fails on error', () => {
428428
)
429429
).toThrow(/duplicate variable declaration: "a"/);
430430
});
431+
432+
test('exotic precision statements', () => {
433+
// Regression to test for upper/loweracse typos in specific keywords
434+
expect(
435+
c.parse(`precision highp sampler2DArrayShadow;`).program[0].declaration
436+
.specifier.specifier.token
437+
).toBe('sampler2DArrayShadow');
438+
expect(
439+
c.parse(`precision highp sampler2DRectShadow;`).program[0].declaration
440+
.specifier.specifier.token
441+
).toBe('sampler2DRectShadow');
442+
});

0 commit comments

Comments
 (0)