Pass delimited tokens through verbatim (S_delim); release 0.5.0 - #7
Merged
Conversation
The delimited content specification `(VAL){"d"}` trimmed every token and
silently dropped empty ones. That deviated from def:delimited-content-spec,
where the input decomposes into substrings s_k in Sigma* and S_atom applies to
each one as-is, and it made the delimited specification the odd one out: atomic
and compound segments already receive their text raw.
Splitting is now verbatim in both places it happens (a standalone delimited cell
and a delimited segment nested in a compound one): n substrings always derive n
items, numbered 0..n-1, surrounding whitespace intact and empty substrings
included. This matches pandas str.split, so patterns over exploded columns
become expressible without post-processing -- the motivating case is the
`explode` stratum of ATBench in regtab-eval-on-atbench.
BREAKING (semantics). Trimming is now opt-in through the atom's string
extractor: (VAL){","} -> (VAL=TRIM){","}. Tasks 45 and 55 relied on the implicit
trimming and were fixed that way, in both the RTL and the ATP suite; their
expected recordsets are unchanged. RTL syntax, the grammar and ATP->RTL
serialization are untouched.
Unlike jRegTab, pyRegTab tracks a byte span per item, so this is not just a
deletion: split_with_spans now reports the span of the raw token and the
leading-whitespace offset is gone. Item indices become contiguous on the
standalone path too, which is observable through POS filters.
Adds a #[cfg(test)] module to src/matcher.rs (the matcher had no unit tests of
its own) covering whitespace retention, empty tokens, contiguous indices, span
arithmetic under a non-zero base and the =TRIM opt-in.
Corpus re-pinned to jRegTab v0.5.0 (035ff1a) and synced byte-for-byte: 152
positive pairs including the new `delim_raw`, and the new normative
conformance/semantic/ section -- item 5 of the contract, executed here by
tests/test_semantic_conformance.py. Note its defaults differ from the task
suite: expected.csv is header-less and matched positionally against the schema
the pattern produced, so implementation-invented attribute names stay out of the
contract.
Release 0.5.0 (breaking behaviour change): version bumped in Cargo.toml,
Cargo.lock, pyproject.toml and __init__.py; grammar/UPSTREAM re-pinned to v0.5.0
(RTL.g4 byte-identical, sha256 unchanged); the differential CI job now builds
jregtab@v0.5.0. Verified locally against that tag: 750/750 variants identical.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings
S_delimin line with the formal model and jRegTab 0.5.0, and cuts the 0.5.0 release.The change
S_delim = (δ, S_atom)decomposes the cell text into substringss_k ∈ Σ*and appliesS_atomto each as-is. pyRegTab trimmed every token and silently dropped empty ones, making the delimited specification the odd one out — atomic and compound segments already receive their text raw.Splitting is now verbatim in both places it happens:
nsubstrings always derivenitems, numbered0..n-1, surrounding whitespace intact and empty substrings included."a, b"yields"a"and" b";"a,,b"yields three items.Motive: the
explodestratum of ATBench (Auto-Tables, VLDB 2023) inregtab-eval-on-atbenchhas ground truth produced bypandas str.split(','), which keeps token whitespace and empty strings. Forced trimming made ~41 of 48 cases inexpressible.Trimming is now opt-in via the atom's string extractor:
Tasks 45 and 55 relied on the implicit trimming and were fixed that way, in both the RTL and the ATP suite. Their expected recordsets are unchanged — no fixture under
tests/fixtures/was touched.RTL syntax, the grammar and ATP→RTL serialization are untouched. Canonical forms changed only for
task_045/task_055, because of the added=TRIMin the patterns themselves.Not a two-line deletion
Unlike jRegTab, pyRegTab tracks a byte span per item.
split_with_spansnow reports the span of the raw token and the leading-whitespace offset is gone. Item indices also become contiguous on the standalone delimited path, which is observable throughPOSfilters (FilterTerm::PosExact/PosOffset/PosRange).The whole behavioural change is one helper — both call sites go through it.
Corpus
Re-pinned to jRegTab v0.5.0 (
035ff1a) and synced byte-for-byte (all 333 files verified against upstream; raw CRLF payload intask_099and tabs intask_101intact, no whitespace drift in the other 300):delim_rawconformance/semantic/section — item 5 of the contracttests/test_semantic_conformance.pyexecutes that section (port ofRtlSemanticConformanceTest). Note its defaults differ from the task suite:expected.csvis header-less and matched positionally against the schema the pattern produced, so implementation-invented attribute names stay out of the contract —task_runner.load_match_optionsmust not be reused there.Tests
src/matcher.rsgains a#[cfg(test)]module (the matcher had none): whitespace retention, empty tokens, edge empty tokens, contiguous indices, span arithmetic under a non-zerobase, byte-exactness on multibyte text, and the=TRIMopt-in — plus end-to-end cases throughmatch_atp.Checked to be discriminating: with the old trimming temporarily restored, all 10 new tests fail and the 4 pre-existing ones stay green.
Differential run against jRegTab v0.5.0, executed locally: 750/750 variants identical.
Release 0.5.0
Version bumped in
Cargo.toml,Cargo.lock,pyproject.tomland__init__.py;grammar/UPSTREAMre-pinned to v0.5.0 (RTL.g4byte-identical, sha256 unchanged); the manualdifferentialCI job now buildsjregtab@v0.5.0; README/docs parity statements updated to 0.5.0 ≙ jRegTab 0.5.0.Tagging
v0.5.0after merge triggers the wheel build and PyPI publish.Plan document:
plans/S_DELIM_RAW_SPLIT.md.🤖 Generated with Claude Code