ref: 747a93838216bb85d7184d75143cbc759fadf3aa
parent: 45e2f80a80b796cdb4f4c50c30bc0ff2b765a6e2
author: Tor Andersson <tor@ccxvii.net>
date: Thu Jan 9 21:49:15 EST 2014
Parse regexp.
--- a/js-parse.c
+++ b/js-parse.c
@@ -243,6 +243,12 @@
next(J);
return a;
}
+ if (J->lookahead == TK_REGEXP) {
+ a = jsP_newstrnode(J, AST_REGEXP, J->text);
+ // TODO: flags
+ next(J);
+ return a;
+ }
if (J->lookahead == TK_NUMBER) {
a = jsP_newnumnode(J, AST_NUMBER, J->number);
next(J);
@@ -551,7 +557,7 @@
expect(J, '{');
if (accept(J, '}'))
- return NULL;
+ return STM1(BLOCK, NULL);
node = caseclause(J);
head = tail = LIST(node);