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
··· 68 68 69 69 var _reghex = require(\\"reghex\\"); 70 70 71 - var _node_expression = _reghex.__private.pattern(1), 72 - _node_expression2 = _reghex.__private.pattern(2); 71 + var _node_expression = (0, _reghex.__pattern)(1), 72 + _node_expression2 = (0, _reghex.__pattern)(2); 73 73 74 74 const node = function (state) { 75 75 var y1 = state.y, ··· 77 77 var node = []; 78 78 var x; 79 79 80 - if (x = _reghex.__private.exec(state, _node_expression)) { 80 + if ((x = _node_expression(state)) != null) { 81 81 node.push(x); 82 82 } else { 83 83 state.y = y1; ··· 85 85 return; 86 86 } 87 87 88 - if (x = _reghex.__private.exec(state, _node_expression2)) { 88 + if ((x = _node_expression2(state)) != null) { 89 89 node.push(x); 90 90 } else { 91 91 state.y = y1; ··· 104 104 `; 105 105 106 106 exports[`works with local recursion 1`] = ` 107 - "import { match as m, tag, __private } from 'reghex'; 107 + "import { match as m, tag, __pattern as _pattern } from 'reghex'; 108 108 109 - var _inner_expression = __private.pattern(/inner/); 109 + var _inner_expression = _pattern(/inner/); 110 110 111 111 const inner = function (state) { 112 112 var y1 = state.y, ··· 114 114 var node = []; 115 115 var x; 116 116 117 - if (x = __private.exec(state, _inner_expression)) { 117 + if ((x = _inner_expression(state)) != null) { 118 118 node.push(x); 119 119 } else { 120 120 state.y = y1; ··· 132 132 var node = []; 133 133 var x; 134 134 135 - if (x = inner(state)) { 135 + if ((x = inner(state)) != null) { 136 136 node.push(x); 137 137 } else { 138 138 state.y = y1; ··· 146 146 `; 147 147 148 148 exports[`works with non-capturing groups 1`] = ` 149 - "import { match, __private } from 'reghex'; 149 + "import { match, __pattern as _pattern } from 'reghex'; 150 150 151 - var _node_expression = __private.pattern(1), 152 - _node_expression2 = __private.pattern(2), 153 - _node_expression3 = __private.pattern(3); 151 + var _node_expression = _pattern(1), 152 + _node_expression2 = _pattern(2), 153 + _node_expression3 = _pattern(3); 154 154 155 155 const node = function (state) { 156 156 var y1 = state.y, ··· 158 158 var node = []; 159 159 var x; 160 160 161 - if (x = __private.exec(state, _node_expression)) { 161 + if ((x = _node_expression(state)) != null) { 162 162 node.push(x); 163 163 } else { 164 164 state.y = y1; ··· 173 173 var y3 = state.y, 174 174 x3 = state.x; 175 175 176 - if (x = __private.exec(state, _node_expression2)) { 176 + if ((x = _node_expression2(state)) != null) { 177 177 node.push(x); 178 178 } else { 179 179 state.y = y3; ··· 189 189 var y3 = state.y, 190 190 x3 = state.x; 191 191 192 - if (x = __private.exec(state, _node_expression3)) {} else { 192 + if ((x = _node_expression3(state)) != null) {} else { 193 193 if (j3) { 194 194 state.y = y3; 195 195 state.x = x3; ··· 210 210 `; 211 211 212 212 exports[`works with self-referential thunks 1`] = ` 213 - "import { match, tag, __private } from 'reghex'; 213 + "import { match, tag, __pattern as _pattern } from 'reghex'; 214 214 215 215 const inner = function (state) { 216 216 var y1 = state.y, ··· 218 218 var node = []; 219 219 var x; 220 220 221 - if (x = node(state)) { 221 + if ((x = node(state)) != null) { 222 222 node.push(x); 223 223 } else { 224 224 state.y = y1; ··· 236 236 var node = []; 237 237 var x; 238 238 239 - if (x = inner(state)) { 239 + if ((x = inner(state)) != null) { 240 240 node.push(x); 241 241 } else { 242 242 state.y = y1; ··· 250 250 `; 251 251 252 252 exports[`works with standard features 1`] = ` 253 - "import { match, __private } from \\"reghex\\"; 253 + "import { match, __pattern as _pattern } from \\"reghex\\"; 254 254 255 - var _node_expression = __private.pattern(1), 256 - _node_expression2 = __private.pattern(2), 257 - _node_expression3 = __private.pattern(3), 258 - _node_expression4 = __private.pattern(4), 259 - _node_expression5 = __private.pattern(5); 255 + var _node_expression = _pattern(1), 256 + _node_expression2 = _pattern(2), 257 + _node_expression3 = _pattern(3), 258 + _node_expression4 = _pattern(4), 259 + _node_expression5 = _pattern(5); 260 260 261 261 const node = function (state) { 262 262 var y1 = state.y, ··· 273 273 var y2 = state.y, 274 274 x2 = state.x; 275 275 276 - if (x = __private.exec(state, _node_expression)) { 276 + if ((x = _node_expression(state)) != null) { 277 277 node.push(x); 278 278 } else { 279 279 if (j2) { ··· 295 295 var y2 = state.y, 296 296 x2 = state.x; 297 297 298 - if (x = __private.exec(state, _node_expression2)) { 298 + if ((x = _node_expression2(state)) != null) { 299 299 node.push(x); 300 300 } else { 301 301 if (j2) { ··· 315 315 x2 = state.x; 316 316 var ln2 = node.length; 317 317 318 - if (x = __private.exec(state, _node_expression3)) { 318 + if ((x = _node_expression3(state)) != null) { 319 319 node.push(x); 320 320 } else { 321 321 state.y = y2; ··· 327 327 var y4 = state.y, 328 328 x4 = state.x; 329 329 330 - if (x = __private.exec(state, _node_expression4)) { 330 + if ((x = _node_expression4(state)) != null) { 331 331 node.push(x); 332 332 } else { 333 333 state.y = y4; 334 334 state.x = x4; 335 335 } 336 336 337 - if (x = __private.exec(state, _node_expression5)) { 337 + if ((x = _node_expression5(state)) != null) { 338 338 node.push(x); 339 339 } else { 340 340 state.y = y2; ··· 351 351 `; 352 352 353 353 exports[`works with transform functions 1`] = ` 354 - "import { match, __private } from 'reghex'; 354 + "import { match, __pattern as _pattern } from 'reghex'; 355 355 356 356 var _inner_transform = x => x; 357 357
+1 -1
src/babel/plugin.test.js
··· 34 34 ).toMatchSnapshot(); 35 35 }); 36 36 37 - it.only('deduplicates hoisted expressions', () => { 37 + it('deduplicates hoisted expressions', () => { 38 38 const code = ` 39 39 import { match } from 'reghex/macro'; 40 40