Re: [PEPr] Comment on PHP::Lexer
| From: | bertrand Gugger | Date: | Sat, 29 Jan 2005 03:14:21 +0000 |
| Subject: | Re: [PEPr] Comment on PHP::Lexer | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-35778@lists.php.net to get a copy of this message | ||
Hi Louis Mullie:
Proposal information: http://pear.php.net/pepr/pepr-proposal-show.php?id=197 I come quite right with:<?php require_once 'Lexer.php' ; $grammar = new Lexer_Grammar; $grammar->addIdent('CHAR', '[a-zA-Z]'); $grammar->addIdent('WORD', '{CHAR}+'); $grammar->addIdent('SEP', '\s'); $grammar->addIdent('PARW', '\({WORD}\)'); $lexer = new Lexer($grammar); $stack = $lexer->tokenize('AB A'); print_r($stack); $stack = $lexer->tokenize('A AB'); print_r($stack); $stack = $lexer->tokenize('A (AB)'); print_r($stack); ?> just never recognize AB as Word allways as 2 CHAR :( I would also like to recurse the token within themselves. à+ -- bertrand Gugger (toggg)