// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`deduplicates hoisted expressions 1`] = ` "import { match, __pattern as _pattern } from \\"reghex\\"; const re = /1/; const str = '1'; var _re_expression = _pattern(re), _str_expression = _pattern(str); const a = function (state) { var y1 = state.y, x1 = state.x; var node = []; var x; if ((x = _re_expression(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } if ((x = _str_expression(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } node.tag = 'a'; return node; }; var _b_expression = _pattern('2'); const b = function (state) { var y1 = state.y, x1 = state.x; var node = []; var x; if ((x = _re_expression(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } if ((x = _b_expression(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } node.tag = 'b'; return node; };" `; exports[`works together with @babel/plugin-transform-modules-commonjs 1`] = ` "\\"use strict\\"; var _reghex = require(\\"reghex\\"); var _node_expression = (0, _reghex.__pattern)(1), _node_expression2 = (0, _reghex.__pattern)(2); const node = function (state) { var y1 = state.y, x1 = state.x; var node = []; var x; if ((x = _node_expression(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } if ((x = _node_expression2(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } node.tag = 'node'; return node; };" `; exports[`works while only minifying 1`] = ` "import { match } from 'reghex/macro'; const node = match('node')([\\"\\", \\"+|\\", \\"+(\\", \\"(\\", \\"?\\", \\"))*\\"], 1, 2, 3, 4, 5);" `; exports[`works with local recursion 1`] = ` "import { match as m, tag, __pattern as _pattern } from 'reghex'; var _inner_expression = _pattern(/inner/); const inner = function (state) { var y1 = state.y, x1 = state.x; var node = []; var x; if ((x = _inner_expression(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } node.tag = 'inner'; return node; }; const node = function (state) { var y1 = state.y, x1 = state.x; var node = []; var x; if ((x = inner(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } node.tag = 'node'; return node; };" `; exports[`works with non-capturing groups 1`] = ` "import { match, __pattern as _pattern } from 'reghex'; var _node_expression = _pattern(1), _node_expression2 = _pattern(2), _node_expression3 = _pattern(3); const node = function (state) { var y1 = state.y, x1 = state.x; var node = []; var x; if ((x = _node_expression(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } var ln2 = node.length; alt_3: { block_3: { var y3 = state.y, x3 = state.x; if ((x = _node_expression2(state)) != null) { node.push(x); } else { state.y = y3; state.x = x3; node.length = ln2; break block_3; } break alt_3; } if ((x = _node_expression3(state)) == null) { state.y = y1; state.x = x1; node.length = ln2; return; } loop_3: for (;;) { var y3 = state.y, x3 = state.x; if ((x = _node_expression3(state)) == null) { state.y = y3; state.x = x3; break loop_3; } } } node.tag = 'node'; return node; };" `; exports[`works with self-referential thunks 1`] = ` "import { match, tag, __pattern as _pattern } from 'reghex'; const inner = function (state) { var y1 = state.y, x1 = state.x; var node = []; var x; if ((x = node(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } node.tag = 'inner'; return node; }; const node = function (state) { var y1 = state.y, x1 = state.x; var node = []; var x; if ((x = inner(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } node.tag = 'node'; return node; };" `; exports[`works with standard features 1`] = ` "import { match, __pattern as _pattern } from \\"reghex\\"; var _node_expression = _pattern(1), _node_expression2 = _pattern(2), _node_expression3 = _pattern(3), _node_expression4 = _pattern(4), _node_expression5 = _pattern(5); const node = function (state) { var y1 = state.y, x1 = state.x; var node = []; var x; alt_2: { block_2: { var y2 = state.y, x2 = state.x; if ((x = _node_expression(state)) != null) { node.push(x); } else { state.y = y2; state.x = x2; break block_2; } loop_2: for (;;) { var y2 = state.y, x2 = state.x; if ((x = _node_expression(state)) != null) { node.push(x); } else { state.y = y2; state.x = x2; break loop_2; } } break alt_2; } if ((x = _node_expression2(state)) != null) { node.push(x); } else { state.y = y1; state.x = x1; return; } loop_2: for (;;) { var y2 = state.y, x2 = state.x; if ((x = _node_expression2(state)) != null) { node.push(x); } else { state.y = y2; state.x = x2; break loop_2; } } loop_2: for (;;) { var y2 = state.y, x2 = state.x; var ln2 = node.length; if ((x = _node_expression3(state)) != null) { node.push(x); } else { state.y = y2; state.x = x2; node.length = ln2; break loop_2; } var y4 = state.y, x4 = state.x; if ((x = _node_expression4(state)) != null) { node.push(x); } else { state.y = y4; state.x = x4; } if ((x = _node_expression5(state)) != null) { node.push(x); } else { state.y = y2; state.x = x2; node.length = ln2; break loop_2; } } } node.tag = 'node'; return node; };" `; exports[`works with transform functions 1`] = ` "import { match, __pattern as _pattern } from 'reghex'; var _inner_transform = x => x; const first = function (state) { var y1 = state.y, x1 = state.x; var node = []; var x; node.tag = 'inner'; return _inner_transform(node); }; const transform = x => x; const second = function (state) { var y1 = state.y, x1 = state.x; var node = []; var x; node.tag = 'node'; return transform(node); };" `;