[dev-context] bug in processeparatedlist

Vit Zyka vit.zyka at gmail.com
Sat Mar 8 01:02:56 CET 2008


Hi,

there is a bug in \doprocessseparatedlist (syst-ext.tex). Problem is if 
a list item starts with a single_char followed by a space. See line 5:

----------------------------------------------
\starttext
\def\Do#1{(#1)}
   1\processseparatedlist[{aap noot}]  [ ]\Do \par
   2\processseparatedlist[{aap} {noot}][ ]\Do \par
   3\processseparatedlist[aap {noot}]  [ ]\Do \par
   4\processseparatedlist[aap noot]    [ ]\Do \par
   5\processseparatedlist[aap;noot;a noot;noot a; noot a noot][;]\Do \par
   6\processseparatedlist[][;]\Do \par
   7\processseparatedlist[;][;]\Do \par
\stoptext
-------------------------------------------------

it returns
   (aap noot)
   (aap)(noot)
   (aap)(noot)
   (aap)(noot)
   (aap)(noot)noot(a)(noot a)(noot a noot)
              ^^^^^^^

Solution:
\def\doprocessseparatedlist#1]#2[#3]#4%
   {\def\dodoprocessseparatedlist##1##2#3%
      {\def\tmp{##2}% ------------------------------- new
       \if]##1%
         \let\dodoprocessseparatedlist\relax
       \else\if]##2%
         \let\dodoprocessseparatedlist\relax
       %\else\ifx\blankspace##2%
       \else\ifx\blankspace\tmp % ------------------- new
         #4{##1}%
       \else
         #4{##1##2}%
       \fi\fi\fi
       \dodoprocessseparatedlist}%
    \@EA\dodoprocessseparatedlist\gobbleoneargument#1#3]#3}

Best
Vit



More information about the dev-context mailing list