Skip to content

add regex for bool parsing & test struct w/ bool parsing - #169

Merged
kou merged 2 commits into
ruby:masterfrom
wallacerunner:fix-bool-struct-member-parsing
Jan 10, 2025
Merged

add regex for bool parsing & test struct w/ bool parsing#169
kou merged 2 commits into
ruby:masterfrom
wallacerunner:fix-bool-struct-member-parsing

Conversation

@wallacerunner

@wallacerunnerwallacerunner commented Jan 6, 2025

Copy link
Copy Markdown
Contributor

GitHub: fixGH-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".

kou
kou approved these changes Jan 6, 2025

@koukou left a comment

Copy link
Copy Markdown
Member

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.

Comment threadtest/fiddle/test_cparser.rb Outdated
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@wallacerunner

Copy link
Copy Markdown
ContributorAuthor

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

kou commented Jan 10, 2025

Copy link
Copy Markdown
Member

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

@kou
kou merged commit 7160744 into ruby:masterJan 10, 2025
hsbt pushed a commit to hsbt/ruby that referenced this pull request Jan 14, 2025
parsing
(ruby/fiddle#169)
GitHub: fixruby/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: fixruby/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: fixruby/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 freeto 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

@wallacerunner@kou