···4040exports[`works with local recursion 1`] = `
4141"import { match as m, tag, _exec, _pattern } from 'reghex';
42424343+var _inner_expression = _pattern(/inner/);
4444+4345const inner = function (state) {
4446 var index_1 = state.index;
4547 var node = [];
4648 var match;
47494848- if (match = _exec(state, \\"inner\\")) {
5050+ if (match = _exec(state, _inner_expression)) {
4951 node.push(match);
5052 } else {
5153 state.index = index_1;
-9
src/babel/transform.js
···115115 const matchPath = binding.path.get('init');
116116 if (this.isMatch(matchPath)) return expression;
117117 }
118118- } else if (
119119- t.isRegExpLiteral(expression) &&
120120- !regexPatternsRe.test(expression.pattern)
121121- ) {
122122- // NOTE: This is an optimisation path, where the pattern regex is inlined
123123- // and has determined to be "simple" enough to be turned into a string
124124- return t.stringLiteral(
125125- expression.pattern.replace(/\\./g, (x) => x[1])
126126- );
127118 }
128119129120 const id = path.scope.generateUidIdentifier(
-7
src/core.js
···1717 if (typeof pattern === 'function') {
1818 while (typeof pattern === 'function') pattern = pattern(state);
1919 return pattern;
2020- } else if (typeof pattern === 'string') {
2121- const end = state.index + pattern.length;
2222- const sub = state.input.slice(state.index, end);
2323- if (sub === pattern) {
2424- state.index = end;
2525- match = sub;
2626- }
2720 } else if (isStickySupported) {
2821 pattern.lastIndex = state.index;
2922 if (pattern.test(state.input)) {