fix(plan): a 1.9 plan refuses placeholders and mixed-case bare names as files
Operator decision 22 (13.10); review finding 33f37f53. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fddd0a078c
commit
48b57284fe
3 changed files with 50 additions and 6 deletions
|
|
@ -499,17 +499,22 @@ export function fieldPaths(text) {
|
|||
// opens with `File:` always starts a new entry; a `File:` mid-line names no
|
||||
// test (review `4b6460e5`).
|
||||
//
|
||||
// isPathShape is the test fieldPaths puts on a span in the leading position of
|
||||
// an entry (a path, a build file, or a capitalised name such as `LICENSE`), so
|
||||
// a 1.9 entry's leading span is judged exactly as the reader below 1.9 judges
|
||||
// one.
|
||||
// isPathShape is the 1.9-only test on a span in the leading position of an
|
||||
// entry (operator decision 22, 13.10): a placeholder (none, TBD, TODO, TBA,
|
||||
// N/A, NA, `...`) is no file; a path, a build file or an all-capitals name
|
||||
// such as `LICENSE` or `README` is; a mixed-case bare name (`Parser`) is not,
|
||||
// and `./Name` names such a file. The readers below 1.9 keep BARE_NAME.
|
||||
|
||||
const LEADING_SPAN = /^`([^`\n]+)`/;
|
||||
// Operator decision 22: these words are the input a 1.9 plan refuses, not unfinished code.
|
||||
const PLACEHOLDER = /^(?:none|n\/?a|tbd|tba|todo|\.{3})$/i;
|
||||
const CAPS_NAME = /^[A-Z][A-Z0-9_-]*$/;
|
||||
|
||||
/** A backticked span in the leading position of an entry that names a file. */
|
||||
export function isPathShape(s) {
|
||||
const span = String(s ?? '').trim();
|
||||
return tickedPath(span) || BUILD_FILE.test(span) || BARE_NAME.test(span);
|
||||
if (PLACEHOLDER.test(span)) return false;
|
||||
return tickedPath(span) || BUILD_FILE.test(span) || CAPS_NAME.test(span);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -233,7 +233,8 @@ function pathGrammarIssue(n, code, shown, w) {
|
|||
if (code === 'PLAN_STEP_PATH_NOT_A_PATH') {
|
||||
return issue(code, `Step ${n}: ${w.subject} opens with a backticked span that is no path: ${shown}`,
|
||||
`plan_version 1.9: the leading backticked spans of ${w.spans}; a call (\`parse()\`), an option ` +
|
||||
'or a URL is description and goes after the path.');
|
||||
'or a URL is description and goes after the path. A placeholder (`none`, `TBD`, `N/A`) names no ' +
|
||||
'file, and neither does a mixed-case bare name (`Parser`): write `./Name` for such a file.');
|
||||
}
|
||||
return issue('PLAN_STEP_PATH_NOT_FIRST',
|
||||
shown === '' ? `Step ${n}: ${w.none}` : `Step ${n}: ${w.subject} does not open with a backticked path: ${shown}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue