|
From: Benny B. <Ben...@gm...> - 2009-11-07 19:32:47
|
Hi,
Am 07.11.2009 19:24, schrieb Mercurio X:
> Hi
>
> I'd like to get Geshi to colourise compiler pragmas which have start and end delimiters.
>
> For example, Pascal has (*$ some-pragma *) and Modula-2 has <* some-pragma *>.
>
> If I use the multi-line comment section, then pragmas get colourised the same as multi-line comments. There seems to be no way to colourise different types of multi-line comments differently as there is for different single-line comments.
>
You can use different colors for multiple comment styles when using
COMMENT_REGEXP. But you're right on the simple COMMENT_MULTI: There's
only one style with the normal syntax. I'm not sure though if the
advanced array(1=><array('start', 'end'), 2=>array('another', 'type'))
syntax had been implemented. but usually you'd prefer the COMMENT_REGEXP
over this anyways.
> I also tried the regexp section but for some reason Geshi does not seem to like angular brackets inside regex.
>
You must distingguish between COMMENT_REGEXP and plain REGEXP as
COMMENT_REGEXP are evaluated as part of comment processing (quite at the
start), but REGEXP are evaluated nearly at the end. Thus if you want to
"hide" things from GeSHi processing you probably want to go with the
COMMENT_REGEXP.
> When I define
>
> "\*(.*)\*"
>
> that matches any string that starts and ends with an asterisk.
>
> However, if I define
>
> "<\*(.*)\*>"
>
> that does not match any strings that start with <* and end with *>
>
REGEXP are applied on htmlspecialchars escaped strings (this is
documented IIRC) and thus you'd have to look for < and > in your
regexp. COMMENT_REGEXP on the other hand are applied to the plain
string. Have a look at the parser implementation in parse_code and
parse_non_string_part in geshi.php.
> I also tried to double the backslash, but that didn't work either.
>
> Is there anything that makes Geshi reject angular brackets in regex?
>
See above.
> Can somebody shed some light on what's going on there?
>
The source is commented quite well on these internal processings.
> thanks in advance.
>
Regards,
BenBE.
|