403Webshell
Server IP : 50.21.180.56  /  Your IP : 216.73.216.208
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : ws67922704 ( 67922704)
PHP Version : 8.5.13
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/usr/share/doc/libparse-recdescent-perl/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/usr/share/doc/libparse-recdescent-perl/examples/demo_errors.pl
use v5.10;
use warnings;


# THE ONLY TRUE MISTAKES ARE THE ONES YOU NEVER MAKE

#BEGIN {
#        close STDERR and open STDERR, '>./STDERR' or die $!;
#}
use Parse::RecDescent;

$grammar =
q{
        Para:     Sentence(s) /\Z/

        # Can also intercept the error messages like so: ##

           |    { use Data::Dumper 'Dumper';
                  print "$_->[0]\n" for @{$thisparser->{errors}};
                  exit;
                }

        Sentence: Noun Verb
                | Verb Noun
                | <error>

        Noun:     Fish
            |     Cat
            |     'dog'

        Verb:     'runs'

        Fish:     'fish'
            |     <error:Expected a fish!  But didn't get one>

        Cat:      'cat'
            |     <error:I wanna cat!>
};

$parse = new Parse::RecDescent ($grammar);

while (<DATA>)
{
        chomp;
        print "$_...\n";
    $parse->Para($_);
}

__DATA__
rat runs
dog runs
cat purrs
cat runs
mouse squeaks

Youez - 2016 - github.com/yon3zu
LinuXploit