php-peg icon indicating copy to clipboard operation
php-peg copied to clipboard

Group names inside rules sometimes don't work as expected

Open ksmolyanin opened this issue 14 years ago • 0 comments

Group names inside rules sometimes don't work as expected because they do not share params with other parts of the rule. Example: unknown_attribute: name:simple_name pws ":" pws value:(expression | identifier) function name (&$res, $sub) { $res['content'][] = '"'; $res['content'][] = $sub['text']; } function value (&$res, $sub) { //$res['content'][] = $sub['text']; // <-- thist works good, but I don't need it $res['content'][] = $sub['content']; // <-- this doesn't work because it doesn't know what is $sub['content'] } There is workaround: unknown_attribute: name:simple_name pws ":" pws (value:expression | value:identifier) function name (&$res, $sub) { $res['content'][] = '"'; $res['content'][] = $sub['text']; } function value (&$res, $sub) { $res['content'][] = $sub['content']; } Pay attention to "value:" name in both examples

ksmolyanin avatar Jul 28 '11 10:07 ksmolyanin