Changeset 3539

Show
Ignore:
Timestamp:
05/21/05 00:01:59 (4 years ago)
Author:
duff
svk:copy_cache_prev:
5107
Message:

* Changed some wording and spacing of docs/quickref/rules
* Added text about <?assertions> and the <-...> and <+...> forms of character class

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • docs/quickref/rules

    r3519 r3539  
    88    String      Stringifies to entire match 
    99    Number      The numeric value of the matched string (i.e. given  
    10                 "foo123bar"~~/\d+/, then $/ in numeric context will be 123) 
     10                "foo123bar"~~/\d+/, then $/ in numeric context will be 123) 
    1111    Boolean     True if success, false otherwise 
    1212 
     
    5151 
    5252Built-in assertions: 
    53     <[...]>             Matches ... as a character class 
    5453    <'...'>             Matches ... as a literal string 
     54    <"...">             Matches ... as a literal string (after interpolation) 
    5555    <sp>                Matches a literal space 
    5656    <ws>                Matches any sequence of whitespace, like the :w modifier 
     
    7070    <self>              Matches the same pattern as the current rule 
    7171                        (useful for recursion) 
    72     <!pattern>          Matches anything which *doesn't* match pattern 
    73      
     72    <!XXX>              Zero width assertion that XXX *doesn't* match at  
     73                        this location 
    7474    <alnum>             Alphanumeric character 
    7575    <alpha>             Alphabetic character 
     
    8080    <graph>             An alphanumeric character or punctuation 
    8181    <lower>             Lowercase character 
    82     <print>             Printable character -- alphanumeric, punctuation or whitespace 
     82    <print>             Printable character -- alphanumeric, punctuation or  
     83                        whitespace 
    8384    <space>             Whitespace character ([\s\ck]) 
    8485    <upper>             Uppercase character 
    8586    <word>              Word character (alphanumeric + _) 
    8687    <xdigit>            Hexadecimal digit 
     88 
     89Named rules are stored in the match object unless the rule name is 
     90prefixed with a ? 
     91 
     92    /<?item> <quantity> <price>/ 
     93 
     94would store values in $/{'quantity'} and $/{'price'} but not $/{'item'} 
     95 
     96Character classes: 
     97    <[abcd]>            Matches one of the characters a,b,c, or d.  Ranges 
     98                        may be used as <[a..z]>.  Can be combined with +  
     99                        and - like so: <[a..z]-[m..p]> (which is the same 
     100                        as <[a..l]+[q..z]>) 
     101    <-XXX>              Matches XXX as a negated character class.  For 
     102                        instance, <-alpha> would match one non-alpha 
     103                        character. May also be combined as above.  
     104                        (<-alpha+[qrst]> will match any non-alpha character 
     105                        and the characters q,r,s, and t) 
     106    <+XXX>              Matches XXX as a character class. <+alpha> matches 
     107                        one alpha character. 
    87108 
    88109Hypothetical variables: 
     
    112133     
    113134        / %x := [ (\S+)\: \s* (.*) ]* / # key/value pairs 
    114         # $1 = list of keys 
    115         # $2 = list of values 
     135        # $0 = list of keys 
     136        # $1 = list of values 
    116137         
    117138        / %x := [ (\S+) \s* ]* /        # capture only keys, values = undef