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 preprocessor parenthesis expression parse #2236

Merged
merged 9 commits into from
Jul 17, 2024
2 changes: 1 addition & 1 deletion packages/shader-lab/src/preprocessor/PpParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export default class PpParser {
if (scanner.getCurChar() === "(") {
scanner.advance();
scanner.skipSpace(false);
const ret = this._parseConstant(scanner);
const ret = this._parseConstantExpression(scanner);
Copy link

Choose a reason for hiding this comment

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

Change from _parseConstant to _parseConstantExpression is appropriate for enhanced expression parsing.

The modification to use _parseConstantExpression instead of _parseConstant when parsing expressions within parenthesis is a logical enhancement. This change likely allows for more complex expressions to be correctly parsed, aligning with the intended improvements in the PR.

However, it is crucial to ensure that this change is thoroughly tested, especially since it affects the core functionality of the shader preprocessor.

Would you like me to help generate unit tests or update the documentation to reflect this change?

scanner.scanToChar(")");
scanner.advance();
return ret;
Expand Down
Loading