rspivak/slimit — Issue #22: Unable to Parse valid statement...
Author: hasanyasin
Created: 2012-02-04 15:14:35+00:00
State: open

**In Short:** Like it perfectly parses ```a=function(){}();``` slimit should be able to parse ```a||function(){}();``` too.

**In Detail:**
slimit parses

```(function() { return "slimit!"; } )();```

and

```a=function () { return "slimit!" ; }(); ```

perfectly.

It throws an exception for
```function() { return "slimit!"; } ();```

as
```SyntaxError: Unexpected token (LPAREN, '(') at 1:8
between LexToken(FUNCTION,'function',1,0) and LexToken(RPAREN,')',1,9)```

which is again perfect since function declaration needs a name here.

It throws the similar (unexpected token is FUNCTION this time, instead of LPAREN) exception here:

```window.done_already || function () { return "slimit!" ; }();```

which is syntactically correct like the second example above.