Skip to content

Update parser error messages for consistent style, tone#1549

Merged
WardBrian merged 4 commits intomasterfrom
parser-error-message-revamp
Sep 12, 2025
Merged

Update parser error messages for consistent style, tone#1549
WardBrian merged 4 commits intomasterfrom
parser-error-message-revamp

Conversation

@WardBrian
Copy link
Copy Markdown
Member

A few consistency edits:

  • Avoid using "we", prefer past tense "expected" to "expect"
  • End with a period
  • Always start with what we think went wrong

Also:

  • Fixed an incorrect example in the error message for the ternary operator
  • Reworked a few errors that were suggesting bad advice, usually when the input could be the start of an assignment
  • Tried to group related errors closer to each other in parser.messages

Submission Checklist

  • Run unit tests
  • Documentation
    • If a user-facing facing change was made, the documentation PR is here:
    • OR, no user-facing changes were made

Release notes

Improved the wording of syntax error messages.

Copyright and Licensing

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)

@WardBrian WardBrian requested a review from nhuurre September 12, 2025 16:06
Copy link
Copy Markdown
Collaborator

@nhuurre nhuurre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TLDR I mean LGTM

These messages are mostly like

Ill-formed compound assignment statement. Expected a ";" after the value being assigned.

but a few are like

Ill-formed declaration. ";" expected after variable declaration.

For more consistent style the latter could be

Ill-formed declaration. Expected ";" after variable declaration.

(but this might not be always better.)

@WardBrian WardBrian merged commit f3662bc into master Sep 12, 2025
3 checks passed
@WardBrian WardBrian deleted the parser-error-message-revamp branch September 12, 2025 18:28
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.

2 participants