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

Open
wants to merge 148 commits into
base: blead
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
c3581cc
ParseXS: bump version 3.57 => 3.58
iabyn Mar 3, 2025
9fb3e9f
ParseXS: refactor: add file/line_no fields to Node
iabyn Mar 5, 2025
7c2ab8a
ParseXS: refactor: add multiline,code,PREINIT node
iabyn Mar 3, 2025
4994f2e
ParseXS: refactor: add C_ARGS,IF,IF_MACRO nodes
iabyn Mar 5, 2025
d473ad7
ParseXS: refactor: Node.pm: add class helper fn
iabyn Mar 6, 2025
2470c66
ParseXS: refactor: rename code Node to codeblock
iabyn Mar 7, 2025
9269eb7
ParseXS: match EN/DISABLE keyword more strictly
iabyn Mar 6, 2025
21fef4c
ParseXS: refactor: don't pass $_ to/from parse()
iabyn Mar 7, 2025
f7c5f66
ParseXS: fix SCOPE keyword and update docs
iabyn Mar 9, 2025
0ea35bf
ParseXS: refactor: add classes for ENABLE keywords
iabyn Mar 9, 2025
8ccdf74
ParseXS: refactor: add PROTOTYPE node
iabyn Mar 11, 2025
531b65d
ParseXS: refactor: use __PACKAGE__ to simplify
iabyn Mar 11, 2025
8208a27
ParseXS: fix test infrastructure under 5.8.x
iabyn Mar 11, 2025
f1f0340
ParseXS: refactor: reindent Param::as_output_code
iabyn Mar 11, 2025
7ae5271
ParseXS: refactor: add ALIAS,ALIAS_line nodes
iabyn Mar 13, 2025
6955a17
ParseXS: improve error test coverage for Node.pm
iabyn Mar 14, 2025
decc152
ParseXS: refactor: add ATTRS node
iabyn Mar 14, 2025
2a5f6c1
ParseXS: refactor: add OVERLOAD node
iabyn Mar 14, 2025
3a4df27
ParseXS: refactor: INPUT_handler() use $line vs $_
iabyn Mar 15, 2025
cfdba7c
ParseXS: refactor: INPUT_handler() split into two
iabyn Mar 15, 2025
44b694a
ParseXS: refactor: INPUT_handler() move to Node.pm
iabyn Mar 15, 2025
b16f661
ParseXS: refactor: INPUT_handler() reindent.
iabyn Mar 15, 2025
5bc73a0
ParseXS: refactor: add INPUT, INPUT_line nodes
iabyn Mar 15, 2025
03189be
ParseXS: refactor: INPUT_line::parse(): remove var
iabyn Mar 17, 2025
5ca5592
ParseXS: refactor: add Node::INPUT_line fields
iabyn Mar 17, 2025
ff3ce5a
ParseXS: refactor: move Param field decl
iabyn Mar 17, 2025
ac824c7
ParseXS: refactor: add Node::Param::set_proto meth
iabyn Mar 17, 2025
206c002
ParseXS: add tests for NOT_IMPLEMENTED_YET
iabyn Mar 17, 2025
a48e690
ParseXS: process NOT_IMPLEMENTED_YET later
iabyn Mar 17, 2025
b801ffe
ParseXS: reindent after previous commit
iabyn Mar 17, 2025
3a8a69c
ParseXS: refactor: minor tweaks on main loop
iabyn Mar 17, 2025
0a77954
ParseXS: refactor: move input parsing into a sub
iabyn Mar 17, 2025
41ba5aa
ParseXS: refactor: reindent block of code
iabyn Mar 17, 2025
1f296ea
ParseXS: refactor: add input_part node
iabyn Mar 18, 2025
6c48ebc
ParseXS: refactor: add input_part->as_code()
iabyn Mar 19, 2025
7db9c91
ParseXS: refactor: mark INPUT node as implicit
iabyn Mar 19, 2025
b8ae317
ParseXS: refactor: avoid autovivifying kids
iabyn Mar 19, 2025
93cbe56
ParseXS: refactor: make parse() meths return bool
iabyn Mar 19, 2025
aa70fe7
ParseXS: refactor: add parse_keywords() method
iabyn Mar 19, 2025
47af951
ParseXS: refactor: add init_part, INIT nodes
iabyn Mar 19, 2025
4e45f12
ParseXS: refactor: add PPCODE node and tests
iabyn Mar 20, 2025
c4ba4cc
ParseXS: refactor: add CODE node
iabyn Mar 20, 2025
bee6b79
ParseXS: refactor: add code_part, NIY nodes
iabyn Mar 20, 2025
74d931e
ParseXS: refactor: add autocall node
iabyn Mar 20, 2025
8fc01fe
ParseXS: refactor: put code_part next to init_part
iabyn Mar 20, 2025
b2ed92a
ParseXS: refactor: add POSTCALL node
iabyn Mar 21, 2025
46a9935
ParseXS: refactor: add CLEANUP node
iabyn Mar 21, 2025
c65cb56
ParseXS: refactor: OUTPUT_handler() use $line vs $_
iabyn Mar 21, 2025
58ffdb2
ParseXS: refactor: OUTPUT_handler() split into two
iabyn Mar 21, 2025
32bc99e
ParseXS: refactor: OUTPUT_handler(): mv to Node.pm
iabyn Mar 21, 2025
bad6368
ParseXS: refactor: OUTPUT_handler() reindent.
iabyn Mar 21, 2025
5edfec5
ParseXS: refactor: add OUTPUT, OUTPUT_line nodes
iabyn Mar 21, 2025
9b3ee05
ParseXS: refactor: add Node::OUTPUT_line fields
iabyn Mar 21, 2025
a7c5807
ParseXS: refactor: alter Node:OUTPUT_line RETVAL
iabyn Mar 21, 2025
db9646a
ParseXS: refactor: add two xsub_foo fields
iabyn Mar 21, 2025
322341f
ParseXS: refactor: move output parsing into a sub
iabyn Mar 21, 2025
a5542f5
ParseXS: refactor: reindent block of code
iabyn Mar 21, 2025
7376bcf
ParseXS: refactor: remove redundant braces
iabyn Mar 21, 2025
efefc3d
ParseXS: refactor: add output_part node
iabyn Mar 21, 2025
cd1b5be
ParseXS: refactor: add cleanup_part node
iabyn Mar 21, 2025
1a14fa8
ParseXS: refactor: mv xsub_implicit_OUTPUT_RETVAL
iabyn Mar 21, 2025
f43812b
ParseXS: refactor: add xbody node
iabyn Mar 23, 2025
962b410
ParseXS: refactor: move some code emitting
iabyn Mar 23, 2025
151da80
ParseXS: refactor: tidy some C-code-emitting code
iabyn Mar 24, 2025
2363b14
ParseXS: add CASE tests, tweak err msgs
iabyn Mar 24, 2025
cba3eba
ParseXS: refactor: add ReturnType node
iabyn Mar 24, 2025
d724b5a
ParseXS: refactor: rename Node::Sig Node::Params
iabyn Mar 24, 2025
5deff00
ParseXS: refactor: rename Params->{sig_text} field
iabyn Mar 24, 2025
b407e73
ParseXS: refactor: prepare sig parsing code for mv
iabyn Mar 25, 2025
76cfd9d
ParseXS: refactor: move sig-parsing code
iabyn Mar 25, 2025
4cc9af1
ParseXS: refactor: add xsub_decl Node
iabyn Mar 25, 2025
85f2e71
ParseXS: refactor: reindent xsub_decl::parse()
iabyn Mar 25, 2025
b12cf05
ParseXS: refactor: remove redundant block
iabyn Mar 25, 2025
1522c50
ParseXS: refactor: add fields to xsub_decl Node
iabyn Mar 25, 2025
9b35142
ParseXS: refactor: move some xsub_pdecl init stuff
iabyn Mar 25, 2025
0777151
parseXS: add tests for XSUB declaration errs
iabyn Mar 25, 2025
a1ad2a3
parseXS: refactor: delete whitespace lines Node.pm
iabyn Mar 25, 2025
352745a
ParseXS: refactor; fix a couple of comments
iabyn Mar 25, 2025
88d86f6
ParseXS: refactor: prepare for xsub parsing move
iabyn Mar 25, 2025
70ab861
ParseXS: refactor: move xsub parse code to Node.pm
iabyn Mar 25, 2025
84e4db4
parseXS: refactor: add xsub Node class
iabyn Mar 25, 2025
18f3847
ParseXS: refactor: reindent sub
iabyn Mar 25, 2025
85c793c
ParseXS: refactor: add boot_code() in Node::xsub
iabyn Mar 25, 2025
6353769
ParseXS: refactor: boot_code(): remove block
iabyn Mar 25, 2025
19f0af6
ParseXS: refactor: make :boot_code() return val
iabyn Mar 25, 2025
c9481ee
ParseXS: refactor: add decl field to Node::xsub
iabyn Mar 25, 2025
9866e32
ParseXS: add another CASE test
iabyn Mar 26, 2025
9d87d60
ParseXS: refactor: add CASE node type
iabyn Mar 26, 2025
8d10630
ParseXS: refactor: some tweaks to Node::xsub
iabyn Mar 27, 2025
97cfe3a
ParseXS: refactor: add per-xbody Params objects
iabyn Mar 28, 2025
fbdaa4b
ParseXS: add warning about varying prototype chars
iabyn Apr 3, 2025
e7bf5a2
ParseXS: refactor: ensure C_ARGS per CASE
iabyn Mar 31, 2025
f7be7e3
ParseXS: refactor: pass xbody to foo_part::as_code
iabyn Apr 4, 2025
9b98441
ParseXS: refactor: avoid xsub_params in _part code
iabyn Apr 4, 2025
19b43db
ParseXS: give error on unmatched length(foo)
iabyn Apr 5, 2025
693690d
ParseXS: refactor: add cur_xbody, rm xsub_params
iabyn Apr 5, 2025
efbae92
ParseXS: refactor: split xsub parse() method
iabyn Apr 9, 2025
21a697b
ParseXS: refactor: pass xsub obj to as_code meths
iabyn Apr 10, 2025
58f5bf5
ParseXS: refactor: rm xsub_targ_declared_early
iabyn Apr 10, 2025
66410ce
ParseXS: refactor: remove xsub_targ_used
iabyn Apr 10, 2025
14d25ad
ParseXS: refactor: tidy up some code comments
iabyn Apr 11, 2025
685e46b
ParseXS: refactor: re-add SCOPE dup err message
iabyn Apr 11, 2025
fbabbf9
ParseXS: refactor: remove xsub_seen_ALIAS
iabyn Apr 11, 2025
54b32d1
ParseXS: refactor: remove various xsub_seen_FOO
iabyn Apr 11, 2025
1e5d042
ParseXS: refactor: remove xsub_seen_RETVAL_in_CODE
iabyn Apr 11, 2025
324cbca
ParseXS: rm xsub_FOO's for return and fix CASE
iabyn Apr 12, 2025
0d12ffb
ParseXS: cosmetic: change SCOPE indent
iabyn Apr 12, 2025
ceb4874
ParseXS: refactor: use $open/close_brace more
iabyn Apr 12, 2025
261c2a8
ParseXS: refactor: rm return-type xsub_foo fields
iabyn Apr 12, 2025
b0bb121
ParseXS: refactor: add seen_an_XSUB EU::PXS field
iabyn Apr 12, 2025
6404deb
ParseXS: refactor: rm fn name/class xsub_FOO's
iabyn Apr 12, 2025
70cc7a2
ParseXS: refactor: rm xsub_implicit_OUTPUT_RETVAL
iabyn Apr 13, 2025
bd5b89d
ParseXS: fix alias/attr cv, add need_boot_cv field
iabyn Apr 13, 2025
308c519
ParseXS: refactor: rm various xsub_*alias* fields
iabyn Apr 14, 2025
bd0f043
ParseXS: refactor: rm xsub_map_interface_foo field
iabyn Apr 14, 2025
89ad7a1
ParseXS: refactor: rm xsub_attributes field
iabyn Apr 14, 2025
c933ea6
ParseXS: tweak some code comments and indents
iabyn Apr 14, 2025
765b04d
ParseXS: make OUTPUT: SETMAGIC per-CASE
iabyn Apr 14, 2025
288da2d
ParseXS: refactor: rm xsub_deferred_code_lines
iabyn Apr 14, 2025
72fc64a
ParseXS: refactor: reduce scope of targ_used field
iabyn Apr 15, 2025
d308837
ParseXS: refactor: rm xsub_stack_was_reset field
iabyn Apr 15, 2025
0e253e5
ParseXS: refactor: rm xsub_interface_macro fields
iabyn Apr 15, 2025
23afacd
ParseXS: refactor: remove misc xsub_foo fields
iabyn Apr 16, 2025
1a928b3
ParseXS: refactor: sort out SCOPE object fields
iabyn Apr 16, 2025
9d3d5b5
ParseXS: refactor: avoid cur_xsub/xbody in as_code
iabyn Apr 16, 2025
6700da4
ParseXS: refactor: undef cur_xsub/xbody after use
iabyn Apr 16, 2025
6bcce5e
ParseXS: refactor: remove cur_xsub/xbody fields
iabyn Apr 16, 2025
06d618e
ParseXS: refactor: tweak some code comments
iabyn Apr 16, 2025
f88d94a
ParseXS: refactor: delete param field from Params
iabyn Apr 16, 2025
669b19b
ParseXS: refactor: add Node:IO_Param class
iabyn Apr 16, 2025
b11bfb7
ParseXS: refactor: set default alias at parse time
iabyn Apr 16, 2025
76e99d9
ParseXS: refactor: remove print_section()
iabyn Apr 16, 2025
9514ad1
ParseXS: refactor: turn param parsing into a sub
iabyn Apr 17, 2025
6b71678
ParseXS: refactor: add Param->parse() method.
iabyn Apr 17, 2025
c20945f
ParseXS: refactor: clean-up Param->parse() method
iabyn Apr 17, 2025
f051302
ParseXS: refactor: IO_Param::lookup_input_typemap
iabyn Apr 18, 2025
a4ef2a4
ParseXS: refactor: IO_Param::lookup_output_typemap
iabyn Apr 18, 2025
ec74ddd
ParseXS: refactor: set XSRETURN_count_* earlier
iabyn Apr 20, 2025
5347030
ParseXS: refactor: lookup typemaps at parse time
iabyn Apr 19, 2025
e7eafae
ParseXS: clean up error messages and tests
iabyn Apr 23, 2025
bcb52af
ParseXS: refactor: always store kid nodes in kids
iabyn Apr 24, 2025
d2513af
ParseXS: refactor: tidy up Node.pm
iabyn Apr 24, 2025
a9bd1a1
ParseXS: refactor: give $build_subclass parent arg
iabyn Apr 24, 2025
4855002
ParseXS: refactor: fixup some code comments
iabyn Apr 24, 2025
d71ad70
ParseXS: refactor: update field code comments
iabyn Apr 24, 2025
894cafd
ParseXS: refactor: rename some fields to ioparam
iabyn Apr 24, 2025
5b6a30f
ParseXS: refactor: add basic POD for Node.pm
iabyn Apr 24, 2025
5d95e16
ParseXS: refactor: fix for 5.8.9 builds
iabyn Apr 24, 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