Open dy opened 8 years ago
Hmm, I'm not sure what version of GLSL this parser is supposed to support, but if it's WebGL GLSL, which is glsl 1.0, then this isn't valid syntax. @chrisdickinson do you have a thought on which version of GLSL this parser is built for?
Under the hood, this is happening because:
float[](5.0, 7.2, 1.1);
(the right side of the assignment operator) as an expression[
as an infix expression](https://github.com/stackgl/glsl-parser/blob/master/lib/expr.js#L60-L65)
infix('[', 80, function(left) {
this.children = [left, expression(0)]
this.type = 'binary'
advance(']')
return this
}
left
will be float
, and then it expects an expression()
inside the parens.This parser doesn't seem to follow the GLSL language grammar spec, so it's hard to compare the top down operator precedence setup with what the spec expects. For example, is it correct that [
is an infix node in this case (infixed between float
and expression
)? I'm not sure
I tried making the infix call into a unary
type instead, but the printer for the compiler doesn't print the closing [
correctly.
Though it is valid GLSL syntax.