Re: Help w/ Parser
| From: | Keloran | Date: | Mon, 07 Nov 2011 09:12:01 +0000 |
| Subject: | Re: Help w/ Parser | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-56087@lists.php.net to get a copy of this message | ||
this looks cool if you get it to work, move the object-orientation forwards
quite abit
On Mon, Nov 7, 2011 at 6:11 AM, Nikita Popov <nikita.ppv@googlemail.com>wrote:
> I don't see an attachment. Could you send it again with .txt as file
> extension?
>
> If you want 'get' to be recognized as T_GET you need to define such a
> token in the lexer (zend_language_scanner.l). Did you do that?
>
> On Mon, Nov 7, 2011 at 3:53 AM, <php-dev@zerocue.com> wrote:
> > I’m having trouble getting some changes to the parser to recognize some
> new
> > syntax. I’ve attached a patch of what I’ve done.
> >
> >
> >
> > Here is the syntax I am trying to get to be parsed properly:
> >
> > <?php
> >
> > class TimePeriod {
> >
> >
> >
> > public $Seconds;
> >
> >
> >
> > public function __construct($Seconds) {
> >
> > $this->Seconds = $Seconds;
> >
> > }
> >
> > // Getters/Setters
> >
> > public $Hours {
> >
> > get { return $this->Seconds / 3600; }
> >
> > set { $this->Seconds = $value * 3600; } // The variable $value
> > holds the incoming value to be "set"
> >
> > }
> >
> > };
> >
> > ?>
> >
> >
> >
> > After compiling and attempting to execute the above PHP file, I’m getting
> > this parse error:
> >
> >
> >
> > Parse error: syntax error, unexpected 'get' (T_STRING), expecting get
> > (T_GET) or set (T_SET) in /mnt/hgfs/svn/php-src-test/test.php on line 13
> >
> >
> >
> > Why is the parse recognizing the ‘get’ as T_STRING rather than get
> (T_GET)?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > -Clint
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>