Permalink
Browse files

Merge pull request #238 from proxv/multiline-strings-semicolons

Don't insert semicolons before multi-line strings.
  • Loading branch information...
2 parents 3dc988b + 48d2fe7 commit 120ed08cae61a38062de05d6bc4e39ed9abe7647 @mishoo mishoo committed Sep 23, 2011
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/parse-js.js
View
@@ -291,12 +291,12 @@ function tokenizer($TEXT) {
function peek() { return S.text.charAt(S.pos); };
- function next(signal_eof) {
+ function next(signal_eof, in_string) {
var ch = S.text.charAt(S.pos++);
if (signal_eof && !ch)
throw EX_EOF;
if (ch == "\n") {
- S.newline_before = true;
+ S.newline_before = S.newline_before || !in_string;
++S.line;
S.col = 0;
} else {
@@ -393,8 +393,8 @@ function tokenizer($TEXT) {
}
};
- function read_escaped_char() {
- var ch = next(true);
+ function read_escaped_char(in_string) {
+ var ch = next(true, in_string);
switch (ch) {
case "n" : return "\n";
case "r" : return "\r";
@@ -442,7 +442,7 @@ function tokenizer($TEXT) {
return false;
});
if (octal_len > 0) ch = String.fromCharCode(parseInt(ch, 8));
- else ch = read_escaped_char();
+ else ch = read_escaped_char(true);
}
else if (ch == quote) break;
ret += ch;

0 comments on commit 120ed08

Please sign in to comment.