MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / parse_regex

Function parse_regex

examples/js/repl.js:1389–1424  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1387 }
1388
1389 function parse_regex() {
1390 style = 'regex';
1391 push_state('/');
1392 while (i < n) {
1393 c = str[i++];
1394 if (c == '\n') {
1395 style = 'error';
1396 continue;
1397 }
1398 if (c == '\\') {
1399 if (i < n) {
1400 i++;
1401 }
1402 continue;
1403 }
1404 if (last_state() == '[') {
1405 if (c == ']') {
1406 pop_state()
1407 }
1408 // ECMA 5: ignore '/' inside char classes
1409 continue;
1410 }
1411 if (c == '[') {
1412 push_state('[');
1413 if (str[i] == '[' || str[i] == ']')
1414 i++;
1415 continue;
1416 }
1417 if (c == '/') {
1418 pop_state();
1419 while (i < n && is_word(str[i]))
1420 i++;
1421 break;
1422 }
1423 }
1424 }
1425
1426 function parse_number() {
1427 style = 'number';

Callers 1

colorize_jsFunction · 0.85

Calls 4

push_stateFunction · 0.85
last_stateFunction · 0.85
pop_stateFunction · 0.85
is_wordFunction · 0.85

Tested by

no test coverage detected