Skip to content

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

@AndrewRayCode

Description

@AndrewRayCode

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));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions