Skip to content

ParseXS: build an AST for each XSUB #23225

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

Merged
merged 156 commits into from
Jul 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
75a0e54
ParseXS: bump version 3.57 => 3.58
iabyn Mar 3, 2025
539712e
ParseXS: refactor: add file/line_no fields to Node
iabyn Mar 5, 2025
2e0a01d
ParseXS: refactor: add multiline,code,PREINIT node
iabyn Mar 3, 2025
7b75783
ParseXS: refactor: add C_ARGS,IF,IF_MACRO nodes
iabyn Mar 5, 2025
620bd2f
ParseXS: refactor: Node.pm: add class helper fn
iabyn Mar 6, 2025
be46863
ParseXS: refactor: rename code Node to codeblock
iabyn Mar 7, 2025
aa0d731
ParseXS: match EN/DISABLE keyword more strictly
iabyn Mar 6, 2025
6d42873
ParseXS: refactor: don't pass $_ to/from parse()
iabyn Mar 7, 2025
ad1a051
ParseXS: fix SCOPE keyword and update docs
iabyn Mar 9, 2025
a14f63e
ParseXS: refactor: add classes for ENABLE keywords
iabyn Mar 9, 2025
dec364d
ParseXS: refactor: add PROTOTYPE node
iabyn Mar 11, 2025
86f5662
ParseXS: refactor: use __PACKAGE__ to simplify
iabyn Mar 11, 2025
4010348
ParseXS: fix test infrastructure under 5.8.x
iabyn Mar 11, 2025
bcc9ef8
ParseXS: refactor: reindent Param::as_output_code
iabyn Mar 11, 2025
218f29d
ParseXS: refactor: add ALIAS,ALIAS_line nodes
iabyn Mar 13, 2025
e28e5ae
ParseXS: improve error test coverage for Node.pm
iabyn Mar 14, 2025
85516d9
ParseXS: refactor: add ATTRS node
iabyn Mar 14, 2025
30b0145
ParseXS: refactor: add OVERLOAD node
iabyn Mar 14, 2025
fc2dda0
ParseXS: refactor: INPUT_handler() use $line vs $_
iabyn Mar 15, 2025
8784182
ParseXS: refactor: INPUT_handler() split into two
iabyn Mar 15, 2025
a964679
ParseXS: refactor: INPUT_handler() move to Node.pm
iabyn Mar 15, 2025
aeff664
ParseXS: refactor: INPUT_handler() reindent.
iabyn Mar 15, 2025
e58b4a5
ParseXS: refactor: add INPUT, INPUT_line nodes
iabyn Mar 15, 2025
5047469
ParseXS: refactor: INPUT_line::parse(): remove var
iabyn Mar 17, 2025
b0fa5e3
ParseXS: refactor: add Node::INPUT_line fields
iabyn Mar 17, 2025
26909c1
ParseXS: refactor: move Param field decl
iabyn Mar 17, 2025
bf53b82
ParseXS: refactor: add Node::Param::set_proto meth
iabyn Mar 17, 2025
4617176
ParseXS: add tests for NOT_IMPLEMENTED_YET
iabyn Mar 17, 2025
b22968a
ParseXS: process NOT_IMPLEMENTED_YET later
iabyn Mar 17, 2025
f684290
ParseXS: reindent after previous commit
iabyn Mar 17, 2025
45e8838
ParseXS: refactor: minor tweaks on main loop
iabyn Mar 17, 2025
5b2f3e5
ParseXS: refactor: move input parsing into a sub
iabyn Mar 17, 2025
2aed8f1
ParseXS: refactor: reindent block of code
iabyn Mar 17, 2025
aeffad6
ParseXS: refactor: add input_part node
iabyn Mar 18, 2025
ddb8667
ParseXS: refactor: add input_part->as_code()
iabyn Mar 19, 2025
5a8b3ca
ParseXS: refactor: mark INPUT node as implicit
iabyn Mar 19, 2025
bc303ac
ParseXS: refactor: avoid autovivifying kids
iabyn Mar 19, 2025
8c45a6b
ParseXS: refactor: make parse() meths return bool
iabyn Mar 19, 2025
3607187
ParseXS: refactor: add parse_keywords() method
iabyn Mar 19, 2025
b68b930
ParseXS: refactor: add init_part, INIT nodes
iabyn Mar 19, 2025
7e3d649
ParseXS: refactor: add PPCODE node and tests
iabyn Mar 20, 2025
41c5d82
ParseXS: refactor: add CODE node
iabyn Mar 20, 2025
d050d3f
ParseXS: refactor: add code_part, NIY nodes
iabyn Mar 20, 2025
1c5e122
ParseXS: refactor: add autocall node
iabyn Mar 20, 2025
3ca4844
ParseXS: refactor: put code_part next to init_part
iabyn Mar 20, 2025
4841c28
ParseXS: refactor: add POSTCALL node
iabyn Mar 21, 2025
3658205
ParseXS: refactor: add CLEANUP node
iabyn Mar 21, 2025
acb827a
ParseXS: refactor: OUTPUT_handler() use $line vs $_
iabyn Mar 21, 2025
6f72655
ParseXS: refactor: OUTPUT_handler() split into two
iabyn Mar 21, 2025
97fd767
ParseXS: refactor: OUTPUT_handler(): mv to Node.pm
iabyn Mar 21, 2025
927f43a
ParseXS: refactor: OUTPUT_handler() reindent.
iabyn Mar 21, 2025
934abfb
ParseXS: refactor: add OUTPUT, OUTPUT_line nodes
iabyn Mar 21, 2025
ff1886d
ParseXS: refactor: add Node::OUTPUT_line fields
iabyn Mar 21, 2025
457f886
ParseXS: refactor: alter Node:OUTPUT_line RETVAL
iabyn Mar 21, 2025
cce143e
ParseXS: refactor: add two xsub_foo fields
iabyn Mar 21, 2025
3cd9575
ParseXS: refactor: move output parsing into a sub
iabyn Mar 21, 2025
b4cc232
ParseXS: refactor: reindent block of code
iabyn Mar 21, 2025
044ef78
ParseXS: refactor: remove redundant braces
iabyn Mar 21, 2025
00db417
ParseXS: refactor: add output_part node
iabyn Mar 21, 2025
6e9bd6a
ParseXS: refactor: add cleanup_part node
iabyn Mar 21, 2025
eb65eb7
ParseXS: refactor: mv xsub_implicit_OUTPUT_RETVAL
iabyn Mar 21, 2025
8fd2c45
ParseXS: refactor: add xbody node
iabyn Mar 23, 2025
4075116
ParseXS: refactor: move some code emitting
iabyn Mar 23, 2025
51097b8
ParseXS: refactor: tidy some C-code-emitting code
iabyn Mar 24, 2025
d3e1d56
ParseXS: add CASE tests, tweak err msgs
iabyn Mar 24, 2025
a813c2a
ParseXS: refactor: add ReturnType node
iabyn Mar 24, 2025
e256ad9
ParseXS: refactor: rename Node::Sig Node::Params
iabyn Mar 24, 2025
b942a74
ParseXS: refactor: rename Params->{sig_text} field
iabyn Mar 24, 2025
fe4f332
ParseXS: refactor: prepare sig parsing code for mv
iabyn Mar 25, 2025
c21eba3
ParseXS: refactor: move sig-parsing code
iabyn Mar 25, 2025
bd13b83
ParseXS: refactor: add xsub_decl Node
iabyn Mar 25, 2025
27c9b91
ParseXS: refactor: reindent xsub_decl::parse()
iabyn Mar 25, 2025
e3f0f13
ParseXS: refactor: remove redundant block
iabyn Mar 25, 2025
f0ae383
ParseXS: refactor: add fields to xsub_decl Node
iabyn Mar 25, 2025
e64f8ab
ParseXS: refactor: move some xsub_decl init stuff
iabyn Mar 25, 2025
681a31c
ParseXS: add tests for XSUB declaration errs
iabyn Mar 25, 2025
07d2d98
ParseXS: refactor: delete whitespace lines Node.pm
iabyn Mar 25, 2025
65a9a0b
ParseXS: refactor; fix a couple of comments
iabyn Mar 25, 2025
bbe4307
ParseXS: refactor: prepare for xsub parsing move
iabyn Mar 25, 2025
2565535
ParseXS: refactor: move xsub parse code to Node.pm
iabyn Mar 25, 2025
6161527
ParseXS: refactor: add xsub Node class
iabyn Mar 25, 2025
9138499
ParseXS: refactor: reindent sub
iabyn Mar 25, 2025
8d958f0
ParseXS: refactor: add boot_code() in Node::xsub
iabyn Mar 25, 2025
92e62c3
ParseXS: refactor: boot_code(): remove block
iabyn Mar 25, 2025
64bb5c5
ParseXS: refactor: make :boot_code() return val
iabyn Mar 25, 2025
d9b6bb2
ParseXS: refactor: add decl field to Node::xsub
iabyn Mar 25, 2025
99104f3
ParseXS: add another CASE test
iabyn Mar 26, 2025
ab0eab9
ParseXS: refactor: add CASE node type
iabyn Mar 26, 2025
bc069d8
ParseXS: refactor: some tweaks to Node::xsub
iabyn Mar 27, 2025
5531358
ParseXS: refactor: add per-xbody Params objects
iabyn Mar 28, 2025
1c9bc77
ParseXS: add warning about varying prototype chars
iabyn Apr 3, 2025
910b2f2
ParseXS: refactor: ensure C_ARGS per CASE
iabyn Mar 31, 2025
88b3d99
ParseXS: refactor: pass xbody to foo_part::as_code
iabyn Apr 4, 2025
288e01c
ParseXS: refactor: avoid xsub_params in _part code
iabyn Apr 4, 2025
9208d94
ParseXS: give error on unmatched length(foo)
iabyn Apr 5, 2025
cca682c
ParseXS: refactor: add cur_xbody, rm xsub_params
iabyn Apr 5, 2025
a94e302
ParseXS: refactor: split xsub parse() method
iabyn Apr 9, 2025
6a03ec9
ParseXS: refactor: pass xsub obj to as_code meths
iabyn Apr 10, 2025
93f966c
ParseXS: refactor: rm xsub_targ_declared_early
iabyn Apr 10, 2025
a5414f6
ParseXS: refactor: remove xsub_targ_used
iabyn Apr 10, 2025
1f57c59
ParseXS: refactor: tidy up some code comments
iabyn Apr 11, 2025
92d5280
ParseXS: refactor: re-add SCOPE dup err message
iabyn Apr 11, 2025
d199aec
ParseXS: refactor: remove xsub_seen_ALIAS
iabyn Apr 11, 2025
4aa948d
ParseXS: refactor: remove various xsub_seen_FOO
iabyn Apr 11, 2025
f6d84f2
ParseXS: refactor: remove xsub_seen_RETVAL_in_CODE
iabyn Apr 11, 2025
dbe10d2
ParseXS: rm xsub_FOO's for return and fix CASE
iabyn Apr 12, 2025
7a8b60e
ParseXS: cosmetic: change SCOPE indent
iabyn Apr 12, 2025
817c7a5
ParseXS: refactor: use $open/close_brace more
iabyn Apr 12, 2025
8da1856
ParseXS: refactor: rm return-type xsub_foo fields
iabyn Apr 12, 2025
8b6eea6
ParseXS: refactor: add seen_an_XSUB EU::PXS field
iabyn Apr 12, 2025
8627c43
ParseXS: refactor: rm fn name/class xsub_FOO's
iabyn Apr 12, 2025
d663961
ParseXS: refactor: rm xsub_implicit_OUTPUT_RETVAL
iabyn Apr 13, 2025
f775bec
ParseXS: fix alias/attr cv, add need_boot_cv field
iabyn Apr 13, 2025
7559ea2
ParseXS: refactor: rm various xsub_*alias* fields
iabyn Apr 14, 2025
8dec29e
ParseXS: refactor: rm xsub_map_interface_foo field
iabyn Apr 14, 2025
b25f1d3
ParseXS: refactor: rm xsub_attributes field
iabyn Apr 14, 2025
bb670b1
ParseXS: tweak some code comments and indents
iabyn Apr 14, 2025
c07b5e5
ParseXS: make OUTPUT: SETMAGIC per-CASE
iabyn Apr 14, 2025
1be2f76
ParseXS: refactor: rm xsub_deferred_code_lines
iabyn Apr 14, 2025
0f55cf9
ParseXS: refactor: reduce scope of targ_used field
iabyn Apr 15, 2025
194bb98
ParseXS: refactor: rm xsub_stack_was_reset field
iabyn Apr 15, 2025
7ca700f
ParseXS: refactor: rm xsub_interface_macro fields
iabyn Apr 15, 2025
ddf9e90
ParseXS: refactor: remove misc xsub_foo fields
iabyn Apr 16, 2025
5a137aa
ParseXS: refactor: sort out SCOPE object fields
iabyn Apr 16, 2025
8a6fade
ParseXS: refactor: avoid cur_xsub/xbody in as_code
iabyn Apr 16, 2025
80141c2
ParseXS: refactor: undef cur_xsub/xbody after use
iabyn Apr 16, 2025
6e5771d
ParseXS: refactor: remove cur_xsub/xbody fields
iabyn Apr 16, 2025
34ec182
ParseXS: refactor: tweak some code comments
iabyn Apr 16, 2025
2db64d2
ParseXS: refactor: delete param field from Params
iabyn Apr 16, 2025
ee5c48e
ParseXS: refactor: add Node:IO_Param class
iabyn Apr 16, 2025
4ccada0
ParseXS: refactor: set default alias at parse time
iabyn Apr 16, 2025
df71d29
ParseXS: refactor: remove print_section()
iabyn Apr 16, 2025
cfedea9
ParseXS: refactor: turn param parsing into a sub
iabyn Apr 17, 2025
dcc507c
ParseXS: refactor: add Param->parse() method.
iabyn Apr 17, 2025
156f4ea
ParseXS: refactor: clean-up Param->parse() method
iabyn Apr 17, 2025
0515139
ParseXS: refactor: IO_Param::lookup_input_typemap
iabyn Apr 18, 2025
c4d786d
ParseXS: refactor: IO_Param::lookup_output_typemap
iabyn Apr 18, 2025
b713240
ParseXS: refactor: set XSRETURN_count_* earlier
iabyn Apr 20, 2025
19caf65
ParseXS: refactor: lookup typemaps at parse time
iabyn Apr 19, 2025
5d4af97
ParseXS: clean up error messages and tests
iabyn Apr 23, 2025
7da1bc7
ParseXS: refactor: always store kid nodes in kids
iabyn Apr 24, 2025
003f2ca
ParseXS: refactor: tidy up Node.pm
iabyn Apr 24, 2025
0f6eaf1
ParseXS: refactor: give $build_subclass parent arg
iabyn Apr 24, 2025
10adb09
ParseXS: refactor: fixup some code comments
iabyn Apr 24, 2025
664dcc0
ParseXS: refactor: update field code comments
iabyn Apr 24, 2025
55be473
ParseXS: refactor: rename some fields to ioparam
iabyn Apr 24, 2025
e7db425
ParseXS: refactor: add basic POD for Node.pm
iabyn Apr 24, 2025
d0021b2
ParseXS: refactor: fix for 5.8.9 builds
iabyn Apr 24, 2025
373806a
ParseXS: refactor: fix trivial indentation issue
iabyn May 25, 2025
cf92bef
ParseXS: refactor: make build_subclass() simpler
iabyn May 25, 2025
43263bc
ParseXS: disallow const on non-C++ methods
iabyn May 25, 2025
e561b6e
ParseXS: split out C++ class and const
iabyn May 25, 2025
6d6660a
PerlIO-via: fix PROTOTYPES typo
iabyn May 25, 2025
3e449b6
ParseXS: make most ENABLE keywords stricter
iabyn May 25, 2025
9a808ad
ParseXS: handle PROTOTYPES keyword more strictly
iabyn May 26, 2025
fec16c7
ParseXS: refactor: tweak some code comments
iabyn Jul 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,703 changes: 52 additions & 1,651 deletions dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use strict;
use warnings;
use Symbol;

