Repository navigation
compiler: \ifthenelse (ifthen package) is unsupported (#521) - #550
Conversation
Evaluate the ifthen package's \ifthenelse{test}{true}{false} at
macro-expansion time on top of the existing conditional machinery:
\equal (expanded comparison), \NOT, \AND, \OR, \isodd, \isundefined,
\lengthtest (via the \ifdim scanners) and \boolean. Test-form commands
are recognized by name during test evaluation and still pass through
untouched elsewhere. Also add \newboolean/\setboolean backed by the
\newif representation so \boolean has a documented way to be set.
Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor
Slice 1 implemented \ifthenelse (with \equal, \NOT, \AND, \OR, \isodd,
\isundefined, \lengthtest, \boolean), \newboolean/\setboolean and \newif
handling in the tex-expansion engine, which runs before the parser, so
these names never reach parser dispatch. This slice records that in the
compiler's own truth tables:
- vocabulary.rs: drop "ifthenelse" from KNOWN_UNIMPLEMENTED_COMMANDS.
- supported.rs: add \ifthenelse to EXPANSION_COMMANDS (the established
slot for engine-executed commands, cf. \newcounter) and an ifthen
package entry; regenerate supported-latex.json, docs/user/compiler.md
(render_supported_latex.sh, incl. the Mac bundle sync).
- parser.rs: package_matches_layout accepts ifthen with no options, so
\usepackage{ifthen} is silent; \whiledo stays diagnosed at its use site.
- tests: new ifthen_package.rs runs the exact issue #521 repro through
the top-level protocol path asserting zero unsupported_feature and
zero errors, plus an unknown-option package probe; supported_latex.rs
probes the real \ifthenelse form.
Note: flashtex-cli still reports the old error because it links the
frozen render-pipeline/vendor snapshot (compiler PIN c95977d,
tex-expansion PIN 87a513d), which predates both slices; a vendor
re-pin is required for the CLI to see this (integrator-owned, not done
here).
|
daniel-parent review (subagent) Verdict: CHANGES NEEDED
What was verified as correct / honest:
|
Append-shaped conflict in supported.rs PACKAGE notes: keep main's xspace entry and this branch's ifthen entry. Generated supported-latex inventory, coverage and docs/user/compiler.md regenerated via crates/compiler/scripts/render_supported_latex.sh; mac bundled copy synced. Implementation-Agent: fable-rebase-b Commit-Executor: fable-rebase-b (direct; Cursor usage limit)
Only conflict was generated docs/user/compiler.md; regenerated with the supported-latex inventory via crates/compiler/scripts/render_supported_latex.sh; mac bundled copy synced. tex-expansion files auto-merged and its suite is green. Implementation-Agent: fable-rebase-b Commit-Executor: fable-rebase-b (direct; Cursor usage limit)
Clean re-merge picking up the #638 render-pipeline list_style_nextline fix; no conflicts, supported-latex inventory unchanged and in sync. Implementation-Agent: fable-rebase-b Commit-Executor: fable-rebase-b (direct; Cursor usage limit)
Only conflict was generated docs/user/compiler.md; regenerated with the supported-latex inventory via crates/compiler/scripts/render_supported_latex.sh; mac bundled copy synced. Implementation-Agent: fable-rebase-b Commit-Executor: fable-rebase-b (direct; Cursor usage limit)
docs/user/compiler.md (generated) conflicted again; took main's copy and regenerated via render_supported_latex.sh, sync --check clean. Implementation-Agent: fable-rebase-a Commit-Executor: fable-rebase-a (direct; Cursor usage limit)
docs/user/compiler.md (generated) conflicted again; took main's copy and regenerated via render_supported_latex.sh, sync --check clean. Implementation-Agent: fable-rebase-a Commit-Executor: fable-rebase-a (direct; Cursor usage limit)
docs/user/compiler.md (generated) conflicted again; took main's copy and regenerated via render_supported_latex.sh, sync --check clean. Implementation-Agent: fable-rebase-a Commit-Executor: fable-rebase-a (direct; Cursor usage limit)
…t/parser-stack-frame Clean merge: one package_matches_layout branch, no dispatch impact. Implementation-Agent: fable-rebase-d Commit-Executor: fable-rebase-d (direct; Cursor usage limit)
docs/user/compiler.md (generated) conflicted again; took main's copy and regenerated via render_supported_latex.sh, sync --check clean. Implementation-Agent: fable-rebase-a Commit-Executor: fable-rebase-a (direct; Cursor usage limit)
Fixes #521.
What changed
\newif/\ifmyflag/\myflagtruealready worked — confirmed before starting, not touched.\ifthenelse{test}{true}{false}plus its test forms (\equal,\NOT,\AND,\OR,\isodd,\isundefined,\lengthtest,\boolean) implemented incrates/tex-expansionas new expandable primitives (Ifthenelse/NewBoolean/SetBoolean), evaluated on a sandboxed temporary input source so no tokens leak — same pattern asscan_counter_value_arg.\newboolean/\setbooleanadded, backed by the existing\newifrepresentation.vocabulary.rs: removedifthenelsefrom the unimplemented list;supported.rs: added it toEXPANSION_COMMANDS(the correct inventory slot for engine-executed commands with no parser arm — not aBUILT_INS+parser-arm, which would be dead code and let\renewcommandredefine an engine primitive).ifthenpackage usage is now silent.Tests
crates/tex-expansion: 61+3+2 passed, 0 failed (independently re-verified fresh).crates/compiler: full suite 671 passed, 0 failed, including newtests/ifthen_package.rswhich compiles the exact issue repro through the realprotocol::handle_linepath (expansion-then-parser, the same pipelineflashtex checkruns) with zerounsupported_feature/error diagnostics.crates/render-pipelinefiles touched — this is compiler+tex-expansion only, no vendor-pin dependency for merging.Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor
🤖 Generated with Claude Code