The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Hi,
I'd like to setup BB code for a programming language in a similar fashion to the way its done for php (e.g. PHP Code:
Also I've seen some sites which do syntax highlighting of code is this hard? thanks |
#2
|
|||
|
|||
![]()
no -one?
|
#3
|
|||
|
|||
![]()
You would have to find a PHP script that does the syntax highlighting for the language in question. That's the hard part. Once you have that, hanging it off of a bbcode is the simple part.
|
#4
|
|||
|
|||
![]()
would that not be fairly straight forward, just send the post to function, which parses it looking for keywords, and then replacing the keyword with A BBCODE for different colours?
You think it would be easy to "hang it off" vb? |
#5
|
|||
|
|||
![]() Quote:
It is not as simple as looking for keywords. If you did that, you would incorrectly highlight keywords within strings, as in: $variable = "foreach $string } ?> "; You must be able to break the input into a syntactically correct stream of tokens, then parse the tokens into a semantically correct series of language constructs, such as statements and expressions. |
#6
|
|||
|
|||
![]() Quote:
Quote:
Ultimately i dont see why it wouldn't be as easy as copying the current VB php pharser and modifying the keyword, so as to suit the chosen language? If i were to pay for a hack like this, how much would it cost do you think? |
#7
|
|||
|
|||
![]()
There is nothing you can copy and modify. There is no "VB php parser". It uses the highlight_string function that comes as part of PHP.
This is not as easy as you think. Any simple methods are doomed to produce silly results. |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|