I’m building a JavaScript parser and got an error when testing it on jQuery on line 496:
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
I have reduced it down to this:
a = b || function() {}
Is this valid ECMA-262 or is it a feature that has been added since then? Either way, how do I express it in terms of a parser?
My abstract syntax tree for an assignment expression is:
data Assignment
= CondExpr CondExpr
| Assign LeftExpr AssignOp Assignment
| AssignFuncDecl FuncDecl
This doesn’t support assignments in the above format.
I can explain my AST more if needed. Thanks for any help you can give!
You should look for “ecma bnf”. Here’s one of the links.