App-Navegante

 view release on metacpan or  search on metacpan

bin/navegante  view on Meta::CPAN

#!/usr/bin/perl5.12
####################################################################
#
#    This file was generated using Parse::Yapp version 1.05.
#
#        Don't edit this file, use source file instead.
#
#             ANY CHANGE MADE HERE WILL BE LOST !
#
####################################################################
package Navegante;
use vars qw ( @ISA );
use strict;

@ISA= qw ( Parse::Yapp::Driver );
use Parse::Yapp::Driver;



sub new {
        my($class)=shift;
        ref($class)
    and $class=ref($class);

    my($self)=$class->SUPER::new( yyversion => '1.05',
                                  yystates =>
[
	{#State 0
		DEFAULT => -19,
		GOTOS => {
			'actions' => 1,
			'f' => 2
		}
	},
	{#State 1
		ACTIONS => {
			"proc" => 3,
			"feedback" => 5,
			"protect" => 4,
			"save" => 6,
			"formtitle" => 7,
			"desc" => 9,
			"livefeedback" => 10,
			"proctags" => 11,
			"iform" => 12,
			"init" => 14,
			"mail" => 13,
			"annotate" => 15,
			"quit" => 16,
			'FIM' => 17,
			"iframe" => 18,
			"filename" => 19
		},
		DEFAULT => -3,
		GOTOS => {
			'fop' => 8
		}
	},
	{#State 2
		ACTIONS => {
			'' => 20
		}
	},
	{#State 3
		ACTIONS => {
			'STRING' => 21
		}
	},
	{#State 4
		ACTIONS => {
			'STRING' => 22
		}
	},
	{#State 5
		ACTIONS => {
			'STRING' => 23
		}
	},
	{#State 6
		ACTIONS => {
			'STRING' => 24
		},
		GOTOS => {
			'actarg' => 25
		}
	},
	{#State 7
		ACTIONS => {
			'STRING' => 26
		}
	},
	{#State 8
		DEFAULT => -1
	},
	{#State 9
		ACTIONS => {
			'STRING' => 27
		}
	},
	{#State 10
		ACTIONS => {
			'STRING' => 28
		}
	},
	{#State 11
		ACTIONS => {
			'STRING' => 29
		}
	},
	{#State 12
		ACTIONS => {

bin/navegante  view on Meta::CPAN

{+{ %{$_[1]}, save => $_[3]}}
	],
	[#Rule 5
		 'actions', 3,
sub
#line 7 "lib/App/Navegante.yp"
{+{ %{$_[1]}, mail => $_[3]}}
	],
	[#Rule 6
		 'actions', 3,
sub
#line 8 "lib/App/Navegante.yp"
{+{ %{$_[1]}, init => $_[3]}}
	],
	[#Rule 7
		 'actions', 3,
sub
#line 9 "lib/App/Navegante.yp"
{+{ %{$_[1]}, desc => $_[3]}}
	],
	[#Rule 8
		 'actions', 3,
sub
#line 10 "lib/App/Navegante.yp"
{+{ %{$_[1]}, proc => $_[3]}}
	],
	[#Rule 9
		 'actions', 3,
sub
#line 11 "lib/App/Navegante.yp"
{+{ %{$_[1]}, proctags => $_[3]}}
	],
	[#Rule 10
		 'actions', 3,
sub
#line 12 "lib/App/Navegante.yp"
{+{ %{$_[1]}, livefeedback => $_[3]}}
	],
	[#Rule 11
		 'actions', 3,
sub
#line 13 "lib/App/Navegante.yp"
{+{ %{$_[1]}, feedback => $_[3]}}
	],
	[#Rule 12
		 'actions', 3,
sub
#line 14 "lib/App/Navegante.yp"
{+{ %{$_[1]}, annotate => $_[3]}}
	],
	[#Rule 13
		 'actions', 3,
sub
#line 15 "lib/App/Navegante.yp"
{+{ %{$_[1]}, iform => $_[3]}}
	],
	[#Rule 14
		 'actions', 3,
sub
#line 16 "lib/App/Navegante.yp"
{+{ %{$_[1]}, iframe => $_[3]}}
	],
	[#Rule 15
		 'actions', 3,
sub
#line 17 "lib/App/Navegante.yp"
{+{ %{$_[1]}, quit => $_[3]}}
	],
	[#Rule 16
		 'actions', 3,
sub
#line 18 "lib/App/Navegante.yp"
{+{ %{$_[1]}, formtitle => $_[3]}}
	],
	[#Rule 17
		 'actions', 3,
sub
#line 19 "lib/App/Navegante.yp"
{+{ %{$_[1]}, filename => $_[3]}}
	],
	[#Rule 18
		 'actions', 3,
sub
#line 20 "lib/App/Navegante.yp"
{+{ %{$_[1]}, protect => $_[3]}}
	],
	[#Rule 19
		 'actions', 0,
sub
#line 21 "lib/App/Navegante.yp"
{+{}}
	],
	[#Rule 20
		 'actarg', 1,
sub
#line 24 "lib/App/Navegante.yp"
{ +{arg=>$_[1]}}
	],
	[#Rule 21
		 'actarg', 3,
sub
#line 25 "lib/App/Navegante.yp"
{ +{arg=>$_[1], feedback => $_[3] }}
	]
],
                                  @_);
    bless($self,$class);
}

#line 28 "lib/App/Navegante.yp"


package App::Navegante;
use lib './lib/';
use CGI qw( :all :nodebug);
use Data::Dumper;
use App::Navegante::CGI;

my $File;
my $t = parseFile();

bin/navegante  view on Meta::CPAN

geraCgi($t);

sub preparafiles{
  my $a= shift;
  if($a->{save} && !-e $a->{save}{arg}){
      open(F,">$a->{save}{arg}") or die ("cant create $a->{save}{arg}\n");
      print F "##Created by FormLang\n";
      close F;
      chmod (0666,$a->{save}{arg})
  }
}

sub geraCgi{
    my %args = (%{$_[0]{action}}, PERL=>$_[0]{perl});
    my $t = App::Navegante::CGI->new(%args);

    if( defined $_[0]{action}{filename}) {
        open(F,">$_[0]{action}{filename}") or die ("cant create $_[0]{action}{filename}");
        print F $t->createCGI();
        close(F);
        chmod(0755,$_[0]{action}{filename});
    }
    else {
        print $t->createCGI();
    }
}

sub yyerror {
  if ($_[0]->YYCurtok) {
      printf STDERR ('Error: a "%s" (%s) was fond where %s was expected'."\n",
         $_[0]->YYCurtok, $_[0]->YYCurval, $_[0]->YYExpect)
  }
  else { print  STDERR "Expecting one of ",join(", ",$_[0]->YYExpect),"\n";
  }
}

sub parseFile {
  my $p = new Navegante();
  init_lex();
  $p->YYParse(
      yylex   => \&lex,
      yyerror => \&yyerror
  );
}

sub init_lex{
 local $/;
 undef $/;
 $File = <>
}


sub lex{
 for($File){
   s!^\s+!!;
   if($_ eq "")             {    return ("","") }
   s!^\(([^)]+)\)!!          and return("STRING",$1);
   s!^([\{\}\[\];+*/,:])!!   and return($1,$1);
   s!^\((.*?)\)!!            and return("ARG",$1);
   s!^##(.*)$!!s             and return("FIM",$1);
   s!^(init|desc|formtitle|save|mail|filename|feedback|proc|proctags|livefeedback|annotate|iform|iframe|quit|protect)\b!!
                             and return($1,$1);
   s!^(\w+)!!                and return("ID",$1);

   print STDERR "Simbolos desconhecidos '$File'\n" ;
 }
}

1;



( run in 0.771 second using v1.01-cache-2.11-cpan-2e0ccfb7a10 )