Skip to content

Commit

Permalink
Addressing typo in some keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewRayCode committed Sep 28, 2024
1 parent f84fc8a commit e7e0207
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"engines": {
"node": ">=16"
},
"version": "5.1.1",
"version": "5.2.0",
"type": "module",
"description": "A GLSL ES 1.0 and 3.0 parser and preprocessor that can preserve whitespace and comments",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/parser/glsl-grammar.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ SAMPLERCUBESHADOW = token:"samplerCubeShadow" t:terminal { return node('keyword'
SAMPLER1DARRAY = token:"sampler1DArray" t:terminal { return node('keyword', { token, whitespace: t }); }
SAMPLER2DARRAY = token:"sampler2DArray" t:terminal { return node('keyword', { token, whitespace: t }); }
SAMPLER1DARRAYSHADOW = token:"sampler1DArrayShadow" t:terminal { return node('keyword', { token, whitespace: t }); }
SAMPLER2DARRAYSHADOW = token:"sampler2DArrayshadow" t:terminal { return node('keyword', { token, whitespace: t }); }
SAMPLER2DARRAYSHADOW = token:"sampler2DArrayShadow" t:terminal { return node('keyword', { token, whitespace: t }); }
ISAMPLER1D = token:"isampler1D" t:terminal { return node('keyword', { token, whitespace: t }); }
ISAMPLER2D = token:"isampler2D" t:terminal { return node('keyword', { token, whitespace: t }); }
ISAMPLER3D = token:"isampler3D" t:terminal { return node('keyword', { token, whitespace: t }); }
Expand All @@ -169,7 +169,7 @@ USAMPLERCUBE = token:"usamplerCube" t:terminal { return node('keyword', { token,
USAMPLER1DARRAY = token:"usampler1DArray" t:terminal { return node('keyword', { token, whitespace: t }); }
USAMPLER2DARRAY = token:"usampler2DArray" t:terminal { return node('keyword', { token, whitespace: t }); }
SAMPLER2DRECT = token:"sampler2DRect" t:terminal { return node('keyword', { token, whitespace: t }); }
SAMPLER2DRECTSHADOW = token:"sampler2DRectshadow" t:terminal { return node('keyword', { token, whitespace: t }); }
SAMPLER2DRECTSHADOW = token:"sampler2DRectShadow" t:terminal { return node('keyword', { token, whitespace: t }); }
ISAMPLER2DRECT = token:"isampler2DRect" t:terminal { return node('keyword', { token, whitespace: t }); }
USAMPLER2DRECT = token:"usampler2DRect" t:terminal { return node('keyword', { token, whitespace: t }); }
SAMPLERBUFFER = token:"samplerBuffer" t:terminal { return node('keyword', { token, whitespace: t }); }
Expand Down
12 changes: 12 additions & 0 deletions src/parser/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,3 +428,15 @@ test('fails on error', () => {
)
).toThrow(/duplicate variable declaration: "a"/);
});

test('exotic precision statements', () => {
// Regression to test for upper/loweracse typos in specific keywords
expect(
c.parse(`precision highp sampler2DArrayShadow;`).program[0].declaration
.specifier.specifier.token
).toBe('sampler2DArrayShadow');
expect(
c.parse(`precision highp sampler2DRectShadow;`).program[0].declaration
.specifier.specifier.token
).toBe('sampler2DRectShadow');
});

0 comments on commit e7e0207

Please sign in to comment.