Skip to content

regen/regcharclass.pl: add 'bool' support#24356

Open
chansen wants to merge 1 commit intoPerl:bleadfrom
chansen:bool-option-regcharclass
Open

regen/regcharclass.pl: add 'bool' support#24356
chansen wants to merge 1 commit intoPerl:bleadfrom
chansen:bool-option-regcharclass

Conversation

@chansen
Copy link
Copy Markdown
Contributor

@chansen chansen commented Apr 9, 2026

Add a new 'bool' return type for generated macros. Unlike the default 'len' return type which returns the byte length of the match, 'bool' macros return a simple true/false result, which can produce simpler generated code when the match length is not needed.

The 'bool' type can be requested by appending '-bool' to a type specifier in the DATA section (e.g. 'UTF8-bool').

The 'is_' prefix is retained for bool macros, making it more accurate than for 'len' macros which also use it.

Add a new 'bool' return type for generated macros. Unlike the default
'len' return type which returns the byte length of the match, 'bool'
macros return a simple true/false result, which can produce simpler
generated code when the match length is not needed.

The 'bool' type can be requested by appending '-bool' to a type
specifier in the __DATA__ section (e.g. 'UTF8-bool'), or by passing
ret_type => 'bool' to make_macro() directly.

The 'is_' prefix is retained for bool macros, making it more accurate
than for 'len' macros which also use it.
@chansen chansen force-pushed the bool-option-regcharclass branch from ec3bc26 to aa51f67 Compare April 9, 2026 22:46
@jkeenan jkeenan added the defer-next-dev This PR should not be merged yet, but await the next development cycle label Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

defer-next-dev This PR should not be merged yet, but await the next development cycle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants