Mirror: The magical sticky regex-based parser generator 🧙

Fix accidentaly .only() in plugin.test.js

Changed files
+31 -31
src
babel
+30 -30
src/babel/__snapshots__/plugin.test.js.snap
···
var _reghex = require(\\"reghex\\");
-
var _node_expression = _reghex.__private.pattern(1),
-
_node_expression2 = _reghex.__private.pattern(2);
const node = function (state) {
var y1 = state.y,
···
var node = [];
var x;
-
if (x = _reghex.__private.exec(state, _node_expression)) {
node.push(x);
} else {
state.y = y1;
···
return;
}
-
if (x = _reghex.__private.exec(state, _node_expression2)) {
node.push(x);
} else {
state.y = y1;
···
`;
exports[`works with local recursion 1`] = `
-
"import { match as m, tag, __private } from 'reghex';
-
var _inner_expression = __private.pattern(/inner/);
const inner = function (state) {
var y1 = state.y,
···
var node = [];
var x;
-
if (x = __private.exec(state, _inner_expression)) {
node.push(x);
} else {
state.y = y1;
···
var node = [];
var x;
-
if (x = inner(state)) {
node.push(x);
} else {
state.y = y1;
···
`;
exports[`works with non-capturing groups 1`] = `
-
"import { match, __private } from 'reghex';
-
var _node_expression = __private.pattern(1),
-
_node_expression2 = __private.pattern(2),
-
_node_expression3 = __private.pattern(3);
const node = function (state) {
var y1 = state.y,
···
var node = [];
var x;
-
if (x = __private.exec(state, _node_expression)) {
node.push(x);
} else {
state.y = y1;
···
var y3 = state.y,
x3 = state.x;
-
if (x = __private.exec(state, _node_expression2)) {
node.push(x);
} else {
state.y = y3;
···
var y3 = state.y,
x3 = state.x;
-
if (x = __private.exec(state, _node_expression3)) {} else {
if (j3) {
state.y = y3;
state.x = x3;
···
`;
exports[`works with self-referential thunks 1`] = `
-
"import { match, tag, __private } from 'reghex';
const inner = function (state) {
var y1 = state.y,
···
var node = [];
var x;
-
if (x = node(state)) {
node.push(x);
} else {
state.y = y1;
···
var node = [];
var x;
-
if (x = inner(state)) {
node.push(x);
} else {
state.y = y1;
···
`;
exports[`works with standard features 1`] = `
-
"import { match, __private } from \\"reghex\\";
-
var _node_expression = __private.pattern(1),
-
_node_expression2 = __private.pattern(2),
-
_node_expression3 = __private.pattern(3),
-
_node_expression4 = __private.pattern(4),
-
_node_expression5 = __private.pattern(5);
const node = function (state) {
var y1 = state.y,
···
var y2 = state.y,
x2 = state.x;
-
if (x = __private.exec(state, _node_expression)) {
node.push(x);
} else {
if (j2) {
···
var y2 = state.y,
x2 = state.x;
-
if (x = __private.exec(state, _node_expression2)) {
node.push(x);
} else {
if (j2) {
···
x2 = state.x;
var ln2 = node.length;
-
if (x = __private.exec(state, _node_expression3)) {
node.push(x);
} else {
state.y = y2;
···
var y4 = state.y,
x4 = state.x;
-
if (x = __private.exec(state, _node_expression4)) {
node.push(x);
} else {
state.y = y4;
state.x = x4;
}
-
if (x = __private.exec(state, _node_expression5)) {
node.push(x);
} else {
state.y = y2;
···
`;
exports[`works with transform functions 1`] = `
-
"import { match, __private } from 'reghex';
var _inner_transform = x => x;
···
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,
···
var node = [];
var x;
+
if ((x = _node_expression(state)) != null) {
node.push(x);
} else {
state.y = y1;
···
return;
}
+
if ((x = _node_expression2(state)) != null) {
node.push(x);
} else {
state.y = y1;
···
`;
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,
···
var node = [];
var x;
+
if ((x = _inner_expression(state)) != null) {
node.push(x);
} else {
state.y = y1;
···
var node = [];
var x;
+
if ((x = inner(state)) != null) {
node.push(x);
} else {
state.y = y1;
···
`;
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,
···
var node = [];
var x;
+
if ((x = _node_expression(state)) != null) {
node.push(x);
} else {
state.y = y1;
···
var y3 = state.y,
x3 = state.x;
+
if ((x = _node_expression2(state)) != null) {
node.push(x);
} else {
state.y = y3;
···
var y3 = state.y,
x3 = state.x;
+
if ((x = _node_expression3(state)) != null) {} else {
if (j3) {
state.y = y3;
state.x = x3;
···
`;
exports[`works with self-referential thunks 1`] = `
+
"import { match, tag, __pattern as _pattern } from 'reghex';
const inner = function (state) {
var y1 = state.y,
···
var node = [];
var x;
+
if ((x = node(state)) != null) {
node.push(x);
} else {
state.y = y1;
···
var node = [];
var x;
+
if ((x = inner(state)) != null) {
node.push(x);
} else {
state.y = y1;
···
`;
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,
···
var y2 = state.y,
x2 = state.x;
+
if ((x = _node_expression(state)) != null) {
node.push(x);
} else {
if (j2) {
···
var y2 = state.y,
x2 = state.x;
+
if ((x = _node_expression2(state)) != null) {
node.push(x);
} else {
if (j2) {
···
x2 = state.x;
var ln2 = node.length;
+
if ((x = _node_expression3(state)) != null) {
node.push(x);
} else {
state.y = y2;
···
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;
···
`;
exports[`works with transform functions 1`] = `
+
"import { match, __pattern as _pattern } from 'reghex';
var _inner_transform = x => x;
+1 -1
src/babel/plugin.test.js
···
).toMatchSnapshot();
});
-
it.only('deduplicates hoisted expressions', () => {
const code = `
import { match } from 'reghex/macro';
···
).toMatchSnapshot();
});
+
it('deduplicates hoisted expressions', () => {
const code = `
import { match } from 'reghex/macro';