RE: Trouble with zend_language_parser.y
| From: | Clint Priest | Date: | Wed, 02 May 2012 13:23:43 +0000 |
| Subject: | RE: Trouble with zend_language_parser.y | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-60423@lists.php.net to get a copy of this message | ||
Anyone have any help with this?
$1 of the first T_ISSET is matching against "\n\t\tisset {..." (... being the rest of the
set body through to the end of the script.
-----Original Message-----
From: Clint Priest [mailto:cpriest@zerocue.com]
Sent: Wednesday, April 25, 2012 10:41 PM
To: internals@lists.php.net
Subject: [PHP-DEV] Trouble with zend_language_parser.y
I'm having some trouble setting up the re2c to allow the isset/unset. Here are the
definitions, I've added the two T_ISSET statements:
------------------------------------------------------------
accessors:
accessor_function
accessor_function
accessor_function
accessor_function
| accessor_function
accessor_function
accessor_function
| accessor_function
accessor_function
| accessor_function
| /* Empty */
;
accessor_modifiers:
/* empty */
{ Z_LVAL($$.u.constant) = CG(access_type); }
| non_empty_accessor_modifiers { $$ = $1; }
;
non_empty_accessor_modifiers:
accessor_modifier
{ $$ = $1; }
| non_empty_accessor_modifiers accessor_modifier {
Z_LVAL($$.u.constant) = zend_do_verify_access_types(&$1, &$2); }
accessor_modifier:
T_PUBLIC
{ Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
| T_PROTECTED {
Z_LVAL($$.u.constant) = ZEND_ACC_PROTECTED; }
| T_PRIVATE {
Z_LVAL($$.u.constant) = ZEND_ACC_PRIVATE; }
| T_STATIC
{ Z_LVAL($$.u.constant) = ZEND_ACC_STATIC; }
| T_FINAL
{ Z_LVAL($$.u.constant) = ZEND_ACC_FINAL; }
;
accessor_function:
T_ISSET
{ Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC;
zend_do_begin_accessor_declaration(&$1, CG(accessor_node), &$$, 0 TSRMLS_CC); }
'{' inner_statement_list
'}'
{ zend_do_end_accessor_declaration(&$1,
CG(accessor_node), &$$, &$3 TSRMLS_CC); }
| T_ISSET
{ Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC;
zend_do_begin_accessor_declaration(&$1,
CG(accessor_node), &$$, 0 TSRMLS_CC);
zend_do_end_accessor_declaration(&$1,
CG(accessor_node), &$$, NULL TSRMLS_CC);
}
';'
| accessor_modifiers is_reference T_STRING
{ zend_do_begin_accessor_declaration(&$3,
CG(accessor_node), &$1, $2.op_type TSRMLS_CC); }
'{' inner_statement_list
'}'
{ zend_do_end_accessor_declaration(&$3,
CG(accessor_node), &$1, &$5 TSRMLS_CC); }
| accessor_modifiers is_reference T_STRING
{
zend_do_begin_accessor_declaration(&$3,
CG(accessor_node), &$1, $2.op_type TSRMLS_CC);
zend_do_end_accessor_declaration(&$3,
CG(accessor_node), &$1, NULL TSRMLS_CC);
}
';'
;------------------------------------------------------------
Here is the PHP it's trying to parse:
public $Hours {
get {
echo "Getting Hours\r\n";
return $this->Seconds / 3600;
}
set { // The variable $value holds the incoming value to be
"set"
echo "Setting Hours to {$value}\r\n";
$this->Seconds = $value * 3600;
}
isset { return $this->Seconds != NULL; }
unset { $this->Seconds = NULL; }
}
$1 of the first T_ISSET is matching against "\n\t\tisset {..." (... being the rest of the
set body through to the end of the script.
What's going on here?