diff options
author | Mihai Bazon <mihai@bazon.net> | 2013-09-02 11:09:54 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2013-09-02 11:09:54 +0300 |
commit | b0ca896d988bdafe5f28aa13dd14e4d6e4703108 (patch) | |
tree | 316de30545edd0d0d9ef4d0ab2e2a0fadaff70d8 | |
parent | 78a217b94c7648c88c46e0f5e9c15c747bef35dd (diff) | |
download | tracifyjs-b0ca896d988bdafe5f28aa13dd14e4d6e4703108.tar.gz tracifyjs-b0ca896d988bdafe5f28aa13dd14e4d6e4703108.zip |
Fix parsing `a.case /= 1`
Close #286
-rw-r--r-- | lib/parse.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/parse.js b/lib/parse.js index cc80a935..8801b50b 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -254,10 +254,12 @@ function tokenizer($TEXT, filename) { S.tokpos = S.pos; }; + var prev_was_dot = false; function token(type, value, is_comment) { S.regex_allowed = ((type == "operator" && !UNARY_POSTFIX(value)) || - (type == "keyword" && KEYWORDS_BEFORE_EXPRESSION(value)) || + (!prev_was_dot && type == "keyword" && KEYWORDS_BEFORE_EXPRESSION(value)) || (type == "punc" && PUNC_BEFORE_EXPRESSION(value))); + prev_was_dot = (type == "punc" && value == "."); var ret = { type : type, value : value, |