Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of atoms should ignore whitespace #6011

Closed
david-christiansen opened this issue Nov 8, 2024 · 0 comments · Fixed by #6012
Closed

Validation of atoms should ignore whitespace #6011

david-christiansen opened this issue Nov 8, 2024 · 0 comments · Fixed by #6012
Labels
bug Something isn't working

Comments

@david-christiansen
Copy link
Contributor

Description

New atoms introduced by syntax and its derived commands are not allowed to begin with digits or single or double quotes, nor may their first two characters be a valid prefix of an escaped name. They may also not be empty.

We surround atoms with spaces to indicate pretty-printing, but the atom validation routine does not ignore these spaces.

Context

This came up while documenting the specific rules for infix operators in the reference manual.

Steps to Reproduce

  1. Enter the following code: infix:40 "9" => Nat.add
  2. Observe the error message invalid atom
  3. Add a space: infix:40 " 9" => Nat.add
  4. The error message disappears

Expected behavior:

The error messages should be identical. An invalid atom doesn't become valid because it should be printed with spaces.

Actual behavior:

The declaration is accepted.

Versions

From live.lean-lang.org: "4.15.0-nightly-2024-11-08"

Additional Information

Link to code

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@david-christiansen david-christiansen added the bug Something isn't working label Nov 8, 2024
david-christiansen added a commit to david-christiansen/lean4 that referenced this issue Nov 8, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 14, 2024
This PR improves the validation of new syntactic tokens. Previously, the
validation code had inconsistencies: some atoms would be accepted only
if they had a leading space as a pretty printer hint. Additionally,
atoms with internal whitespace are no longer allowed.

Closes #6011
JovanGerb pushed a commit to JovanGerb/lean4 that referenced this issue Jan 21, 2025
…r#6012)

This PR improves the validation of new syntactic tokens. Previously, the
validation code had inconsistencies: some atoms would be accepted only
if they had a leading space as a pretty printer hint. Additionally,
atoms with internal whitespace are no longer allowed.

Closes leanprover#6011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant