16 Commits

Author SHA1 Message Date
Marijn Haverbeke
72d2fc2644 Fix start offset of block nodes 2013-02-20 10:48:36 +01:00
Marijn Haverbeke
782259bea1 [loose parser] Fix bug where peeked tokens persist across parses 2013-02-14 14:05:54 +01:00
Marijn Haverbeke
76c41d3a71 [loose parser] Improve closing heuristic in parseExprList 2013-02-06 13:47:05 +01:00
Marijn Haverbeke
82980794a9 Fix bug in expression-terminating heuristic
Dedented tokens should only end an expression if they are actually the first
token on the line.

This to prevent code like this from going wrong:

    x = (function(..) {
      blah();
    })(); // <-- indented same as start of expression
2013-02-05 13:49:51 +01:00
Marijn Haverbeke
1de79a277c [loose parser] Refine block-closing heuristics, add expression-continuing heuristics 2013-01-28 16:43:19 +01:00
Marijn Haverbeke
e95c4cce50 Add walk.findNodeAt utility 2013-01-28 13:00:08 +01:00
Marijn Haverbeke
17a0094694 [loose parser] Improve recovery from unterminated strings and regexps 2013-01-17 15:01:13 +01:00
Marijn Haverbeke
f8bcc75378 [loose parser] Fix typo 2013-01-17 14:49:20 +01:00
Marijn Haverbeke
e130dc3fbb [loose parser] Use ✖ rather than question mark for placeholders
This way, attempts to re-parse the pretty-printed code won't
be confused by the question marks.
2013-01-17 14:45:16 +01:00
Marijn Haverbeke
207bf64e8d [loose parser] Revise strategy for forcing token consumption
It's easier and more flexible to simply handle it at the call site.
2013-01-17 14:44:00 +01:00
Marijn Haverbeke
b8ec8aab2c [loose parser] Fix bug in argument list parsing 2013-01-17 14:17:22 +01:00
Marijn Haverbeke
1d974ce2b6 [loose parser] Several small tweaks 2013-01-16 19:09:06 +01:00
Marijn Haverbeke
d08144c1d7 [loose parser] Support tabSize option 2013-01-16 17:53:37 +01:00
Marijn Haverbeke
3981dfa133 [loose parser] Add note about imprecision 2013-01-16 17:43:27 +01:00
Marijn Haverbeke
a2788f8864 [loose parser] Make expect check two tokens ahead if it fails to find its target 2013-01-16 17:38:56 +01:00
Marijn Haverbeke
038e438949 Add a loose parser
For getting a halfway meaningful AST out of code that may contain
syntax errors.

Use case: analyzing code as the user is editing it.
2013-01-16 17:27:28 +01:00