feat: add Python and Java regex engines
This commit is contained in:
@@ -211,6 +211,8 @@ export function MinimizePanel({
|
||||
() => optionsFor(activeFlavour, activeOptions, "pcre2"),
|
||||
[activeFlavour, activeOptions],
|
||||
);
|
||||
const activeEngineSupported =
|
||||
activeFlavour === "ecmascript" || activeFlavour === "pcre2";
|
||||
|
||||
const unitExpectation = (): RegexTestExpectation => {
|
||||
switch (unitKind) {
|
||||
@@ -244,10 +246,14 @@ export function MinimizePanel({
|
||||
const activeSide = {
|
||||
flavour:
|
||||
activeFlavour === "pcre2" ? ("pcre2" as const) : ("ecmascript" as const),
|
||||
flavourVersion: activeFlavourVersion,
|
||||
flavourVersion: activeEngineSupported
|
||||
? activeFlavourVersion
|
||||
: ECMASCRIPT.defaultVersion,
|
||||
pattern: initialPattern,
|
||||
flags: activeFlags,
|
||||
options: activeOptions,
|
||||
flags: activeEngineSupported ? activeFlags : ECMASCRIPT.defaultFlags,
|
||||
options: activeEngineSupported
|
||||
? activeOptions
|
||||
: defaultRegexOptions(ECMASCRIPT),
|
||||
...(unitKind === "replacement" ? { replacement: initialReplacement } : {}),
|
||||
};
|
||||
|
||||
@@ -324,6 +330,12 @@ export function MinimizePanel({
|
||||
};
|
||||
|
||||
const run = async () => {
|
||||
if (mode !== "comparison-mismatch" && !activeEngineSupported) {
|
||||
setStatus(
|
||||
`Subject minimization is not yet implemented for ${activeFlavour}; select ECMAScript or PCRE2, or use the explicit ECMAScript ↔ PCRE2 comparison target.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
const currentRevision = ++revision.current;
|
||||
setRunning(true);
|
||||
setResult(undefined);
|
||||
@@ -384,6 +396,13 @@ export function MinimizePanel({
|
||||
replacement. It does not claim a globally or semantically minimal
|
||||
example.
|
||||
</p>
|
||||
{!activeEngineSupported ? (
|
||||
<p className="minimizer-advisory" role="status">
|
||||
Python and Java execution remain available in the main workbench,
|
||||
corpus and unit-test modes. This reducer currently has verified
|
||||
failure oracles only for ECMAScript and PCRE2.
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
<section className="minimizer-config" aria-labelledby="minimize-target">
|
||||
<header>
|
||||
@@ -716,7 +735,10 @@ export function MinimizePanel({
|
||||
<button
|
||||
type="button"
|
||||
className="primary-button"
|
||||
disabled={running}
|
||||
disabled={
|
||||
running ||
|
||||
(mode !== "comparison-mismatch" && !activeEngineSupported)
|
||||
}
|
||||
onClick={() => void run()}
|
||||
>
|
||||
{running ? "Minimizing…" : "Verify & minimize"}
|
||||
|
||||
Reference in New Issue
Block a user