From c05af65543c78d53f5c6e197b27a5d54ceec6b70 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Sat, 18 Jul 2026 18:05:54 +1000 Subject: [PATCH] argparsingtest 1.0.0: per-style parser sets opts/tkstyle/tclstyle with N/A capability rows Restructure of the parser-timing module around three calling styles: - parser procs move into per-style child namespaces argparsingtest::opts / ::tkstyle (2 leading positionals) / ::tclstyle (2 trailing positionals), with identical short proc names across styles; the test1_ prefix is gone - hand-rolled parsers share a manual_ prefix (manual_ni, manual_switch, manual_prefix, ...) so they group visually in the comparison tables; test1_prefix2 removed (not meaningfully distinct from test1_prefix) - tkstyle/tclstyle carry a representative roster (manual_switch baseline + punkargs/punkargs_by_id/punkargs_parsecache + opt + cmdline + tepam); style parsers return a {p1 p2 opts} list - new 'unsupported' discovery status for library/style combos the backing library cannot express: cmdline with leading positionals (getoptions stops at the first non-option word - probe verified), argp with any positionals (parseArgs walks the whole list as option pairs - source verified). compare renders these as N/A rows below the timed rows so every library still appears in every style's table - harness procs (discover_parsers/timeit/first_call/compare) gain -style all|opts|tkstyle|tclstyle and return results keyed by style; -args requires a single -style (each style has its own default vector); external probe keys drop the test1_ prefix (getopt/parse_args/argparse/cmdr) - punkargs_by_id variants keep the eager punk::args::define as sole doc source (the former duplicate argdoc lappend made the lazy namespace scan undefine/re-register the id on first introspection); unused struct::set require dropped; opt/cmdline/tepam requires hoisted to module top; first_call library warm-ups extended with positional coverage - test suite rewritten: 17 tests including per-parser {p1 p2 opts} contract checks across both positional styles, N/A table rendering, roster counts and the -style/-args error paths Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.com --- src/modules/argparsingtest-999999.0a1.0.tm | 2283 +++++++++++------ src/modules/argparsingtest-buildversion.txt | 6 +- .../argparsingtest/argparsingtest.test | 204 +- 3 files changed, 1672 insertions(+), 821 deletions(-) diff --git a/src/modules/argparsingtest-999999.0a1.0.tm b/src/modules/argparsingtest-999999.0a1.0.tm index 00a7bfc8..db32eaad 100644 --- a/src/modules/argparsingtest-999999.0a1.0.tm +++ b/src/modules/argparsingtest-999999.0a1.0.tm @@ -32,6 +32,9 @@ #*** !doctools #[section Overview] #[para] overview of argparsingtest +#[para] Comparative testing of argument parsing implementations across three +#[para] calling styles: keyed options only, 'tk style' (positionals first) and +#[para] 'tcl style' (positionals last). #[subsection Concepts] #[para] - @@ -47,10 +50,15 @@ package require Tcl 8.6- package require punk::args -package require struct::set +package require opt +package require cmdline +package require tepam #*** !doctools #[item] [package {Tcl 8.6}] #[item] [package {punk::args}] +#[item] [package {opt}] +#[item] [package {cmdline}] +#[item] [package {tepam}] # #package require frobz # #*** !doctools @@ -98,21 +106,872 @@ namespace eval argparsingtest::class { # ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ # ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ -# Base namespace +# Base namespace - timing/comparison harness (the parser implementations under +# test live in the per-style child namespaces argparsingtest::opts, +# argparsingtest::tkstyle and argparsingtest::tclstyle further below) # ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ namespace eval argparsingtest { namespace export {[a-z]*} ;# Convention: export all lowercase - #variable xyz #*** !doctools #[subsection {Namespace argparsingtest}] - #[para] Core API functions for argparsingtest + #[para] Core API functions for argparsingtest - parser discovery and timing harness + #[list_begin definitions] + + # Parsing-style registry. + # Each style holds: + # title - table section heading used by compare + # argvec - default timing argument vector for the style + # roster - parser proc name -> marker, where marker is one of: + # always - proc unconditionally defined in argparsingtest::