MCPcopy
hub / github.com/mishoo/UglifyJS-old / read_string

Function read_string

lib/parse-js.js:432–461  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

430 };
431
432 function read_string() {
433 return with_eof_error("Unterminated string constant", function(){
434 var quote = next(), ret = "";
435 for (;;) {
436 var ch = next(true);
437 if (ch == "\\") {
438 // read OctalEscapeSequence (XXX: deprecated if "strict mode")
439 // https://github.com/mishoo/UglifyJS/issues/178
440 var octal_len = 0, first = null;
441 ch = read_while(function(ch){
442 if (ch >= "0" && ch <= "7") {
443 if (!first) {
444 first = ch;
445 return ++octal_len;
446 }
447 else if (first <= "3" && octal_len <= 2) return ++octal_len;
448 else if (first >= "4" && octal_len <= 1) return ++octal_len;
449 }
450 return false;
451 });
452 if (octal_len > 0) ch = String.fromCharCode(parseInt(ch, 8));
453 else ch = read_escaped_char(true);
454 }
455 else if (ch == quote) break;
456 else if (ch == "\n") throw EX_EOF;
457 ret += ch;
458 }
459 return token("string", ret);
460 });
461 };
462
463 function read_line_comment() {
464 next();

Callers 1

next_tokenFunction · 0.85

Calls 5

with_eof_errorFunction · 0.85
nextFunction · 0.85
read_whileFunction · 0.85
read_escaped_charFunction · 0.85
tokenFunction · 0.85

Tested by

no test coverage detected