fix: preserve exact text for unquoted string values#62
Merged
shreyasbhat0 merged 3 commits intomainfrom Mar 30, 2026
Merged
Conversation
The scanner was eagerly tokenizing values (breaking on spaces, parsing numbers) instead of treating them as complete text before type inference, as the spec requires (§B.3, §B.4, §B.5). This caused three bugs: - #59: multiple spaces collapsed (`a b` → `a b`) - #60: mixed-type tokens errored (`1 null`, `a 1` in tabular rows) - #61: number formatting lost (`1.0 b` → `1 b`, `1e1 b` → `10 b`) Scanner changes: - Track `last_whitespace_count` and `last_token_text` through scanning - `read_rest_of_line_with_space_info()` returns exact space count - Add `read_until_delimiter_with_space_info()` for tabular cells Parser changes: - `parse_field_value()`: use original token text and exact space count - `parse_tabular_field_value()`: read complete cell text then type-infer - `parse_value_with_depth()`: handle all value token types in root-level concatenation with exact spacing Fixes #59, #60, #61
This was referenced Mar 30, 2026
Replace loop+match with while-let patterns and remove unnecessary let binding in scan_token.
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.
Summary
last_token_text) and exact whitespace counts (last_whitespace_count) during tokenizationparse_tabular_field_value()to read complete cell text before type inference, per spec §B.3/§B.4parse_field_value()andparse_value_with_depth()to use original token text and exact spacingThis aligns the parser with the spec's approach: get complete value text first, then type-infer — rather than eagerly tokenizing then reassembling.
Bugs Fixed
a b→a b)1 null,a 1in tabular rows)1.0 b→1 b,1e1 b→10 b)Test plan