.
D 2009-06-29T20:21:56
J assignee msofer
J cmimetype text/plain
J comment Hello,\nThe\sman\spage\sfor\sparse(n)\s1.4\sis\sin\sa\ssad\sstate.\nI\ssuggest\sthe\sfollowing\scorrections:\n\n\s\s\s\s\s\s\s\s---\nContrary\sto\sthe\sdescription\sa\srange\sis\snot\sof\sthe\sform\s{first\slast}\sbut\srather\s{first\slength}.\sI\ssuggest\sthe\sfollowing\smodifications:\n\n1st\sparagraph:\s...\sand\sa\srange\sinto\sthe\sscript:\s{first\slength}.\sThe\scommand\sparses\sthe\sscript\sfrom\sthe\sfirst\sindex\sfor\s<i>length</i>\scharacters.\sFor\sconvenience\s<i>length</i>\scan\sbe\sset\sto\s<i>end</i>\swith\sthe\sobvious\smeaning.\n\nThen,\schange\sall\soccurrences\sof\n\s\s\s\s...\s[arg\sfirst]\s[arg\slast]\nto\n\s\s\s\s...\s<i>range</i>\n\n\s\s\s\s\s\s\s\s---\n\n2nd\sparagraph:\sTo\sthe\slist\sof\stokens\sadd\s'expand'\n\n\s\s\s\s\s\s\s\s---\n\n3rd\sparagraph:\sChange\sthe\stext\sto\n\nThe\s<i>first</i>\sindex\sis\streated\sthe\ssame\sway\sas\sare\sindices\sin\sthe\sTcl\sstring\scommand.\sAn\sindex\sof\s0\srefers\sto\sthe\sfirst\scharacter\sof\sthe\sstring.\sAn\sindex\sof\send\s(or\sany\sabbreviation\sof\sit)\srefers\sto\sthe\slast\scharacter\sof\sthe\sstring.\sIf\sfirst\sis\sless\sthan\szero\sthen\sit\sis\streated\sas\sif\sit\swere\szero,\sand\sif\s<i>first\s+\slength</i>\sis\sgreater\sthan\sor\sequal\sto\sthe\slength\sof\sthe\sstring\sthen\sit\sis\streated\sas\sif\sit\swere\send.\n\nif\syou\sfeel\sthat\sthis\sdescription\sis\scorrect.\n\n\s\s\s\s\s\s\s\s---\n\nRemove\sany\smention\sof\s'subcommand'\sin\sthe\sSynopsis\sand\sin\sthe\sdescription.\sIt\ndoes\snot\sexist\s(any\smore).\n\n\s\s\s\s\s\s\s\s---\n\nUnder\s'Name'\sat\sthe\stop\sof\sthe\spage\splease\scorrect\sthis\scut\s'n\spaste\serror\n\s\s\s\sparse\s-\sSystem\sto\scontrol\slogging\sof\sevents.\n\n\s\s\s\s\s\s\s\s---\n\n'parse\slist'\sgives\sweird\sresults.\sSee\sbelow.\n#\n#\s[parse\slist]\sdelivers\svery\scurious\sresults\swhen\s$range\sis\ssurrounded\n#\sby\sbraces\s(which\shappens\srather\soften\sin\sTcl)\s-\seven\sif\sthe\srange\n#\sselects\sonly\sthe\stext\swithin\sthe\sbraces.\n#\n#\sExample:\n#\s\s\s\s\s\s\sset\sscript\s{{foo\sbar\sbaz}}\s\s;#\sbraces\sare\spart\sof\sthe\sscript\n#\s\s\s\s\s\s\sparse\slist\s$script\s{1\s11}\s\s\s;#\s...\sbut\snot\spart\sof\sthe\srange\n#\s\s\s\s\s\s\s->\s{0\s5}\s{5\s3}\s{9\s3}\s\s\s\s\s\s\s\s;#\snote\sthe\s'0'\s-\soutside\sof\sthe\srange\s(!)\n#\n\nI\shave\sthe\sfollowing\swork-around:\sI\sdon't\shand\s'parse\slist'\sthe\soriginal\sscript\swith\sthe\soriginal\srange,\sbut\srather\sextract\sthe\stext\sfrom\sthe\srange\smyself\sand\spass\sit\sto\s'parse\slist'\swith\sa\srange\s{0\send}.\sLater\sI\sadjust\sthe\sresult(s)\sto\spoint\sat\sthe\scorrect\sposition\sin\sthe\sscript.\nMaybe\sa\squick\sfix\swould\sbe\sto\sjust\simplement\sthis\swork\saround\sat\sthe\sC\slevel.\n\nproc\sparseList\s{tree\snode\sscript\srange}\s{\n\s\s\s\sif\s{\s$range\seq\s""\s}\s{set\srange\s{0\send}}\n\s\s\s\sset\ssrc\s[parse\sgetstring\s$script\s$range]\n\s\s\s\sset\sorgStart\s[lindex\s$range\s0]\s\s\s\s\s\s;#\shere\sour\ssrc\sstarted\sin\sreality\n\s\s\s\s#\s'parse\slist'\sreturns\sthe\srange\sof\seach\selement\n\s\s\s\sset\sres\s[parse\slist\s$src\s{0\send}]\n\s\s\s\sfor\s{set\si\s0}\s{$i\s<\s[llength\s$res]}\s{incr\si}\s{\n\s\s\s\s\s\s\s\sset\sstart\s[lindex\s$res\s$i\s0]\n\s\s\s\s\s\s\s\slset\sres\s$i\s0\s[expr\s{$start\s+\s$orgStart}]\n\s\s\s\s}\n...\n\n\s\s\s\s\s\s\s\s---\n\nAdd\sa\sdescription\sof\swhat\sthe\s'countnewline'\ssubcommand\sdoes\sand\swhat\sparameters\sit\sexpects.\n\nBest\sregards\nHelmut\sGiese\n\n
J foundin None
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter hgiese
J subsystem 45.\sParsing\sand\sEval
J title Documentation\sfor\sTclParser\sis\snot\sgood
J type Bug
K 2814219fffffffffffffffffffffffffffffffff
U hgiese
Z 2e2090f41f7b045da5fb19fdb6a686f5