Merge f38359e43d
into 7830ea7bae
This commit is contained in:
commit
eedbe0e336
|
@ -291,6 +291,11 @@ function genRX(
|
||||||
// double quotes "(\\"|[^\"])*"
|
// double quotes "(\\"|[^\"])*"
|
||||||
// single quotes '(\\'|[^'])*'
|
// single quotes '(\\'|[^'])*'
|
||||||
// ticks `(\\`|[^`])*`
|
// ticks `(\\`|[^`])*`
|
||||||
|
// iife \(\s*((function)\s*\(\s*\)|(\(\s*\))\s*=>)\s*(?:\{[\s\S]*?\}|[^;)\{]*)\s*\)\s*\(\s*\)
|
||||||
|
//
|
||||||
|
// The iife support is (intentionally) limited. It only supports
|
||||||
|
// function and arrow syntax with no arguments, and does not support nested
|
||||||
|
// IIFEs.
|
||||||
//
|
//
|
||||||
// We also want to match the non delimiter part of statements
|
// We also want to match the non delimiter part of statements
|
||||||
// note we only support ; statement delimiters:
|
// note we only support ; statement delimiters:
|
||||||
|
@ -298,7 +303,7 @@ function genRX(
|
||||||
// [^;]
|
// [^;]
|
||||||
//
|
//
|
||||||
const statementRe =
|
const statementRe =
|
||||||
/(\/(\\\/|[^\/])*\/|"(\\"|[^\"])*"|'(\\'|[^'])*'|`(\\`|[^`])*`|[^;])+/gm
|
/(\/(\\\/|[^\/])*\/|"(\\"|[^\"])*"|'(\\'|[^'])*'|`(\\`|[^`])*`|\(\s*((function)\s*\(\s*\)|(\(\s*\))\s*=>)\s*(?:\{[\s\S]*?\}|[^;)\{]*)\s*\)\s*\(\s*\)|[^;])+/gm
|
||||||
const statements = ctx.value.trim().match(statementRe)
|
const statements = ctx.value.trim().match(statementRe)
|
||||||
if (statements) {
|
if (statements) {
|
||||||
const lastIdx = statements.length - 1
|
const lastIdx = statements.length - 1
|
||||||
|
|
Loading…
Reference in New Issue