Skip to content

Create parser without defining %union - #654

Merged
ydah merged 1 commit into
ruby:masterfrom
ydah:can-remove-%%-union
Sep 1, 2025
Merged

ydah merged 1 commit into
ruby:masterfrom
ydah:can-remove-%%-union

Conversation

@ydah

@ydah ydah commented Mar 18, 2025 •

Copy link
Copy Markdown
Member

Fixes: #480

If %union is not defined, Integer is used by default.

/* Value type.  */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif

@ydah ydah changed the title Refactor grammar rules to make the epilogue declaration optional in the parser input Grammar rules to make the epilogue declaration optional in the parser input Mar 18, 2025
@ydah
ydah force-pushed the can-remove-%%-union branch from f6dab85 to f109739 Compare March 18, 2025 14:49
@yui-knk

yui-knk commented Mar 20, 2025

Copy link
Copy Markdown
Collaborator

Do we need to take care of "template/bison/_yacc.h" if union is nullable?

@ydah
ydah marked this pull request as draft August 28, 2025 09:32
@ydah
ydah marked this pull request as ready for review August 28, 2025 15:20
@ydah
ydah force-pushed the can-remove-%%-union branch from f109739 to 9406bde Compare August 30, 2025 14:47
@ydah
ydah requested a review from yui-knk August 30, 2025 14:48
@ydah

ydah commented Aug 30, 2025

Copy link
Copy Markdown
Member Author

Do we need to take care of "template/bison/_yacc.h" if union is nullable?

I tried to take care of it. How about this?

Comment thread parser.y Outdated
Comment thread parser.y Outdated
@ydah ydah changed the title Grammar rules to make the epilogue declaration optional in the parser input Create parser without defining %union Aug 31, 2025
@yui-knk

yui-knk commented Sep 1, 2025

Copy link
Copy Markdown
Collaborator

Could you squash the commits into one?

@ydah ydah changed the title Create parser without defining %union Create parser without defining %union Sep 1, 2025
Fixes: ruby#480

If %union is not defined, Integer is used by default.

```c
/* Value type.  */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
```
@ydah
ydah force-pushed the can-remove-%%-union branch from 0edaf79 to 92de868 Compare September 1, 2025 02:06
@ydah

ydah commented Sep 1, 2025 •

Copy link
Copy Markdown
Member Author

Could you squash the commits into one?

I squash these commits!

@ydah
ydah merged commit 57af1ee into ruby:master Sep 1, 2025
22 checks passed
@ydah
ydah deleted the can-remove-%%-union branch September 1, 2025 02:25
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.

Create parser without defining %union

2 participants