wycats/handlebars.js — pull request #557 by dmarcotte (2013-06-12 16:04:14+00:00)
Title: `\\{{foo}}` escaping only works in some situations

Stumbled on this porting the [`\\` escape](https://github.com/wycats/handlebars.js/commit/9e4b59e815b1f557c31fe5abc36b9be8aa0cf34a#src/handlebars.l) to [Jetbrains Handlebars support](https://github.com/JetBrains/intellij-plugins/tree/master/handlebars)...

Currently, `\\{{foo}}` only results in the desired `\fooValue` if it is at the beginning of the file or immediately after a close stache (or in terms of the lexer definition, these are only properly lexed if we enter the initial state with no unlexed characters before `\\`). So, with the existing code, the following test would fail:

```javascript
shouldCompileTo("content \\\\{{foo}}", { foo: "food" }, "content \\food");
```

This pull updates the lexer to properly tokenize this in all situations, and in service of that refactors the lexing around both the `\` and `\\` escape cases.

Hope this helps, and as always: thanks for all the work you guys do.