Skip to content

Fix: c_parser ignored scopes with nameless inline struct#17

Merged
andreax79 merged 1 commit into
andreax79:mainfrom
tyalie:fix-nameless-struct-parsing
Oct 31, 2022
Merged

Fix: c_parser ignored scopes with nameless inline struct#17
andreax79 merged 1 commit into
andreax79:mainfrom
tyalie:fix-nameless-struct-parsing

Conversation

@tyalie

@tyalie tyalie commented Oct 31, 2022

Copy link
Copy Markdown
Contributor

The parse_type function would continue looking for tokens to complete its type even when the last token was a { and a new scope was created. This would mean that the following resulted in an exception as the read c_type was struct { int instead of simply struct {

__struct__ = """
  struct {
    int i;
  } s;
"""

This merge fixes that issue by ignoring all following tokens in parse_type if the last one opened a new scope.

Signed-off-by: Sophie Tyalie dev@flowerpot.me

The `parse_type` would continue looking for tokens even when the c_type
ended with a `{`. This would mean that the following resulted in an
exception:

```
__struct__ = """
  struct {
    int i;
  } s;
"""
```

`parse_type` now ignores any following tokens if `c_type` ends with an
`{` - meaning the tokens afterwards are not element of the current type
scope.

Signed-off-by: Sophie Tyalie <dev@flowerpot.me>
@andreax79 andreax79 merged commit c5cf01a into andreax79:main Oct 31, 2022
@andreax79

Copy link
Copy Markdown
Owner

Merged, thanks

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