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

Fix parsing of 4. in Expression #93856

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

timothyqiu
Copy link
Member

@timothyqiu timothyqiu commented Jul 2, 2024

Fixes #92895

Expression has a bug handling numbers at the end of an expression. It always puts the last character back in the stream.

Unlike other unexpected characters, reading an end-of-string does not move the cursor, so we should not move the cursor back in this case.

For example 1e5 should produce two tokens CONSTANT(10000) and EOF, but it's actually three tokens CONSTANT(10000), CONSTANT(5) and EOF. A standalone 4. is similar, it was parsed into CONSTANT(4.0), PERIOD, and EOF. This sequence is invalid, thus the error.

@timothyqiu timothyqiu added this to the 4.3 milestone Jul 2, 2024
@timothyqiu timothyqiu requested review from a team as code owners July 2, 2024 09:27
@timothyqiu timothyqiu marked this pull request as draft July 2, 2024 09:35
@timothyqiu timothyqiu force-pushed the expression-period branch from 39fbf6b to ee9cea5 Compare July 2, 2024 12:54
@timothyqiu timothyqiu marked this pull request as ready for review July 2, 2024 13:15
@timothyqiu timothyqiu modified the milestones: 4.3, 4.4 Jul 22, 2024
@timothyqiu timothyqiu added the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Sep 4, 2024
Copy link
Member

@lawnjelly lawnjelly left a comment

Choose a reason for hiding this comment

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

Looks good to me from quick check.

@akien-mga akien-mga merged commit d1caac5 into godotengine:master Sep 11, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

@timothyqiu timothyqiu deleted the expression-period branch September 11, 2024 11:53
@akien-mga
Copy link
Member

Cherry-picked for 4.3.1.

@akien-mga akien-mga removed the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting frame duration to 1. does not automatically resolve to 1.0 (SpinBox/Expression bug)
3 participants