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

Function read_regexp

lib/parse-js.js:519–541  ·  view source on GitHub ↗
(regexp)

Source from the content-addressed store, hash-verified

517 };
518
519 function read_regexp(regexp) {
520 return with_eof_error("Unterminated regular expression", function(){
521 var prev_backslash = false, ch, in_class = false;
522 while ((ch = next(true))) if (prev_backslash) {
523 regexp += "\\" + ch;
524 prev_backslash = false;
525 } else if (ch == "[") {
526 in_class = true;
527 regexp += ch;
528 } else if (ch == "]" && in_class) {
529 in_class = false;
530 regexp += ch;
531 } else if (ch == "/" && !in_class) {
532 break;
533 } else if (ch == "\\") {
534 prev_backslash = true;
535 } else {
536 regexp += ch;
537 }
538 var mods = read_name();
539 return token("regexp", [ regexp, mods ]);
540 });
541 };
542
543 function read_operator(prefix) {
544 function grow(op) {

Callers 2

handle_slashFunction · 0.85
next_tokenFunction · 0.85

Calls 4

with_eof_errorFunction · 0.85
nextFunction · 0.85
read_nameFunction · 0.85
tokenFunction · 0.85

Tested by

no test coverage detected