aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2013-09-02 09:56:27 +0300
committerMihai Bazon <mihai@bazon.net>2013-09-02 09:56:27 +0300
commit78a217b94c7648c88c46e0f5e9c15c747bef35dd (patch)
tree3ed9e4a1266e398c6842aa2dcb4e6ce6d7362bdc
parenta89d23331802cabb690ac817a5a7c93144a4f9c9 (diff)
downloadtracifyjs-78a217b94c7648c88c46e0f5e9c15c747bef35dd.tar.gz
tracifyjs-78a217b94c7648c88c46e0f5e9c15c747bef35dd.zip
Fix parsing regexp after unary-prefix operator
++/x/.y Fix #284
-rw-r--r--lib/parse.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/parse.js b/lib/parse.js
index 48ab2167..cc80a935 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -688,12 +688,16 @@ function parse($TEXT, options) {
};
};
- var statement = embed_tokens(function() {
- var tmp;
+ function handle_regexp() {
if (is("operator", "/") || is("operator", "/=")) {
S.peeked = null;
S.token = S.input(S.token.value.substr(1)); // force regexp
}
+ };
+
+ var statement = embed_tokens(function() {
+ var tmp;
+ handle_regexp();
switch (S.token.type) {
case "string":
var dir = S.in_directives, stat = simple_statement();
@@ -1279,6 +1283,7 @@ function parse($TEXT, options) {
var start = S.token;
if (is("operator") && UNARY_PREFIX(start.value)) {
next();
+ handle_regexp();
var ex = make_unary(AST_UnaryPrefix, start.value, maybe_unary(allow_calls));
ex.start = start;
ex.end = prev();