Skip to content

Require child success when matching all input - #13

Open
OskarEichler wants to merge 1 commit into
floraison:masterfrom
OskarEichler:codex/reject-failed-empty-input
Open

Require child success when matching all input#13
OskarEichler wants to merge 1 commit into
floraison:masterfrom
OskarEichler:codex/reject-failed-empty-input

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

The all combinator currently checks only how much input the child consumed. A failed child with zero length is therefore accepted when the input is empty. Also require a successful child result.

Reproduction

module SingleX
  include Raabro
  def root(i); str(:root, i, "x"); end
  def rewrite_root(t); t.string; end
end
SingleX.parse("")

Before: returns "". After: returns nil, as the grammar requires x.

Checked valid "x", input-offset rollback and an intentionally empty-string grammar, which still succeeds.

Verification

  • Reviewed master baseline, each individual patch, and the combined installed-release branch: existing suite passes 94 tests / 169 assertions, zero failures.
  • Ruby 4.0.6 via rbenv, Probatio 1.6.2. No new or modified test files.
  • Focused temporary repros, Ruby syntax and gem packaging checks pass. Targeted Lint reports the same 13 pre-existing warnings on baseline and fixed source, with no new warnings.
  • Consumer branch is based on installed 1.5.0 rather than importing unrelated master changes.

No production operations. Other Ruby/platform combinations were not run locally; no full supported-platform claim. Current open/closed issue/PR searches found no overlapping fix.

Breaking changes

Intentional correctness change: grammars that cannot match empty input no longer report success for it. Grammars that explicitly match empty input are unchanged. Error-diagnostic formatting is handled by a separate patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant