Double syntax context switch

Leonard den Ottolander leonard at den.ottolander.nl
Sat Apr 16 08:46:55 UTC 2005


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





More information about the mc-devel mailing list