our $VERSION = '3.57';
our $VERSION = '3.58';

=head1 NAME

Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/CountLines.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ExtUtils::ParseXS::CountLines;
use strict;

our $VERSION = '3.57';
our $VERSION = '3.58';

our $SECTION_END_MARKER;

Expand Down
28 changes: 11 additions & 17 deletions dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Eval.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ExtUtils::ParseXS::Eval;
use strict;
use warnings;

our $VERSION = '3.57';
our $VERSION = '3.58';

=head1 NAME

Expand All @@ -29,23 +29,20 @@ Warns the contents of C<$@> if any.
Not all these variables are necessarily considered "public" wrt. use in
typemaps, so beware. Variables set up from the ExtUtils::ParseXS object:

$Package $ALIAS $func_name $Full_func_name $pname
$Package $func_name $Full_func_name $pname

Variables set up from C<$other_hashref>:

$var $type $ntype $subtype $arg
$var $type $ntype $subtype $arg $ALIAS

=cut

sub eval_output_typemap_code {
my ($_pxs, $_code, $_other) = @_;

my ($Package, $ALIAS, $func_name, $Full_func_name, $pname)
= @{$_pxs}{qw(PACKAGE_name xsub_seen_ALIAS xsub_func_name
xsub_func_full_C_name xsub_func_full_perl_name)};

my ($var, $type, $ntype, $subtype, $arg)
= @{$_other}{qw(var type ntype subtype arg)};
my ($Package) = @{$_pxs}{qw(PACKAGE_name)};
my ($var, $type, $ntype, $subtype, $arg, $ALIAS, $func_name, $Full_func_name, $pname)
= @{$_other}{qw(var type ntype subtype arg alias func_name full_C_name full_perl_name)};

my $rv = eval $_code;
warn $@ if $@;
Expand All @@ -64,23 +61,20 @@ Warns the contents of C<$@> if any.
Not all these variables are necessarily considered "public" wrt. use in
typemaps, so beware. Variables set up from the ExtUtils::ParseXS object:

$Package $ALIAS $func_name $Full_func_name $pname
$Package $func_name $Full_func_name $pname

Variables set up from C<$other_hashref>:

$var $type $ntype $subtype $num $init $printed_name $arg $argoff
$var $type $ntype $subtype $num $init $printed_name $arg $argoff $ALIAS

=cut

sub eval_input_typemap_code {
my ($_pxs, $_code, $_other) = @_;

my ($Package, $ALIAS, $func_name, $Full_func_name, $pname)
= @{$_pxs}{qw(PACKAGE_name xsub_seen_ALIAS xsub_func_name
xsub_func_full_C_name xsub_func_full_perl_name)};

my ($var, $type, $num, $init, $printed_name, $arg, $ntype, $argoff, $subtype)
= @{$_other}{qw(var type num init printed_name arg ntype argoff subtype)};
my ($Package) = @{$_pxs}{qw(PACKAGE_name)};
my ($var, $type, $num, $init, $printed_name, $arg, $ntype, $argoff, $subtype, $ALIAS, $func_name, $Full_func_name, $pname)
= @{$_other}{qw(var type num init printed_name arg ntype argoff subtype alias func_name full_C_name full_perl_name)};

my $rv = eval $_code;
warn $@ if $@;
Expand Down
Loading
Loading