12089 Commits

Author SHA1 Message Date
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
Marijn Haverbeke
cade51347a Remove trackComments, add onComment option
trackComments was too obscure and complicated, and not all that useful.
2013-01-13 22:04:45 +01:00
Martin Carlberg
5e4ea00f3c Unnecessary 'if' as we already know 'ch !== 92' 2013-01-09 10:13:26 +01:00
Marijn Haverbeke
e6485e61fd [walker] Allow recursive walks without building a new walker obj 2013-01-08 13:17:37 +01:00
Marijn Haverbeke
cc5971f617 Formatting 2013-01-04 09:37:21 +01:00
Arian Stolwijk
f6e0182a3a Fixes sourceFile option.
When setting the .prototype.source the sourceFile variable is undefined, and
setting the sourceFile option doesn't change the .source property on the
prototype anymore.

By setting the .source property inside the node_loc_t constructor, the correct
sourceFile is set in the loc object.
2013-01-04 09:32:43 +01:00
Alistair Braidwood
3d0f85d616 line_loc type for v8 perf 2012-12-30 12:46:54 +01:00
Alistair Braidwood
c8eb50fabe create node 'class' - improve v8 performance 2012-12-30 12:46:45 +01:00
Alistair Braidwood
2bad03e654 reduce array creation in readString 2012-12-30 12:27:13 +01:00
krator
5b19196bac Give true/false/null literals a raw property
In the generated ast, "null"/"true"/"false" are "Literal" nodes.
As every "Literal" node has a 'raw' property,
When i am doing something with the ast using python,
the 3 "Literal"s caused some problem.
make the 3 "Literal"s have 'raw' property.
2012-12-24 14:26:03 +01:00
Marijn Haverbeke
f58bb9a480 Use 'self' instead of 'window' in browser, in order to work in a web worker 2012-11-29 10:08:32 +01:00
Marijn Haverbeke
d36c70bbbf Add missing labels.pop() to allow re-using labels in a block
Issue #15
2012-11-22 10:11:00 +01:00
Marijn Haverbeke
5c44c13465 Make sure readInt doesn't try to read past len, if given
Issue #15
2012-11-22 10:07:19 +01:00
Marijn Haverbeke
5771c8b4b2 Add missing semicolon() calls to debugger and throw statement parsers
Issue #5
2012-11-22 09:48:01 +01:00
Marijn Haverbeke
74536b9eb7 Remove test that raised error from the JS engine's RegExp parser 2012-11-21 14:38:21 +01:00
Marijn Haverbeke
4229ef792e Give readToken sub-functions meaningful names 2012-11-20 16:58:57 +01:00
Alistair Braidwood
04a69abae0 Split readToken to smaller functions 2012-11-20 16:58:57 +01:00
Marijn Haverbeke
4c650ad16b Add an acorn-only button to bench.html 2012-11-20 16:58:57 +01:00
Marijn Haverbeke
905124c291 Assign parenthesized expressions a range that includes the parens
This way, composite expressions that they are part of won't get bogus
unsyntactic substrings as their range (i.e. in '(1)+1', the binop expression
would span '1)+1').

Closes #14
2012-11-18 21:17:49 +01:00
Marijn Haverbeke
f91d7f5836 [walker] Allow custom fields to be added to new walkers
Issue #13
2012-11-08 21:07:48 +01:00
Marijn Haverbeke
cb6cd3038e Make the walker's scope module use objects for variables
So that subsequent passes can attach and retrieve information
from them.
2012-11-07 12:15:32 +01:00
Marijn Haverbeke
3ba6913d30 Comment walker module 2012-11-06 11:10:58 +01:00
Marijn Haverbeke
043386067a Stop accumulating line comments when trackComments is off 2012-11-05 22:39:22 +01:00
Marijn Haverbeke
b660ff6d1c Add an AST walker utility 2012-11-05 22:32:39 +01:00
Marijn Haverbeke
16f8259dab Don't allow keywords as properties when forbidReserved is on 2012-11-05 22:25:57 +01:00
Marijn Haverbeke
b591c41513 Actually make strictSemicolons forbid all semicolon insertion 2012-11-05 22:25:40 +01:00
Marijn Haverbeke
5d83150951 Attach .raw property to literal nodes 2012-11-02 16:35:09 +01:00
Marijn Haverbeke
93d4a31abb Upgrade Esprima 2012-10-19 10:31:55 +02:00
Marijn Haverbeke
48bbcd9437 Restore nonasciiwhitespace regexp
It won't make any difference except in really strange code.
2012-10-19 10:10:53 +02:00
Alistair Braidwood
b3366233d3 skipLineComment 2012-10-19 10:05:59 +02:00
Alistair Braidwood
b38a98ffd2 skipSpace 2012-10-19 10:04:51 +02:00
Marijn Haverbeke
906a8b8e5b Simplify an if/switch combo to just a switch 2012-10-19 09:58:08 +02:00