jshint/jshint — pull request #972 by guyzmo (2013-03-28 20:19:21+00:00)
Title: fixed state handling in lexer

When looking ahead with a `peek` loop, the parser calls `lexer.token()` and pushes the result in a stack, that gets unstacked when using `advance()`.

But the lexer also checks the environment using the `state` global to raise environment dependent lexing warnings or errors.

That's where there is a design flaw: if the parser `peek()`s to determine whether the upcoming expression or statements has to change or not the environment, but the lexer needs the environment to be updated in order to trigger correct checks, some warnings/erros will always be raised and others will never be.

That has been a problem with `jsonMode`, and `{`/`[` syntax determination in `destructuringAssignOrJsonValue()` and again with fat arrow support.

That's why here is an implementation of `trigger_async`, that updates an array of function `checks` that gets tied to the current token, and ran by the `parser` in the `advance()` function.