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 regex for bool parsing & test struct w/ bool parsing #169

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

wallacerunner
Copy link
Contributor

@wallacerunner wallacerunner commented Jan 6, 2025

GitHub: fix GH-168

Struct parsing invokes "parse_ctype" on the whole member signature, which fails if member type is "bool" due to plain string matching for it. This change updates "bool" type matching to a regexp, so TYPE_BOOL is correctly parsed for a whole signature like "bool toggle" as well as just "bool".

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

Could you explain what is the problem and how to solve it in the PR description?
We'll use the PR description for commit message.

test/fiddle/test_cparser.rb Outdated Show resolved Hide resolved
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@wallacerunner
Copy link
Contributor Author

Now that I gave it some thought, shouldn't this be the other way around? I.e. isn't parse_struct supposed to invoke parse_ctype on just the type definition, and not parse_ctype running regexp on given string?
Still, I did not look into it deeply, and this PR seems like a much easier solution.

@kou
Copy link
Member

kou commented Jan 10, 2025

We can revisit it as a separated task.
Could you open a new issue for it?

@kou kou merged commit 7160744 into ruby:master Jan 10, 2025
51 checks passed
hsbt pushed a commit to hsbt/ruby that referenced this pull request Jan 14, 2025
parsing
(ruby/fiddle#169)

GitHub: fix ruby/fiddle#168

Struct parsing invokes "parse_ctype" on the whole member signature,
which fails if member type is "bool" due to plain string matching for
it. This change updates "bool" type matching to a regexp, so TYPE_BOOL
is correctly parsed for a whole signature like "bool toggle" as well as
just "bool".

---------

ruby/fiddle@71607446d4

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
hsbt pushed a commit to hsbt/ruby that referenced this pull request Jan 14, 2025
parsing
(ruby/fiddle#169)

GitHub: fix ruby/fiddle#168

Struct parsing invokes "parse_ctype" on the whole member signature,
which fails if member type is "bool" due to plain string matching for
it. This change updates "bool" type matching to a regexp, so TYPE_BOOL
is correctly parsed for a whole signature like "bool toggle" as well as
just "bool".

---------

ruby/fiddle@71607446d4

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
hsbt pushed a commit to ruby/ruby that referenced this pull request Jan 14, 2025
parsing
(ruby/fiddle#169)

GitHub: fix ruby/fiddle#168

Struct parsing invokes "parse_ctype" on the whole member signature,
which fails if member type is "bool" due to plain string matching for
it. This change updates "bool" type matching to a regexp, so TYPE_BOOL
is correctly parsed for a whole signature like "bool toggle" as well as
just "bool".

---------

ruby/fiddle@71607446d4

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

bool struct member parsing not working
2 participants