I'm rewriting the highlight_file/string methods in userland code (using the
tokenizer) because I've found the native functions painful.
It is difficult to insert line numbering properly, and have accurate
function referencing - most pastebins now use PEAR's Text_Highlight to
highlight the code with a bunch of intensive preg_matches. Hopefully this
can be updated one day (though according to the bug reports it caused
segfaults with the current implementation), but until then I thought this
may be useful.
I'm almost finished:
http://aidan.dotgeek.org/lib/?file=PHP_Highlight.php
My problem is the token2color method, I'm not sure which tokens are classed
as keywords. At the moment I've just guessed as many as I could think of,
it's a bit ugly - presuming there is an easier way to do it.
I've had a look through zend_highlight.c and found that anything with
token.type = 0 is highlighted as a keyword, however I'm unable to track down
where token.type is set.
Is anyone able to provide some insight?
King Regards,
Aidan Lister
My problem is the token2color method, I'm not sure which tokens are
classed as keywords. At the moment I've just guessed as many as I
could think of, it's a bit ugly - presuming there is an easier way to
do it.
Appendix N. List of Parser Tokens in php manual
rash
Hi Robert,
I think you'll find it's Appendix P. I recently documented all the PHP 5
additions to that page, my problem is not getting a list of tokens,
http://lxr.php.net/source/php-src/ext/tokenizer/tokenizer.c#167
It's getting a list of tokens for which token.type IS_NULL.
Thanks, though...
Aidan
"Robert Janeczek" rashid@ds.pg.gda.pl wrote in message
news:20041111113902.46337.qmail@pb1.pair.com...
My problem is the token2color method, I'm not sure which tokens are
classed as keywords. At the moment I've just guessed as many as I
could think of, it's a bit ugly - presuming there is an easier way to
do it.Appendix N. List of Parser Tokens in php manual
rash