47 Commits

Author SHA1 Message Date
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
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
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
043386067a Stop accumulating line comments when trackComments is off 2012-11-05 22:39:22 +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
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
Alistair Braidwood
5fa1f088cb readString 2012-10-19 09:53:11 +02:00
Alistair Braidwood
9bdbbaaf96 isIdentifierChar to numeric 2012-10-19 09:50:08 +02:00
abraidwood
c20cdbf8fc rearrange isIdentifierStart 2012-10-19 09:47:38 +02:00
Marijn Haverbeke
6b52dc8a84 Disallow newline after throw
Closes #11
2012-10-18 15:50:07 +02:00
Marijn Haverbeke
daefc220da Require a semicolon after do/while 2012-10-17 23:09:15 +02:00
Marijn Haverbeke
e3514627a4 Add funky newlines to nonASCIIwhitespace 2012-10-17 23:02:48 +02:00
Marijn Haverbeke
330084f993 Make 'this' a proper keyword 2012-10-17 16:34:00 +02:00
Marijn Haverbeke
96d911a30f Properly parse 10. as a valid number
Closes #9
2012-10-12 23:34:11 +02:00
Marijn Haverbeke
eb888141fd Add 'ranges' option to support range arrays on nodes
Closes #7
2012-10-12 23:19:04 +02:00
Marijn Haverbeke
fb003fff3a Document program and sourceFile options 2012-10-12 23:13:26 +02:00
Marijn Haverbeke
07152c41c4 Use 'new Function' instead of '(1, eval)'
In the hope that it'll be less confusing.
2012-10-12 23:09:23 +02:00
Mihai Bazon
feaa7df563 added sourceFile and program options to parse
- if `program` is given, it'll be used as the toplevel node, instead of
  creating a new node, and statements will be added to its body
- if `sourceFile` is given and `locations` is ON, it'll set the `source`
  property in every node's `loc`.
2012-10-12 23:06:44 +02:00
Marijn Haverbeke
b5e580a876 Properly enable strict mode
Closes #8
2012-10-06 12:32:45 +02:00
Marijn Haverbeke
0590d12240 Accept \0 in strings in strict mode
Closes #3
2012-10-03 22:18:52 +02:00
Mathieu 'p01' Henri
bb6687e3d1 Stricter lineBreak regexp
Checking for `\r\n?` is redundant with the `|[\n\r\u2028\u2029]`, better straighten the regexp and check for `\r\n|[\n\r\u2028\u2029]`. This might even be a itsy bitsty bit faster.
2012-10-03 11:08:27 +02:00
Marijn Haverbeke
0820a593a6 Handle break-to-labeled-non-loop
Closes #1
2012-10-03 10:25:53 +02:00
Marijn Haverbeke
5db60dcac9 Conform to Moz spec with regards to loc properties 2012-10-02 18:01:32 +02:00
Marijn Haverbeke
30b348728c Typo in docs 2012-10-02 16:20:48 +02:00
Marijn Haverbeke
42d0c4535a More or less finish comments 2012-10-02 16:14:18 +02:00
Marijn Haverbeke
32e62f1cfc Partial parser comments 2012-10-02 10:14:57 +02:00
Marijn Haverbeke
237bfbfb9b Comment tokenizer 2012-10-02 08:44:41 +02:00
Marijn Haverbeke
60178c3d68 Shuffle parseExprAtom for expected probabilities 2012-09-24 22:06:44 +02:00
Marijn Haverbeke
092a524f43 Fix bug in number parser 2012-09-24 21:34:42 +02:00
Marijn Haverbeke
ec27961703 Less reliance on regexps, more on hacks 2012-09-24 16:15:33 +02:00
Marijn Haverbeke
56b7db4e96 Add temp index page 2012-09-24 12:03:23 +02:00
Marijn Haverbeke
587c790f7b Add esprima-derived tests, trivial benchmark 2012-09-24 11:42:01 +02:00
Marijn Haverbeke
aedcd4e12f Initial import 2012-09-24 10:48:45 +02:00