()
| 438 | }; |
| 439 | |
| 440 | function read_regexp() { |
| 441 | return with_eof_error("Unterminated regular expression", function(){ |
| 442 | var prev_backslash = false, regexp = "", ch, in_class = false; |
| 443 | while ((ch = next(true))) if (prev_backslash) { |
| 444 | regexp += "\\" + ch; |
| 445 | prev_backslash = false; |
| 446 | } else if (ch == "[") { |
| 447 | in_class = true; |
| 448 | regexp += ch; |
| 449 | } else if (ch == "]" && in_class) { |
| 450 | in_class = false; |
| 451 | regexp += ch; |
| 452 | } else if (ch == "/" && !in_class) { |
| 453 | break; |
| 454 | } else if (ch == "\\") { |
| 455 | prev_backslash = true; |
| 456 | } else { |
| 457 | regexp += ch; |
| 458 | } |
| 459 | var mods = read_while(function(ch){ |
| 460 | return HOP(REGEXP_MODIFIERS, ch); |
| 461 | }); |
| 462 | return token("regexp", [ regexp, mods ]); |
| 463 | }); |
| 464 | }; |
| 465 | |
| 466 | function read_operator(prefix) { |
| 467 | function grow(op) { |
no test coverage detected
searching dependent graphs…