2 parse_start : nil item(s? /[ \t\n]*/) nil eof
18 revision => int($item[4][0] or 0),
19 ranged => defined($item[5][0]) ? 1 : 0 }}
21 number_part : integer(s /\./)
22 { $return = $item[1] }
24 release_part : '_' release_spec integer(?)
26 $item[2], int($item[3][0] or 0) ] }
27 release_spec : 'alpha'
32 revision_part : '-r' integer
37 category : /[+\w][-+\w.]*/
38 package : /[+\w]+(?:-[+A-Za-z_][+\w]*)*/
40 name : category '/' package
44 package => $item[3] }}
47 { $return = $item[2] }
48 slot : /[+\w][-+\w.]*/
49 flag : /[\w][-+\w.@]*/
51 parse_pkg : package '-' version
54 version => $item[3] }}
56 compare : '<=' | '<' | '>=' | '>' | '=' | '~'
58 ext_atom : ('!!' | '!' | '') compare name '-' version slot_spec(?) use_spec(?)
61 bool => (not $item[1]) ? 1 : 0,
65 slot => $item[6][0] || '0',
66 use => $item[7][0] || [] }}
68 std_atom : ('!!' | '!' | '') name slot_spec(?) use_spec(?)
71 bool => (not $item[1]) ? 1 : 0,
73 slot => $item[3][0] || '0',
74 use => $item[4][0] || [] }}
76 atom : ext_atom | std_atom
78 item : atom | all_of | any_of | use_cond
80 list_elem : item whitespace
81 { $return = $item[1] }
82 list_spec : '(' whitespace list_elem(s?) ')'
83 { $return = $item[3] }
89 any_of : '||' whitespace list_spec
94 use_cond : ('!' | '') flag '?' whitespace list_spec
97 bool => ($item[1] eq '!') ? 0 : 1,
101 use_spec : '[' use_item(s? /,/) ']'
102 { $return = $item[2] }
103 use_item : ('!' | '') flag ('=' | '?')
106 bool => ($item[1] eq '!') ? 0 : 1,
112 bool => ($item[1] eq '-') ? 0 : 1,
115 whitespace : /[ \t\n]+/