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

Add support for "discard" keyword #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

greenerfield
Copy link
Contributor

Fixes #22. Note I haven't regenerated src/parser.c here since that might introduce conflicts with #33 and #34 :) Thanks again!

@@ -17,6 +17,20 @@ module.exports = grammar(C, {
...original.members.filter((member) => member.content?.name != '_old_style_function_definition'),
),

_top_level_statement: (_, original) => choice(
Copy link
Member

@theHamsta theHamsta Sep 23, 2023

Choose a reason for hiding this comment

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

yeah, this was the exact problem that got a similar change failing in HLSL. Should we really allow discard as a top-level statement? It actually only makes sense within a shader. This was one of the reasons why I didn't integrate the change myself.

What's your opinion on this? Should discard be allowed top-level for improved testing and error-recovery or only within shader functions?


================================================================================
Discard
================================================================================
Copy link
Member

Choose a reason for hiding this comment

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

You need to run tree-sitter test -u because there seems to be another test using discard, currently parsed as an expression_statement.

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.

Add support for discard command?
2 participants