Repository navigation
v2 parse: a '-' that begins a line after an operand refuses (NewlineBeforeDualRoleOperator), as the seed refuses it (PR2a, stacked on #12773) - #12881
Merged
Conversation
…fuseOnMatch / AfterLineBreak grammar arms, controls Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… question is a lookup (review 73189) The gap question folded over the whole source per question: O(tokens x source). StreamLayout pairs the source with a line-break-before answer for every token, derived in one walk over source and tokens by its only constructor; a line feed inside a token is not layout. The digest reads the source through the layout. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…r (floor budget: 97k steps vs 72.3k) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… not -) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… those, not by every character (floor budget) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…221) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…rk (review 73234) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…at lexing); digest renamed to what it covers Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…d: emitted as host String) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…eceded token (review 73282) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…on (NewlineBeforeDualRoleOperator); controls, emit control, mutation witness Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…additive row is inlined, so arms > 1) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…t (no lookup per token; floor budget) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…-43-newline-refusal
…h returns (emit-build) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…-43-newline-refusal
…source); value = the octet the gap begins Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…-43-newline-refusal
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…only (floor new-witness budget) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…m producers (no per-claim preparation); move to the floor Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…licate of the controls; smaller block source (floor budget) Co-Authored-By: Claude Opus 5.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.
Stacked on #12773 (base: its branch). Discharges the trigger of the #12769 row, and is the production consumer of #12773's
RefuseOnMatch/AfterLineBreakarms and its stream layout.The defect, now on main
-is both infix (subtraction) and prefix (negation), and the dag grammar has no statement terminator. Soxfollowed by a line- 1is either one subtraction or two statements. The seed refuses it as ambiguous (v1.compiler.parseis_ambiguous_prefix_infix_newline_boundary, whose dual-role set is exactly-). v2 read it silently as one subtraction. Since #12817 made block forms operands ofbinary_expr, a block statement followed by a-line merges the same way: silent wrongness, below the floor.The change
v2.extdeps.languages.dagdag_grammar_additive_expr_helper: at every additive continuation, the first alternative isRefuseOnMatch { AfterLineBreak { - }, NewlineBeforeDualRoleOperator }.-preceded by a line break refuses the parse at the-, with a typed reason from the closedv2.std.parse_refusal_reasonvocabulary (new variantNewlineBeforeDualRoleOperator).-falls through to subtraction.Controls (
v2.test.parse.newline_dual_role_operator_parse), green on a remote runx⏎- 1refuses withNewlineBeforeDualRoleOperatorat the-(bytes 51..52).match w {..}⏎- nrefuses at the-(bytes 101..102).x - 1on one line parses and normalizes.RefuseOnMatchderives no tree, and emit reads formal productions). What emit must guarantee is that it never writes what ingest refuses. Emitted text breaks a line only where a token class's emit transform isEmitLineBreaks, and no dag token class has one, so the dag emitter can never write a line-break-preceded-.no_dag_token_class_emits_a_line_break_holdsreds the moment a dag class gains a line-breaking transform.Mutation (
test.claim.long.newline_dual_role_operator_mutation_witness_test), greenRefuseOnMatcharm replaced by a never-matching terminal.Census
Over the 190 corpus files with a block-headed operand site, run with
v2.compiler.parse_acceptance_census: 0 refuse withNewlineBeforeDualRoleOperator. A static scan finds no block-headed statement followed by a-line indag/orsrc/v2. So nothing in the tree changes meaning; the construct becomes unwritable from here on.Rung
The #12769 class goes from silent wrongness to structurally guaranteed: no
Acceptedprogram contains a line-break-preceded dual-role-at an operand boundary.🤖 Generated with Claude Code