Wednesday, 14 March 2012

Re: [GeSHi-devel] error in geshi parser (or language file) ?

Benny Baumann wrote:
Hi,

I'll have to dig into this one, but usually this kind of bug arises from a problem with the regexps used inside the language file. Especially the ones used in the ini.php (and the ones in php.php) are quite nasty sometimes; thus good knowledge of PCRE is advised ;-)

I think I have a convincing explanation for this case:
1. geshi adds a whitespace at the beginning of file before starting the parsing
2. while parsing (regexp parts), my code matches that whitespace, and geshi replaces it with a "<span etc...> </span>" tag
3. after parsing is done, geshi removes the added whitespace at the beginning of file. Except that this is not a whitespace anymore but a "<" character


Am 13.03.2012 18:34, schrieb Gaetano Giunta:
I am using the language file attached to validate the ini settings files of eZ Publish (tested on geshi 1.8.6 and 1.8.10).

It mostly works, but when I try to analyze the following file (2 lines):

[RegionalSettings] TranslationExtensions[]=monextension  
I get the following output:
span style="background-color: yellow;"> <span style="">&#91;</span></span>RegionalSettings<span style="">&#93;</span>...   IE. in the results the opening angle bracket for "span" is missing.
I remember there was a bug showing simular behaviour years ago. As mentioned above: I've to dig into this a little.
 This does not happen if there is eg. an empty line at the beginning of the file being highlighted. Is it due to a bug in the parser itself, or is something wrong with the language definition?
Hard to say off-hand, but I guess probably the parser has some trouble. I'll come back with more details as they are found.
  Thanks Gaetano  ps: any chance to get the ezini and eztemplate language definitions included in the next release? I submitted them a long time ago...
Since 1.0.8.10 quite some time went by and I'm still working to fetch up on the releases. Seems as if
- either I missed that mail
- there was some problm in the language file (which usually leads to a small mail about the issue asking to try fixing it (usually accompanied with some hints).

IDK what's it in this case ^^ Though I'll review the language files. If you verified them against the langcheck.php they should be okay.

Best regards,
BenBE.


No comments:

Post a Comment