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

Fixes to CParser #51

Merged
merged 3 commits into from
Jul 10, 2018
Merged

Fixes to CParser #51

merged 3 commits into from
Jul 10, 2018

Conversation

markuspf
Copy link
Member

@markuspf markuspf commented Jul 9, 2018

This PR

  • Refactors compound_statement by pulling a large inline function out of the rule
  • Allows aggregate expressions to be empty. This enables code like int sz = size((int []){ }); to be parsed
  • support positional array initialisation, i.e.
int stuff[] = { [3] = 7 };

The changes come in three commits. I could open 3 separate PRs, if this is requested.

@markuspf
Copy link
Member Author

markuspf commented Jul 9, 2018

Makes the tests in gap-system/gap#2628 pass.

I can't say that I understand ward enough yet to say whether these patches are correct.

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

I really have no idea how that code works, and would rather not try to understand it. On a quick cursory examination, it all seems sane. Since you dug into it, and it works for you, that's enough for me.

But of course it'd be great if @rbehrends could have a look, too.

ward/cparser.lua Outdated
@@ -546,6 +546,38 @@ local function build_for_stmt(init, cond, step, body)
return init_node, exit_node
end

local function build_compount_stmt_local_variables(str, pos, declarations)
Copy link
Member

Choose a reason for hiding this comment

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

compount -> compound

@markuspf
Copy link
Member Author

markuspf commented Jul 9, 2018

Thanks, that was a rather embarrassing typo.

Copy link
Contributor

@rbehrends rbehrends 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 and also seems to work.

@rbehrends rbehrends merged commit 242182f into gap-system:master Jul 10, 2018
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.

3 participants