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

Lex minus followed immediately by numeric literal as a single token #90

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

jlapeyre
Copy link
Collaborator

@jlapeyre jlapeyre commented Feb 1, 2024

Before this commit, a - preceeding a numeric literal was always lexed as a token apart.

Now lex the minus and the numeric literal as a single token. But only if there is no intervening whitespace. For example -1.23 is a single token. But - 1.123 is three tokens (including a token for the whitespace).

and

Qiskit/qiskit#11584 (comment)

Before this commit, a `-` preceeding a numeric literal was
always lexed as a token apart.

Now lex the minus and the numeric literal as a single token.
But only if there is no intervening whitespace. For example
`-1.23` is a single token. But `-  1.123` is three tokens
(including a token for the whitespace).
@jlapeyre jlapeyre merged commit 600afd5 into main Feb 1, 2024
7 checks passed
jlapeyre added a commit that referenced this pull request Feb 1, 2024
… token (#90)"

This reverts commit 600afd5.

The last commit caused expressions like `a-1.23` to be parsed as
`a` followed by `-1.23` rather than correctly as a binary expression.
@jlapeyre jlapeyre deleted the minus-float-literal branch February 2, 2024 05:48
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.

None yet

1 participant