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

Adding export visitPreprocessedAst & Fixing preprocess defined without paren bug #22

Merged
merged 4 commits into from
May 11, 2024

Conversation

06wj
Copy link
Contributor

@06wj 06wj commented May 6, 2024

No description provided.

@AndrewRayCode
Copy link
Collaborator

AndrewRayCode commented May 11, 2024

Thanks for this! I'm surprised missing the defined MACRO condition without parens went unnoticed for so long.

I'm going to refactor this slightly, the GLSL grammar has a terminal production used for this very case of ensuring a word boundary between a token and the next text.

What is your use case for visiting the preprocess-parsed AST? That function is a little annoying because I didn't figure out type it properly, hence the @ts-ignore over the line. I don't see harm in exposing it, but it's not battle tested with the type override.

@AndrewRayCode AndrewRayCode merged commit f9813f7 into ShaderFrog:main May 11, 2024
1 check passed
@AndrewRayCode
Copy link
Collaborator

Published in 3.2.0

@06wj
Copy link
Contributor Author

06wj commented May 11, 2024

I used it for preprocess my shader code.
My shader controls the shader logic on different platforms through defines.

#ifdef IN_WEB
web logic...
#else
native logic...
#endif

I want preprocess it so that it contain only the logic for a specific platform.

https://github.com/06wj/glsl-parser/blob/81524e31859bdc19e434c97c9109451db0e3ab70/src/preprocessor/preprocessor.test.ts#L517

@06wj
Copy link
Contributor Author

06wj commented May 11, 2024

BabylonJS/Spector.js#295
I added preprocessing functionality to SpectorJS using this library.

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