| 1427 | } |
| 1428 | |
| 1429 | function regexp() { |
| 1430 | var b, |
| 1431 | bit, |
| 1432 | captures = 0, |
| 1433 | depth = 0, |
| 1434 | flag = '', |
| 1435 | high, |
| 1436 | letter, |
| 1437 | length = 0, |
| 1438 | low, |
| 1439 | potential, |
| 1440 | quote, |
| 1441 | result; |
| 1442 | for (;;) { |
| 1443 | b = true; |
| 1444 | c = source_row.charAt(length); |
| 1445 | length += 1; |
| 1446 | switch (c) { |
| 1447 | case '': |
| 1448 | stop_at('unclosed_regexp', line, from); |
| 1449 | return; |
| 1450 | case '/': |
| 1451 | if (depth > 0) { |
| 1452 | warn_at('unescaped_a', line, from + length, '/'); |
| 1453 | } |
| 1454 | c = source_row.slice(0, length - 1); |
| 1455 | potential = Object.create(regexp_flag); |
| 1456 | for (;;) { |
| 1457 | letter = source_row.charAt(length); |
| 1458 | if (potential[letter] !== true) { |
| 1459 | break; |
| 1460 | } |
| 1461 | potential[letter] = false; |
| 1462 | length += 1; |
| 1463 | flag += letter; |
| 1464 | } |
| 1465 | if (source_row.charAt(length).isAlpha()) { |
| 1466 | stop_at('unexpected_a', line, from, source_row.charAt(length)); |
| 1467 | } |
| 1468 | character += length; |
| 1469 | source_row = source_row.slice(length); |
| 1470 | quote = source_row.charAt(0); |
| 1471 | if (quote === '/' || quote === '*') { |
| 1472 | stop_at('confusing_regexp', line, from); |
| 1473 | } |
| 1474 | result = it('(regexp)', c); |
| 1475 | result.flag = flag; |
| 1476 | return result; |
| 1477 | case '\\': |
| 1478 | c = source_row.charAt(length); |
| 1479 | if (c < ' ') { |
| 1480 | warn_at('control_a', line, from + length, String(c)); |
| 1481 | } else if (c === '<') { |
| 1482 | warn_at(bundle.unexpected_a, line, from + length, '\\'); |
| 1483 | } |
| 1484 | length += 1; |
| 1485 | break; |
| 1486 | case '(': |