Jump to content

Tokens


play_

Recommended Posts

I'm trying to build my own syntax hiliter, and someone suggested i use tokenizers instead of regexps to hilite code.
Can anyone point me to any direction on this?
Totally lost here. Not even 100% sure what tokenizers are.
I have here a list of php tokens [url=http://dk2.php.net/manual/en/tokens.php]http://dk2.php.net/manual/en/tokens.php[/url].. but what would i do with it?
Link to comment
https://forums.phpfreaks.com/topic/33724-tokens/
Share on other sites

[quote author=redbullmarky link=topic=121916.msg503047#msg503047 date=1168606551]
would the [url=http://uk2.php.net/manual/en/function.highlight-string.php]highlight_string[/url] function help for what you're trying to do?
[/quote]

Nope.
It would if i was only hilighting php code.
However, since it's a pastebin, users will be submitting different language's codes.
Therefore i have to create my own method for hiliting.

I was going to go with regexps, but someone suggested using a tokenizer instead, but i can't find much info on it
Link to comment
https://forums.phpfreaks.com/topic/33724-tokens/#findComment-159042
Share on other sites

to be honest, this probably IS a job for regular expressions, not the tokenizer - especially as you state that it'll not just be PHP code that's highlighted. the tokenizer functions mentioned previously here are relevent to PHP tokens only and not, for example, Perl, C, ASP, etc, etc.
Link to comment
https://forums.phpfreaks.com/topic/33724-tokens/#findComment-159043
Share on other sites

a google search for '[url=http://www.google.co.uk/search?client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial&channel=s&hl=en&q=syntax+highlight+php&meta=&btnG=Google+Search]syntax highlight php[/url]' came up with:

http://qbnz.com/highlighter/

you might want to look at some of the other results there, too...
Link to comment
https://forums.phpfreaks.com/topic/33724-tokens/#findComment-159087
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.