Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addressing typo in some keywords #35

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
});
Loading