Skip to content

Commit 9621dfa

Browse files
committed
[MERGE] ParseXS: refactor: add Node objects
This branch heavily refactors the XSUB signature and INPUT parsing parts of ExtUtils::ParseXS. Over about 50 commits, it adds a new file: dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm and adds two classes to it: ExtUtils::ParseXS::Node::Param ExtUtils::ParseXS::Node::Sig It then changes the parsing and processing so that, instead of building up a number of hashes indexed by var name to store the information about a parameter, it instead stores all the information about a particular parameter in a Node::Param object, then adds all those objects to an array in a Node::Sig object. Then the Node::Param->as_code() method will emit the C code associated with the declaration and initialisation of one parameter. This can be viewed as the first steps along the road to making ExtUtils::ParseXS build an AST and emit code as a separate step. Its not nearly there yet - most of the module still emits code as it goes along, saving only the minimum state needed. And the C var declarations are still emitted mostly after each INPUT line is processed rather than at the end of all signature/INPUT processing, but at least an AST for just the sig and parameter data is available for later in the processing. Overall it makes the code much cleaner and reduces the amount of special-casing, which was often distributed over many parts of the module. There is little visible change in functionality, although there are more error messages now, for things that would have formerly just silently emitted bad C which would likely fail to compile. Lots of new tests have been added.
2 parents 19a5403 + 0a291b5 commit 9621dfa

File tree

15 files changed

+1875
-958
lines changed

15 files changed

+1875
-958
lines changed

MANIFEST

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4166,6 +4166,7 @@ dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pod ExtUtils::ParseXS documentation
41664166
dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm ExtUtils::ParseXS guts
41674167
dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/CountLines.pm ExtUtils::ParseXS guts
41684168
dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Eval.pm ExtUtils::ParseXS guts
4169+
dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm ExtUtils::ParseXS guts - AST nodes
41694170
dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm ExtUtils::ParseXS guts
41704171
dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm ExtUtils::Typemaps, a PXS helper
41714172
dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Cmd.pm ExtUtils::Typemaps helper module
@@ -4187,7 +4188,6 @@ dist/ExtUtils-ParseXS/t/105-valid_proto_string.t ExtUtils::ParseXS tests
41874188
dist/ExtUtils-ParseXS/t/106-process_typemaps.t ExtUtils::ParseXS tests
41884189
dist/ExtUtils-ParseXS/t/108-map_type.t ExtUtils::ParseXS tests
41894190
dist/ExtUtils-ParseXS/t/109-standard_XS_defs.t ExtUtils::ParseXS tests
4190-
dist/ExtUtils-ParseXS/t/110-assign_func_args.t ExtUtils::ParseXS tests
41914191
dist/ExtUtils-ParseXS/t/111-analyze_preprocessor_statements.t ExtUtils::ParseXS tests
41924192
dist/ExtUtils-ParseXS/t/112-set_cond.t ExtUtils::ParseXS tests
41934193
dist/ExtUtils-ParseXS/t/113-check_cond_preproc_statements.t ExtUtils::ParseXS tests

0 commit comments

Comments
 (0)