Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #8 from BonsaiDen/master
Browse files Browse the repository at this point in the history
Thanks Ivo! Fixed parser bug with regexp literals inside of Arrays
  • Loading branch information
swernerx committed Feb 10, 2012
2 parents e83a206 + 7b3845d commit f86953e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jasy/js/parse/Parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ def PrimaryExpression(tokenizer, staticContext):
elif tokenType == "left_bracket":
node = builder.ARRAYINIT_build(tokenizer)
while True:
tokenType = tokenizer.peek()
tokenType = tokenizer.peek(True)
if tokenType == "right_bracket":
break

Expand Down
3 changes: 3 additions & 0 deletions jasy/test/compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ def test_or(self):
def test_regexp(self):
self.assertEqual(self.process('var x = /[a-z]/g.exec(foo);'), 'var x=/[a-z]/g.exec(foo);')

def test_regexp_in_array(self):
self.assertEqual(self.process('var x = [/[a-z]/];'), 'var x=[/[a-z]/];')

def test_return(self):
self.assertEqual(self.process('function y() { return 1; }'), 'function y(){return 1}')

Expand Down

0 comments on commit f86953e

Please sign in to comment.