Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Why won't this basic Parse::RecDescent example work?

by 7stud (Deacon)
on Jan 30, 2013 at 00:33 UTC ( #1015944=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $grammar = <<'END_OF_GRAMMAR';
    
    ...
        id: m{ \d+ }xms
    
    END_OF_GRAMMAR
    
  2. or download this
    my $text = "employee Joe 10";
    
    ...
    
    defined $parser->employee_info($text) 
        or die "Text doesn't match";
    
  3. or download this
    my $grammar = <<'END_OF_GRAMMAR';
    
    ...
    
    END_OF_GRAMMAR
    
  4. or download this
    
    use strict; 
    ...
    employee
    Joe
    10
    
  5. or download this
        myrule: brace_clause
                            
        brace_clause: '{' word '}'
    
        word: m{ [a-z]+ }xms
    
  6. or download this
        myrule: brace_clause
                            
    ...
                      { print "$_\n" for @item; }
    
        word: m{ [a-z]+ }xms
    
  7. or download this
    brace_clause   #the rule name
    {              #the match for '{'
    hello          #the match for word 
    }              #the match for '}'
    
  8. or download this
        myrule: brace_clause
                { print "$_\n" for @item; }
    ...
        brace_clause: '{' word '}'
    
        word: m{ [a-z]+ }xms
    
  9. or download this
    myrule
    { hello }
    
  10. or download this
    myrule
    }
    
  11. or download this
        myrule: brace_clause
                { print "$_\n" for @item; }
    ...
    myrule
    { hello }
    
  12. or download this
    my $grammar = <<'END_OF_GRAMMAR';
        
    ...
        
    
    END_OF_GRAMMAR
    
  13. or download this
    my $grammar = <<'END_OF_GRAMMAR';
    
    ...
            ];
    
    
  14. or download this
    use strict; 
    use warnings; 
    ...
            ];
    
    
  15. or download this
        employee_info:  'employee' 
                         name
    ...
                         
        name: m{ \S+ }xms
        id: m{ \d+ }xms
    
  16. or download this
        employee_info:  'employee' 
                         name
                         { say $item[1]; }
                         id
                         { say $item[3] }  #print match for id
    
  17. or download this
    my $grammar = <<'END_OF_GRAMMAR';
        
    ...
        }
    
    ...
    
  18. or download this
      my $grammar = <<'END_OF_GRAMMAR';
        
    ...
    
    
    ...
    
  19. or download this
    Unknown starting rule (Parse::RecDescent::namespace000001::startrule) 
    +called
     at 3.pl line 76.
    
  20. or download this
    defined $parser->another_rule($text) 
        or die "Text doesn't match";
    
  21. or download this
    
        word_list: word(s /,/)
     
        word : m{ [^,]+ }xms
    
  22. or download this
    
        word_list:  word(s /,/)
    ...
    
        word : m{ [^,]+ }xms
    
  23. or download this
    $VAR1 = [
              'word_list',
    ...
                'mars'
              ]
            ];
    
  24. or download this
    my $grammar = <<'END_OF_GRAMMAR';
    
    ...
              ]
            ];
    
  25. or download this
        some_rule_name:  'hello' word(s /,/)
    
        word : m{ [^,]+ }xms
    
  26. or download this
        $item{'word(s /,/)'}
    
  27. or download this
        $item[-1]
    
  28. or download this
    
    $VAR1 = [
    ...
              ]
            ];
    
  29. or download this
        cmd_choices: 'commands->' quoted_string(s)    
                     { 
    ...
    --output:--
    go to
    stop
    
  30. or download this
    use strict; 
    use warnings; 
    ...
              'phone_numbers' => '10'
            };
    
  31. or download this
    my $text = <<'END_OF_TEXT';
    {{ hello }}
    ...
        lbrace: / [{] /xms
    
    END_OF_GRAMMAR
    
  32. or download this
    
    my $text = <<'END_OF_TEXT';
    ...
    
    END_OF_GRAMMAR
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015944]
help
Chatterbox?
[Corion]: ambrus: AnyEvent(::HTTP) doesn't integrate well with Prima, that's my main problem
[Corion]: There is a weirdo shim because there is a POE integration for Prima, and if you use that, you can use the POE adapter of AnyEvent. What I'd want is something transport agnostic that parses HTTP or produces HTTP output, so that the communication with ...
[Corion]: ... the socket is done by my code. Ideally that module would not be based on callbacks ;)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2016-12-07 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (130 votes). Check out past polls.