refactor: simplify pass (trekexecute)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1f5b42556e
commit
9b80e6c14c
3 changed files with 8 additions and 11 deletions
|
|
@ -373,7 +373,7 @@ function argsCutInString(text, o) {
|
|||
|
||||
// Each heredoc operator in `text`, in text order, as the shell reads its word:
|
||||
// { index (the operator's first <), end, word, quoted, unreadable, cutOnly }.
|
||||
function argsShellOpeners(text) {
|
||||
function argsShellOpeners(text, lim = argsEscapeLimit(text)) {
|
||||
const n = text.length;
|
||||
// The index after any run of continuations that starts at k.
|
||||
const skip = (k) => {
|
||||
|
|
@ -381,7 +381,6 @@ function argsShellOpeners(text) {
|
|||
return k;
|
||||
};
|
||||
const openers = [];
|
||||
const lim = argsEscapeLimit(text);
|
||||
let i = text.indexOf('<');
|
||||
while (i !== -1) {
|
||||
if (argsEscapedLt(text, i, lim)) { i = text.indexOf('<', i + 1); continue; }
|
||||
|
|
@ -477,7 +476,7 @@ if (command.replace(/\\\n/g, '').includes(ARGS_DELIM)) {
|
|||
if (!quoted || !closesOnceAtEnd) blockArgs(!quoted, false);
|
||||
}
|
||||
let bodyFrom = Infinity;
|
||||
for (const o of argsShellOpeners(command)) {
|
||||
for (const o of argsShellOpeners(command, argsLim)) {
|
||||
if (o.index >= bodyFrom && o.cutOnly) continue;
|
||||
if (o.cutOnly && argsCutInString(command, o)) continue;
|
||||
// The word is compared trimmed, as the body lines are: a word of D plus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue