Repository navigation
Formula entry: an incomplete formula's error describes what was typed (fixes #2030) - #2032
Merged
aiongg merged 2 commits intoOct 22, 2026
Merged
Conversation
…fixes storytold#2030) `=1+` reported "unexpected `)`", although no `)` was typed: entry closes missing parentheses by appending up to eight `)`, and when every retry failed it reported the last retry's error. It now reports the error of the formula as typed ("unexpected end of formula"). `gridcraft_formula::parse_closing_parens` holds the convenience and takes the parse function, so cell entry and the UI's Spanish formula path share it instead of each having its own loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <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.
Fixes #2030.
Entering an incomplete formula such as
=1+showed "There's a problem with this formula: unexpected)", although no)was typed. Entry closes missing parentheses by appending up to eight)and parsing again; when every retry failed, it reported the error of the last one. Now it reports the error of the formula as typed:=1+)=--)=SUM(1,+)=SUM(1,(2+3=SUM(1,(2+3)), 6Changes
gridcraft_formula::parse_closing_parens(src, parse)holds the convenience: parse as typed, then retry with up to eight)appended, and return the first error if no retry parses. It takes the parse function, so cell entry (input_to_cell, English syntax) and the UI's Spanish formula path (formula_locale::canonical,parse_input) share it instead of each having its own loop.Tests
missing_closing_parentheses_are_closed_and_errors_describe_the_typed_text(formula): closing still works (SUM(1,2,((1+2); for1+,--,SUM(1,+,1+*2and nine unclosed(the error equals the one for the typed text.an_incomplete_formula_is_refused_with_an_error_about_what_was_typed(engine):=1+and=SUM(1,+throughcell.set; fails onmainwith "unexpected)".cargo xtask cipasses locally (Fedora 44, x86_64).=1+and=SUMA(1;+report "unexpected end of formula";=SUMA(1;(2+3still enters=SUM(1,(2+3)).Notes
input_to_cellintoparse_typed_formula; whichever lands second needs a small merge (the new function can be called from there).input_to_cellandformula_locale::canonical; the two merge cleanly in either order, and the merged branches pass the core, formula, engine and UI tests.🤖 Generated with Claude Code
Summary by CodeRabbit