| 1 | # | ||||||||||||
| 2 | # Module Parse::Yapp::Output | ||||||||||||
| 3 | # | ||||||||||||
| 4 | # Copyright © 1998, 1999, 2000, 2001, Francois Desarmenien. | ||||||||||||
| 5 | # Copyright © 2017 William N. Braswell, Jr. | ||||||||||||
| 6 | # (see the pod text in Parse::Yapp module for use and distribution rights) | ||||||||||||
| 7 | # | ||||||||||||
| 8 | package Parse::Yapp::Output; | ||||||||||||
| 9 | 3 | @ISA=qw ( Parse::Yapp::Lalr ); | |||||||||||
| 10 | |||||||||||||
| 11 | 3 | require 5.004; | |||||||||||
| 12 | |||||||||||||
| 13 | 3 | ▶ | use Parse::Yapp::Lalr; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | 3 | ▶ | use Parse::Yapp::Driver; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | |||||||||||||
| 16 | 3 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | |||||||||||||
| 18 | 3 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | |||||||||||||
| 20 | 0 | ▶ | sub _CopyDriver { | ||||||||||
|
Subroutine
_CopyDriver: not called CC=2 SCAR=17.9
| |||||||||||||
| 21 | 0 | my($text)='#Included Parse/Yapp/Driver.pm file'.('-' x 40)."\n"; | |||||||||||
| 22 | 0 | ▶ | open(DRV,$Parse::Yapp::Driver::FILENAME) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 23 | or die "BUG: could not open $Parse::Yapp::Driver::FILENAME"; | ||||||||||||
| 24 | 0 | $text.="{\n".join('',<DRV>)."}\n"; | |||||||||||
| 25 | 0 | close(DRV); | |||||||||||
| 26 | 0 | $text.='#End of include'.('-' x 50)."\n"; | |||||||||||
| 27 | } | ||||||||||||
| 28 | |||||||||||||
| 29 | 9 | ▶ | sub Output { | ||||||||||
|
Subroutine
Output: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||
| 30 | 9 | my($self)=shift; | |||||||||||
| 31 | |||||||||||||
| 32 | 9 | $self->Options(@_); | |||||||||||
| 33 | |||||||||||||
| 34 | 9 | my($package)=$self->Option('classname'); | |||||||||||
| 35 | 9 | my($head,$states,$rules,$tail,$driver); | |||||||||||
| 36 | 9 | my($version)=$Parse::Yapp::Driver::VERSION; | |||||||||||
| 37 | 9 | my($datapos); | |||||||||||
| 38 | 9 | ▶ | my($text)=$self->Option('template') ||<<'EOT'; | ||||||||||
|
Condition50%1/2
$self->Option('template') || "####################################################################\n#\n# This file was generated using Parse::Yapp version <<\$version>>.\n#\n# Don't edit this file, use source file instead.\n#\n# ANY CHANGE MADE HERE WILL BE LOST !\n#\n####################################################################\npackage <<\$package>>;\nuse vars qw ( \@ISA );\nuse strict;\n\n\@ISA= qw ( Parse::Yapp::Driver );\n<<\$driver>>\n\n<<\$head>>\n\nsub new {\n my(\$class)=shift;\n ref(\$class)\n and \$class=ref(\$class);\n\n my(\$self)=\$class->SUPER::new( yyversion => '<<\$version>>',\n yystates =>\n<<\$states>>,\n yyrules =>\n<<\$rules>>,\n \@_);\n bless(\$self,\$class);\n}\n\n<<\$tail>>\n1;\n"
MC/DC0%0/1
$self->Option('template') || "####################################################################\n#\n# This file was generated using Parse::Yapp version <<\$version>>.\n#\n# Don't edit this file, use source file instead.\n#\n# ANY CHANGE MADE HERE WILL BE LOST !\n#\n####################################################################\npackage <<\$package>>;\nuse vars qw ( \@ISA );\nuse strict;\n\n\@ISA= qw ( Parse::Yapp::Driver );\n<<\$driver>>\n\n<<\$head>>\n\nsub new {\n my(\$class)=shift;\n ref(\$class)\n and \$class=ref(\$class);\n\n my(\$self)=\$class->SUPER::new( yyversion => '<<\$version>>',\n yystates =>\n<<\$states>>,\n yyrules =>\n<<\$rules>>,\n \@_);\n bless(\$self,\$class);\n}\n\n<<\$tail>>\n1;\n"
$self->Option('template')
Truth table50%1/2
A
A= $self->Option('template')
| |||||||||||||
| 39 | #################################################################### | ||||||||||||
| 40 | # | ||||||||||||
| 41 | # This file was generated using Parse::Yapp version <<$version>>. | ||||||||||||
| 42 | # | ||||||||||||
| 43 | # Don't edit this file, use source file instead. | ||||||||||||
| 44 | # | ||||||||||||
| 45 | # ANY CHANGE MADE HERE WILL BE LOST ! | ||||||||||||
| 46 | # | ||||||||||||
| 47 | #################################################################### | ||||||||||||
| 48 | package <<$package>>; | ||||||||||||
| 49 | use vars qw ( @ISA ); | ||||||||||||
| 50 | use strict; | ||||||||||||
| 51 | |||||||||||||
| 52 | @ISA= qw ( Parse::Yapp::Driver ); | ||||||||||||
| 53 | <<$driver>> | ||||||||||||
| 54 | |||||||||||||
| 55 | <<$head>> | ||||||||||||
| 56 | |||||||||||||
| 57 | sub new { | ||||||||||||
| 58 | my($class)=shift; | ||||||||||||
| 59 | ref($class) | ||||||||||||
| 60 | and $class=ref($class); | ||||||||||||
| 61 | |||||||||||||
| 62 | my($self)=$class->SUPER::new( yyversion => '<<$version>>', | ||||||||||||
| 63 | yystates => | ||||||||||||
| 64 | <<$states>>, | ||||||||||||
| 65 | yyrules => | ||||||||||||
| 66 | <<$rules>>, | ||||||||||||
| 67 | @_); | ||||||||||||
| 68 | bless($self,$class); | ||||||||||||
| 69 | } | ||||||||||||
| 70 | |||||||||||||
| 71 | <<$tail>> | ||||||||||||
| 72 | 1; | ||||||||||||
| 73 | EOT | ||||||||||||
| 74 | |||||||||||||
| 75 | 9 | $driver='use Parse::Yapp::Driver;'; | |||||||||||
| 76 | |||||||||||||
| 77 | 9 | ▶ | defined($package) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 78 | or $package='Parse::Yapp::Default'; | ||||||||||||
| 79 | |||||||||||||
| 80 | 9 | $head= $self->Head(); | |||||||||||
| 81 | 9 | $rules=$self->RulesTable(); | |||||||||||
| 82 | 9 | $states=$self->DfaTable(); | |||||||||||
| 83 | 9 | $tail= $self->Tail(); | |||||||||||
| 84 | |||||||||||||
| 85 | 9 | ▶ | $self->Option('standalone') | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 86 | and $driver=_CopyDriver(); | ||||||||||||
| 87 | |||||||||||||
| 88 | 9 | $text=~s/<<(\$.+)>>/$1/gee; | |||||||||||
| 89 | |||||||||||||
| 90 | 9 | $text; | |||||||||||
| 91 | } | ||||||||||||
| 92 | |||||||||||||
| 93 | 3 | 1; | |||||||||||