refactor: simplify pass (trekexecute)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
76f74793e9
commit
52c382c198
8 changed files with 45 additions and 52 deletions
|
|
@ -270,13 +270,12 @@ const commandView = commandPositionView(deobfuscated.replace(/\x1B\[[0-9;]*m/g,
|
|||
// only when exactly one line, trimmed, equals the delimiter and every line
|
||||
// after it is empty.
|
||||
const ARGS_DELIM = 'VOYAGE_ARGS_EOF_7F3C9E';
|
||||
const argsOpener = /<<-?\s*(['"\\]?)VOYAGE_ARGS_EOF_7F3C9E(['"]?)/.exec(command);
|
||||
const argsOpener = new RegExp(`<<-?\\s*(['"\\\\]?)${ARGS_DELIM}(['"]?)`).exec(command);
|
||||
if (argsOpener) {
|
||||
const [, open, close] = argsOpener;
|
||||
const quoted = (open === '\\' && close === '') || (open !== '' && open !== '\\' && close === open);
|
||||
const quoted = open === '\\' ? close === '' : open !== '' && close === open;
|
||||
const lines = command.split('\n');
|
||||
const closing = [];
|
||||
lines.forEach((line, i) => { if (line.trim() === ARGS_DELIM) closing.push(i); });
|
||||
const closing = lines.flatMap((l, i) => (l.trim() === ARGS_DELIM ? [i] : []));
|
||||
const closesOnceAtEnd = closing.length === 1 &&
|
||||
lines.slice(closing[0] + 1).every((line) => line.trim() === '');
|
||||
if (!quoted || !closesOnceAtEnd) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue