Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Parsing with Perl 6

by jryan (Vicar)
on Jul 05, 2002 at 01:20 UTC ( [id://179555]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    - A header made up of:
        - the word function
        - a function name
        - an arguments list
    - A body made up of a block of code
    
  2. or download this
    - A header of:
        - the word while
        - a condition
    - A body of a block of code
    
  3. or download this
    - A header of:
        - the word for
    ...
            - a condition and then a semi-colon
            - an increment
    - A body of a block of code
    
  4. or download this
    - A header of the word do
    - A body of a block of code
    - A footer of:
        - the word while
        - a condition
    
  5. or download this
    - a header
    - a body
    - a block of code
    - a condition
    
  6. or download this
    $block = qr/
    \{
    ...
            | (??{ $block })
        )*
    \}
    
  7. or download this
    rule block {
        \{
    ...
        ]*
        \}
    }
    
  8. or download this
    rule block {
        \(
    ...
        ]*
        \)
    }
    
  9. or download this
    rule block ($left,$right) {
        $left
    ...
        ]*
        $right
    }
    
  10. or download this
    - start quote
    - string of (non-quote or backslashed quote) characters
    - end quote
    
  11. or download this
    rule quoted_string ($type) {
        "
    ...
        ]*
        "
    }
    
  12. or download this
    rule quoted_string ($type) {
        $type
    ...
        ]*
        $type
    }
    
  13. or download this
    rule string
    {
          <quoted_string ">
        | <quoted_string '>
    }
    
  14. or download this
    A single-line comment
    or
    A multi-line comment
    
  15. or download this
    rule single_line_comment {
        // \N*:
    }
    
  16. or download this
    - A leading /*
    - A string of characters that includes non asterix and astrix not foll
    +owed by a /
    - A closing */
    
  17. or download this
    rule multi_line_comment { 
        /\*
    ...
        ]*
        \*/
    }
    
  18. or download this
    rule block ($left,$right) {
        $left
    ...
        ]*
        $right
    }
    
  19. or download this
    @matches = $var =~ /(match)/g;
    
  20. or download this
    $var =~ m:e/@matches:=(match)/;
    
  21. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    
    sub catalog_simple  { ... }
    sub catalog_complex { ... }
    
  22. or download this
    
    use re 'eval';
    ...
    my $block;
    my $code = qr/ (??{$block = block ( "\{" , "\}" ); "$block"}) /x;
    my $cond = qr/ (??{$block = block ( "("  , ")"  ); "$block"}) /x;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://179555]
Approved by Zaxo
Front-paged by jeffa
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-29 08:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found