Skip to content

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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bool struct member parsing not working

2 participants