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

error parsing comma operator float c = (0.0, 1.0); #22

Open
AndrewRayCode opened this issue Dec 25, 2018 · 0 comments
Open

error parsing comma operator float c = (0.0, 1.0); #22

AndrewRayCode opened this issue Dec 25, 2018 · 0 comments

Comments

@AndrewRayCode
Copy link

I didn't realize this was valid glsl code, but apparently it is:

float c = (0.0, 1.0);

and it evaluates to the last statement.

So this fails:

console.log( deparse( parse( tokenize(` void main(void) { float c = (1.0, 2.0); }`) ) ) );
expected `)`, got `,` at line 4
      at Array.unexpected (node_modules/glsl-parser/lib/index.js:737:11)
      at advance (node_modules/glsl-parser/lib/expr.js:219:18)
      at Object.nud (node_modules/glsl-parser/lib/expr.js:87:3)
      at expression (node_modules/glsl-parser/lib/expr.js:156:12)
      at Object.<anonymous>.module.exports (node_modules/glsl-parser/lib/expr.js:116:12)
      at parseexpr (node_modules/glsl-parser/lib/index.js:681:9)
      at parse_expr (node_modules/glsl-parser/lib/index.js:650:14)
      at write (node_modules/glsl-parser/lib/index.js:220:11)
      at reader (node_modules/glsl-parser/lib/index.js:181:5)
      at parseArray (node_modules/glsl-parser/direct.js:9:5)

Same with things like:

vec2 q = vec2((1.0, 2.0));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant