Re: Double syntax context switch



i should say first off that the syntax highlighting
cannot have a bug because i have defined the
specification as being the current implementation.
(at least as far as cooledit is concerned.)

-> this may sound stupid, but remember that many syntax
files are now written using quirks of the current
syntax highlighting code. "fixing" bugs could stop
nice syntax rules from working elsewhere.

i have found that i can generally always provide
USEFUL colours if i fiddle with the rules enough.

the syntax code is meant to work on-the-fly (i.e.
be really fast) and provide colours helpful to the
programmer. it is not meant perfect.

having said that, ADDING new features specific to
a language would be useful.

try:

context default
    keyword whole echo brightmagenta/20

context " " green/7
    keyword \\" brightgreen/15
    keyword \\' yellow/24
    keyword ' brightred/19

context ' ' brightgreen/15
    keyword \\' brightgreen/15
    keyword \\" brightred/19
    keyword " brightcyan/16

it works great.

best wishes

-paul


On 2005.04.16 10:46 Leonard den Ottolander wrote:
> Hello list, Paul,
> 
> I've been looking at this problem a couple of weeks ago, but couldn't
> come up with a solution (yet). Sadly the syntax code is not very well
> documented, so although I somewhat understand what happens I can't put
> my finger on the exact location of the problem. It appears the code
> still looks for a possible context switch right after one has happened,
> which it shouldn't.
> 
> Try the following example (I noticed this oddity while hacking
> phpMyAdmin):
> 
> $ cat /usr/share/mc/syntax/php.syntax
> context default
>     keyword whole echo brightmagenta
>     keyword " green
>     keyword ' brightgreen
> 
> context exclusive " " green
>     keyword \\" brightgreen
>     keyword \\' yellow
>     keyword ' brightred
> 
> context exclusive ' ' brightgreen
>     keyword \\' brightgreen
>     keyword \\" brightred
>     keyword " brightcyan
> 
> $ cat test.php
> <?php
>     echo '"';
>     echo "'";
> ?>
> 
> See the double context switch which doesn't happen when an extra
> character is added to the strings:
> 
> $ cat test.php
> <?php
>     echo '" ';
>     echo " '";
> ?>
> 
> I verified that this issue also exists in the latest version of CoolEdit
> (as for a few weeks).
> 
> By the way Paul, I'm not sure how active you are currently developing
> CoolEdit, but if so you should have a look at the midnight commander.
> F.e. we introduced a memory fix to allow much larger context files. The
> proposed solution in Savannah bugzilla was buggy but Jakub Jelinek fixed
> the logic and we can now handle syntax files of in indefinite size.
> 
> Leonard.
> 
> -- 
> mount -t life -o ro /dev/dna /genetic/research
> 
> 
> 
Paul Sheer . . . . . . . . . . . . . . . . .  Tel  . . +27 (0)21 6869634
Email . . . http://2038bug.com/email.gif . . . . . . . . . . . . . . . .
http://www.icon.co.za/~psheer . . . . . . . . .  http://rute.2038bug.com
L I N U X . . . . . . . . . . . . . . . . The Choice of a GNU Generation



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]