13320 Commits

Author SHA1 Message Date
Marijn Haverbeke
9eee5300db [loose parser] Less aggressive termination heuristic for comma-separated lists
See https://github.com/marijnh/tern/issues/118
2013-05-08 15:21:25 +02:00
Marijn Haverbeke
4d8eeabf52 In browser loader, refer to global object as 'this', not 'self'
Closes #41
2013-05-08 15:16:06 +02:00
Marijn Haverbeke
df763df61b Bump version number post-0.2 2013-05-03 11:54:04 +02:00
Marijn Haverbeke
4146605738 Mark version 0.2.0 2013-05-03 11:52:42 +02:00
Marijn Haverbeke
30b399ece7 Export isIdentifierChar and isIdentifierStart 2013-04-24 07:44:11 +02:00
Marijn Haverbeke
f3c70d76ef Remove assignment to non-existing var 2013-04-03 15:05:00 +02:00
Marijn Haverbeke
cc12062b9c [loose parser] Fix a whole bunch of issues in the options.locations support
Closes #40
2013-04-02 13:47:50 +02:00
Marijn Haverbeke
62bc3641af Use a single .handler property on TryStatements
As the wiki page for the spec currently seems to prescribe.
2013-04-02 09:30:35 +02:00
Paul Harper
a6b3034e71 [loose parser] More fixes to locations 2013-03-27 10:57:48 +01:00
Marijn Haverbeke
54e78b7035 Properly back up line state when re-reading a token on strict mode
Issue #38
2013-03-25 15:10:55 +01:00
Oskar Schöldström
a8a24f538b Fix \v being treated as v in IE < 9
IE < 9 treats '\v' as 'v' instead of a vertical tab ('\u000b').
Read more: http://mathiasbynens.be/notes/javascript-escapes
2013-03-23 19:18:28 +01:00
Marijn Haverbeke
76be1f8eee Make Acorn work with AMD modules
(Hopefully)
2013-03-17 22:56:49 +01:00
Paul Harper
559518acc8 .parse_dammit() now recognizes the locations option, and will add a loc object to the ast nodes as .parse() does 2013-03-17 22:07:14 +01:00
Marijn Haverbeke
38179fd855 Fix node boundaries for unexpected regular expressions
Closes #33
2013-02-28 19:28:20 +01:00
Marijn Haverbeke
0b10aa2256 Add walk.findNodeBefore 2013-02-28 19:27:29 +01:00
Marijn Haverbeke
83cdcf7dbf Remove outdated option from bin/acorn 2013-02-27 09:59:42 +01:00
zsjforcn
173d94f019 [package] Add "bin" property to package.json for npm to auto generate exection files. 2013-02-27 09:39:09 +01:00
Marijn Haverbeke
9a55d60324 Move back to regular string accumulation in readString
The apply call is a stack overflow hazard.

Closes #31
2013-02-24 21:26:09 +01:00
Marijn Haverbeke
b1845b51b1 [util/walk] Add findNodeAfter 2013-02-24 21:25:25 +01:00
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
adcb354498 [walker] Fix broken handling of node predicates 2013-02-14 14:02:48 +01:00
Marijn Haverbeke
006d5f1c04 Bump version post-0.1 2013-02-14 10:02:27 +01:00
Marijn Haverbeke
c108741d07 Mark release 0.1 2013-02-14 10:00:19 +01:00
Marijn Haverbeke
da83f80d29 Allow passing a test predicate to findNodeAt and findNodeAround 2013-02-12 17:35:04 +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
d98e378590 Store default walker in exports.base, rather than exports itself
My initial idea, that client code would constantly need to access the individual
walker functions directly, isn't actually the case. This prevents unnecessary copying
of other interface functions into walkers.
2013-01-30 19:11:27 +01:00
Alistair Braidwood
0632b36c94 Improve options.locations performance by tracking newlines rather than finding them 2013-01-30 17:30:38 +01:00
Marijn Haverbeke
87a6a5a8cd Clean up readNumber, fix parsing of '2.+2'
Issue #9
2013-01-30 16:38:31 +01:00
Marijn Haverbeke
792fa96e93 Add walk.findNodeAround 2013-01-28 17:17: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
keeyipchan
44f7aff2b7 Add testAssert() for arbitrary tests; fix skinLineComments() passing off-by-1 character to onComment(slice(.., end)) 2013-01-27 10:09:06 +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
7d73fe243a Upgrade Esprima 2013-01-17 14:17:10 +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
Marijn Haverbeke
965166cdfd Small fixes noticed while going over the when writing loose parser 2013-01-16 16:47:21 +01:00
Marijn Haverbeke
4d2d8408de Export the tokenizer 2013-01-16 12:46:26 +01:00
Marijn Haverbeke
c2dd92fec0 Attach position information to errors 2013-01-16 12:20:19 +01:00
Marijn Haverbeke
3c2bd590da Fix regexp detection after void/typeof/instanceof/delete 2013-01-15 15:58:16 +01:00
Marijn Haverbeke
8104257495 Bump version to 0.0.2 2013-01-13 22:05:46 +01:00