Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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.
- Loading branch information