Module-Build-Parse-Yapp-0.1.2/0000755000175000017500000000000013656262507015663 5ustar andriusandriusModule-Build-Parse-Yapp-0.1.2/README0000644000175000017500000000050513656262507016543 0ustar andriusandrius This archive contains the distribution Module-Build-Parse-Yapp, version 0.1.2: build Parse::Yapp parsers from source This software is Copyright (c) 2020 by Andrius Merkys. This is free software, licensed under: The (three-clause) BSD License This README file was generated by Dist::Zilla::Plugin::Readme v6.010. Module-Build-Parse-Yapp-0.1.2/Makefile.PL0000644000175000017500000000231013656262507017631 0ustar andriusandrius# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.010. use strict; use warnings; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "build Parse::Yapp parsers from source", "AUTHOR" => "Andrius Merkys ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Module-Build-Parse-Yapp", "LICENSE" => "bsd", "NAME" => "Module::Build::Parse::Yapp", "PREREQ_PM" => { "File::Find" => 0, "File::Path" => 0, "File::Spec" => 0, "File::Temp" => 0, "Module::Build" => 0, "Parse::Yapp" => 0, "Test::Simple" => 0 }, "VERSION" => "0.1.2", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "File::Find" => 0, "File::Path" => 0, "File::Spec" => 0, "File::Temp" => 0, "Module::Build" => 0, "Parse::Yapp" => 0, "Test::Simple" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Module-Build-Parse-Yapp-0.1.2/lib/0000755000175000017500000000000013656262507016431 5ustar andriusandriusModule-Build-Parse-Yapp-0.1.2/lib/Module/0000755000175000017500000000000013656262507017656 5ustar andriusandriusModule-Build-Parse-Yapp-0.1.2/lib/Module/Build/0000755000175000017500000000000013656262507020715 5ustar andriusandriusModule-Build-Parse-Yapp-0.1.2/lib/Module/Build/Parse/0000755000175000017500000000000013656262507021767 5ustar andriusandriusModule-Build-Parse-Yapp-0.1.2/lib/Module/Build/Parse/Yapp.pm0000644000175000017500000000453513656262507023245 0ustar andriusandriuspackage Module::Build::Parse::Yapp; use strict; use warnings; use base 'Module::Build'; our $VERSION = '0.1.2'; # VERSION # ABSTRACT: build Parse::Yapp parsers from source use File::Find; use File::Path qw( make_path ); use File::Spec::Functions qw( catdir splitdir ); use Parse::Yapp; sub new { my $self = shift; my %args = @_; $self->SUPER::new( %args ); } sub process_yp_files { my $self = shift; find( { wanted => \&_find_parser, no_chdir => 1 }, 'lib' ); } sub _find_parser { return unless /\.yp$/; my $pmfile = $_; $pmfile =~ s/\.yp$/.pm/; my @path = splitdir( $File::Find::name ); my @pmpath = my @namespace = @path; unshift @pmpath, 'blib'; $pmpath[-1] =~ s/\.yp$/.pm/; shift @namespace; $namespace[-1] =~ s/\.yp$//; make_path( catdir( @pmpath[0..$#pmpath-1] ) ); _make_parser( $File::Find::name, catdir( @pmpath ), join '::', @namespace ); } sub _make_parser { my( $inputfile, $outputfile, $classname ) = @_; my $parser = Parse::Yapp->new( inputfile => $inputfile ); open( my $out, '>', $outputfile ); print $out $parser->Output( classname => $classname ); close $out; } 1; __END__ =pod =encoding UTF-8 =head1 NAME Module::Build::Parse::Yapp - build Parse::Yapp parsers from source =head1 VERSION version 0.1.2 =head1 SYNOPSIS use Module::Build::Parse::Yapp; my $build = Module::Build::Parse::Yapp->new ( module_name => 'Foo::Bar', ...other stuff here... ); $build->add_build_element('yp'); $build->create_build_script; =head1 DESCRIPTION Module::Build::Parse::Yapp is a subclass of L made to build L parsers from the source. Thus, prebuilt parsers do not have to be included in the source distribution. Module::Build::Parse::Yapp looks for *.yp files under B<'lib'> and produces Perl modules in place of them under B<'blib/lib'>. Therefore, a grammar file B<'lib/A/B/C.yp'> will be converted to B<'blib/lib/A/B/C.pm'> with a package name of B<'A::B::C'>. =head1 SEE ALSO perl(1), Module::Build(3), Parse::Yapp(3) =head1 AUTHOR Andrius Merkys =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2020 by Andrius Merkys. This is free software, licensed under: The (three-clause) BSD License =cut Module-Build-Parse-Yapp-0.1.2/META.json0000644000175000017500000000247213656262507017311 0ustar andriusandrius{ "abstract" : "build Parse::Yapp parsers from source", "author" : [ "Andrius Merkys " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010", "license" : [ "bsd" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Module-Build-Parse-Yapp", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "File::Find" : "0", "File::Path" : "0", "File::Spec" : "0", "File::Temp" : "0", "Module::Build" : "0", "Parse::Yapp" : "0", "Test::Simple" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/merkys/module-build-parse-yapp/issues" }, "homepage" : "http://search.cpan.org/dist/", "repository" : { "type" : "git", "url" : "git://github.com/merkys/module-build-parse-yapp.git", "web" : "https://github.com/merkys/module-build-parse-yapp" } }, "version" : "0.1.2", "x_serialization_backend" : "JSON::XS version 3.04" } Module-Build-Parse-Yapp-0.1.2/dist.ini0000644000175000017500000000100513656262507017323 0ustar andriusandriusname = Module-Build-Parse-Yapp author = Andrius Merkys license = BSD copyright_holder = Andrius Merkys copyright_year = 2020 version = 0.1.2 [@Filter] -bundle = @Basic -remove = License [MetaJSON] [Prereqs] File::Find = 0 File::Path = 0 File::Spec = 0 File::Temp = 0 Module::Build = 0 Parse::Yapp = 0 Test::Simple = 0 [PodWeaver] [AutoMetaResources] homepage = http://search.cpan.org/dist/ repository.github = user:merkys bugtracker.github = user:merkys [OurPkgVersion] Module-Build-Parse-Yapp-0.1.2/Changes0000644000175000017500000000042213656262507017154 0ustar andriusandrius0.1.2 2020-05-11 - Creating a directory for the generated parser prior to its generation. 0.1.1 2020-02-25 - Added explicit import for File::Spec::Functions::catdir(). - Corrected module name in the synopsis. 0.1.0 2020-02-24 - Initial release. Module-Build-Parse-Yapp-0.1.2/META.yml0000644000175000017500000000143613656262507017140 0ustar andriusandrius--- abstract: 'build Parse::Yapp parsers from source' author: - 'Andrius Merkys ' build_requires: {} configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010' license: bsd meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Module-Build-Parse-Yapp requires: File::Find: '0' File::Path: '0' File::Spec: '0' File::Temp: '0' Module::Build: '0' Parse::Yapp: '0' Test::Simple: '0' resources: bugtracker: https://github.com/merkys/module-build-parse-yapp/issues homepage: http://search.cpan.org/dist/ repository: git://github.com/merkys/module-build-parse-yapp.git version: 0.1.2 x_serialization_backend: 'YAML::Tiny version 1.70' Module-Build-Parse-Yapp-0.1.2/LICENSE0000644000175000017500000000273313656262507016675 0ustar andriusandriusCopyright (c) The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Module-Build-Parse-Yapp-0.1.2/t/0000755000175000017500000000000013656262507016126 5ustar andriusandriusModule-Build-Parse-Yapp-0.1.2/t/00bfck.t0000644000175000017500000000135213656262507017361 0ustar andriusandrius#!/usr/bin/perl use strict; use warnings; use File::Spec::Functions; use File::Temp qw( tempdir ); use Module::Build::Parse::Yapp; use Test::Simple tests => 1; my $tempdir = tempdir( CLEANUP => 1 ); my $inputfile = catdir( $tempdir, 'bfck.yp' ); my $outputfile = catdir( $tempdir, 'bfck.pm' ); open( my $yp, '>', $inputfile ); print $yp <' | '<' | '+' | '-' | '.' | ',' | '[' | ']' ; %% END close $yp; Module::Build::Parse::Yapp::_make_parser( $inputfile, $outputfile, 'bfck' ); ok( -e $outputfile, 'parser is generated' ); Module-Build-Parse-Yapp-0.1.2/MANIFEST0000644000175000017500000000030313656262507017010 0ustar andriusandrius# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.010. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/Module/Build/Parse/Yapp.pm t/00bfck.t