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

Update c #213

Merged
merged 4 commits into from
Jul 18, 2023
Merged

Update c #213

merged 4 commits into from
Jul 18, 2023

Conversation

amaanq
Copy link
Member

@amaanq amaanq commented Jul 18, 2023

No description provided.

@amaanq amaanq force-pushed the update-c branch 2 times, most recently from ac7f325 to e7270fc Compare July 18, 2023 21:30
…logic to fail if the version bump is incorrect
@amaanq amaanq merged commit 8dc2b30 into tree-sitter:master Jul 18, 2023
4 checks passed
@jdrouhard
Copy link
Collaborator

Why did the parser grow significantly with this version bump?

@amaanq please tag me for reviews before merging anything here

Copy link
Collaborator

@jdrouhard jdrouhard left a comment

Choose a reason for hiding this comment

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

There are a lot of changes here I'm not sure should have been made. Please see my comments, and include me as a reviewer on future changes to this repo, thanks.

$.try_statement,
$.throw_statement,
),

Copy link
Collaborator

Choose a reason for hiding this comment

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

None of these are top level statements in c++

Copy link
Collaborator

Choose a reason for hiding this comment

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

@amaanq

... this is identical to _non_case_statement. I wonder, did you tweak the c grammar to add essentially the exact same thing I added this for awhile back?

What is _top_level_statement specifically describing in the c grammar?

Copy link
Member Author

@amaanq amaanq Jul 24, 2023

Choose a reason for hiding this comment

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

Hmm you're right, they are the same. I changed expression_statement for top_level_statements because binary expressions caused issues with a declaration like so:

TSLanguage *(*lang_parser)(void();

I just assumed top_level_statement was more or less the same as non_case_statement, seeing that there were coroutine statements in top level statements in tests

Should I remove try and throw then?

grammar.js Show resolved Hide resolved
grammar.js Show resolved Hide resolved
alias($.constructor_or_destructor_definition, $.function_definition),
alias($.operator_cast_definition, $.function_definition),
alias($.operator_cast_declaration, $.declaration),
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this for?

Copy link
Member Author

Choose a reason for hiding this comment

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

reworked top level items in C, this just adds certain bits missing to _block_item that _top_level_item had

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to consolidate all these various lists of "top level-like items? It seems like there's quite a bit of copy/paste and is likely one of the reasons for the pretty large increase in state count and parser size this commit introduced.

Copy link
Member Author

@amaanq amaanq Jul 24, 2023

Choose a reason for hiding this comment

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

Not exactly, because top level items and block items use different versions of expression statements to keep top level declarations less conflicting with binary expressions.
tree-sitter/tree-sitter-c#146

grammar.js Show resolved Hide resolved
grammar.js Show resolved Hide resolved
@amaanq
Copy link
Member Author

amaanq commented Jul 21, 2023

Why did the parser grow significantly with this version bump?

@amaanq please tag me for reviews before merging anything here

Sure, I just didn't want downstream too impacted by changing C quite a bit without having C++ adapted.

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