Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/foreach?V=12
QUERY_STRINGV=12
CONTENT_TYPE
DOCUMENT_URI/revision/foreach
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR108.162.216.225
REMOTE_PORT58156
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.145.194.57
HTTP_CF_RAY88654244b85203b4-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP3.145.194.57
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit foreach foreach\ -\ Iterate\ over\ all\ elements\ in\ one\ or\ more\ lists\n\n'''foreach'''\ ''varname\ list\ body''\n**\ Synopsis\ **\n'''foreach'''\ ''varlist1\ list1\ ?varlist2\ list2\ ...?\ body''\n\ \ \ \ :\ \ \ '''foreach'''\ ''varlist\ list\ body''\nhttp://purl.org/tcl/home/man/tcl8.4/TclCmd/foreach.htm\n\ \ \ \ :\ \ \ '''foreach'''\ ''varlist1\ list1''\ ?''varlist2\ list2\ ...\ varlistn\ listn''?\ ''body''\nThe\ '''foreach'''\ command\ implements\ a\ loop\ where\ the\ loop\ variable(s)\ take\ on\ values\ from\ one\ or\ more\ lists.\ In\ the\ simplest\ case\ there\ is\ one\ loop\ variable,\ ''varname'',\ and\ one\ list,\ ''list'',\ that\ is\ a\ list\ of\ values\ to\ assign\ to\ ''varname''.\ The\ ''body''\ argument\ is\ a\ Tcl\ script.\ For\ each\ element\ of\ ''list''\ (in\ order\ from\ first\ to\ last),\ '''foreach'''\ assigns\ the\ contents\ of\ the\ element\ to\ ''varname''\ as\ if\ the\ '''\[lindex\]'''\ command\ had\ been\ used\ to\ extract\ the\ element,\ then\ calls\ the\ Tcl\ interpreter\ to\ execute\ ''body''.\n\nOccasionally\ developers\ are\ surprised\ to\ discover\ that\ if\ ''list''\ is\ modified\ within\ the\ confines\ of\ the\ ''body''\ 's\ code,\ ''varname''\ never\ reflects\ the\ change.\ \ This\ is\ due\ to\ the\ tcl\ parser\ having\ a\ fixed\ copy\ of\ the\ elements\ of\ ''list''\ in\ memory\ and\ not\ referring\ to\ the\ actual\ variable\ during\ the\ assignment\ of\ values\ to\ ''varname''\ during\ the\ loop\ construct.\n\nIn\ the\ general\ case\ there\ can\ be\ more\ than\ one\ value\ list\ (e.g.,\ ''list1''\ and\ ''list2''),\ and\ each\ value\ list\ can\ be\ associated\ with\ a\ list\ of\ loop\ variables\ (e.g.,\ ''varlist1''\ and\ ''varlist2'').\ During\ each\ iteration\ of\ the\ loop\ the\ variables\ of\ each\ varlist\ are\ assigned\ consecutive\ values\ from\ the\ corresponding\ ''list''.\ Values\ in\ each\ ''list''\ are\ used\ in\ order\ from\ first\ to\ last,\ and\ each\ value\ is\ used\ exactly\ once.\ The\ total\ number\ of\ loop\ iterations\ is\ large\ enough\ to\ use\ up\ all\ the\ values\ from\ all\ the\ value\ lists.\ If\ a\ value\ list\ does\ not\ contain\ enough\ elements\ for\ each\ of\ its\ loop\ variables\ in\ each\ iteration,\ empty\ values\ are\ used\ for\ the\ missing\ elements.\ \n\ \ \ \[http://www.tcl.tk/man/tcl/TclCmd/foreach.htm%|%official\ reference\ documentation\]:\ \ \ \nThe\ '''\[break\]'''\ and\ '''\[continue\]'''\ statements\ may\ be\ invoked\ inside\ ''body'',\ with\ the\ same\ effect\ as\ in\ the\ '''\[for\]'''\ command.\ '''Foreach'''\ returns\ an\ empty\ string.\n(From:\ \[TclHelp\])\n\n----\n\nIt\ is\ a\ popular\ \[idiom\]\ to\ use\ the\ varlist\ assignments\ to\ split\ up\ a\ list.\ The\ body\ in\ such\ cases\ would\ just\ be\ ''break''\ to\ stop\ foreach\ running\ into\ a\ second\ round:\nTo\ stride\ through\ a\ list,\ picking\ up\ every\ n'th\ item,\ a\ dummy\ variable\ like\ `\$-`\n\ foreach\ \{first\ second\ third\}\ \$list\ break\ \;#\ RS\n\nYou\ might\ as\ well\ swap\ variables\ with\ that:\n\n\ foreach\ \{a\ b\}\ \[list\ \$b\ \$a\]\ break\n\ \ \ a\ slightly\ faster\ version\ is\n\ foreach\ a\ \$b\ b\ \$a\ break\n\nGet\ every\ second\ element\ of\ a\ list\ with\ the\ following\ (\"-\"\ being\ a\ fancy\ variable\ name\ that\ indicates\ it\ will\ not\ be\ used):\n\n\ foreach\ \{-\ i\}\ \$list\ \{...\}\nTo\ save\ an\ array\ to\ a\ file:\n----\n\n'Foreach'\ is\ also\ a\ convenient\ way\ to\ work\ with\ Tcl's\ associative\ arrays.\ \ For\ instance,\ you\ can\ save\ an\ array\ to\ a\ file\ as\ a\ Tcl\ script\ by\ using:\n======\n\ foreach\ \{\ key\ value\ \}\ \[array\ get\ myArray\]\ \{\ \n\ \ \ \ \ puts\ \$myFile\ \[list\ set\ myArray(\$key)\ \$value\]\n\ \}\nOf\ course,\ you\ could\ have\ written:\nIf\ you\ want\ the\ keys\ alphabetized,\ then\n\n\ foreach\ \{\ key\ \}\ \[lsort\ -dictionary\ \[array\ names\ myArray\]\]\ \{\n\ \ \ \ \ puts\ \$myFile\ \[list\ set\ myArray(\$key)\ \$myArray(\$key)\]\n\ \}\n\n\n======\n\ puts\ \$myFile\ \[list\ array\ set\ myArray\ \[array\ get\ myArray\]\]\nbut\ when\ editing\ such\ a\ file,\ the\ lack\ of\ line\ endings\ might\ give\ your\ text\nbut\ that\ style\ creates\ scripts\ which\ cause\ trouble\ in\ many\ text\ editors.\nTo\ save\ an\ array\ to\ a\ file,\ ordering\ it\ alphabetically\ by\ key:\n----\n\nApplying\ 'foreach'\ to\ the\ result\ of\ the\ 'bbox'\ command\ in\ a\ canvas\ is\ often\ a\ convenient\ way\ to\ create\ canvas\ layouts.\ \ The\ following\ script\ gives\ the\ idea.\n======\n\ grid\ \[canvas\ .c\ -width\ 400\ -height\ 300\ -bg\ gray85\]\n\ set\ i\ \[.c\ create\ text\ 200\ 50\ -text\ \"One\"\ -anchor\ n\]\n\ foreach\ item\ \{\ Two\ Three\ Four\ \}\ \{\n\ \ \ \ \ foreach\ \{\ -\ -\ -\ y\ \}\ \[.c\ bbox\ \$i\]\ break\n\ \ \ \ \ set\ nexty\ \[expr\ \{\ \$y\ +\ 50\ \}\]\n\ \ \ \ \ .c\ create\ line\ 200\ \$y\ 200\ \$nexty\ -arrow\ last\n\ \ \ \ \ set\ i\ \[.c\ create\ text\ 200\ \$nexty\ -text\ \$item\ -anchor\ n\]\n\ \}\n\[KPV\]:\ \ A\ similar\ example\ illustrates\ finding\ the\ dimensions\ of\ a\ canvas\ to\nA\ similar\ example\ is\ when\ I\ wanted\ to\ find\ the\ dimensions\ of\ a\ canvas\ but\ I\ wanted\ to\ shrink\ the\ size\ to\ provide\ a\ margin\ around\ the\ layout.\ \[KPV\]\n======\n\ #\ Get\ canvas\ dimensions\ shrunk\ by\ some\n\ foreach\ who\ \{x0\ y0\ x1\ y1\}\ val\ \[.c\ cget\ -scrollregion\]\ d\ \{30\ 30\ -30\ -30\}\ \{\n\ \ \ \ \ set\ \$who\ \[expr\ \{\$val\ +\ \$d\}\]\n\ \}\n\[http://img684.imageshack.us/img684/1269/image71.gif\]\n----\n\n'''One-time\ loop:'''\ You\ can\ use\ \[foreach\]\ also\ for\ a\ loop\ that\ runs\ exactly\ once,\ and\ you're\ not\ interested\ in\ the\ iterator,\ but\ get\ the\ side\ effect\ that\ you\ can\ \"jump\ out\"\ of\ the\ body\ with\ \[break\]\ or\ \[continue\]\ (seen\ in\ a\ c.l.t\ post\ by\ \[Bruce\ Hartweg\]):\n\n\ foreach\ _\ _\ \{\n\ \ \ \ if\ \{\$somecondition\}\ break\n\ \ \ \ #\ some\ other\ processing\n\ \ \ \ if\ \{\$someothercondition\}\ break\n\ \ \ \ #\ still\ more\ processing\n\}\n\ \}\nThis\ is\ an\ alternative\ to\ nested\ `\[if\]`\ structures.\nHelps\ you\ avoid\ nested\ \[if\]\ structures.\ \[RS\]\ is\ not\ sure\ whether\ to\ recommend\ this\ style..\ but\ proof\ again\ that\ you\ can\ do\ more\ with\ Tcl\ than\ you'd\ imagine...\;-)\ Well,\ hell,\ then\ add\ some\ sugar:\n\[RS\]\ is\ not\ sure\ whether\ to\ recommend\ this\ style..\ but\ proof\ again\ that\ you\ can\n\ interp\ alias\ \{\}\ breakable\ \{\}\ foreach\ _\ _\n\ breakable\ \{\ \;#\ or\ 'fragile'?\n\ \ \ \ if\ \{\$somecondition\}\ break\n\ \ \ \ #\ some\ other\ processing\n\ \ \ \ if\ \{\$someothercondition\}\ break\n\ \ \ \ #\ still\ more\ processing\n\}\n\ \}\nOr,\ to\ make\ your\ intention\ clearer:\n\n======\n\ interp\ alias\ \{\}\ make\ \{\}\ foreach\n\ make\ or\ break\ \{\n\}\n\ \}\n\[AMG\]:\ This\ is\ like\ the\ '''`do\ \{...\}\ while\ (0)\;`'''\ idiom\ in\ \[C\],\ which\ is\n----\n\[SS\]\ wonders\ why\ foreach\ doesn't\ return\ the\ result\ of\ the\ last\ executed\ command.\ It\ can\ be\ useful\ for\ programmers\nusing\ Tcl\ in\ a\ functional\ style.\ The\ same\ also\ apply\ to\ \[for\].\ \ \[CL\]\ likes\ the\ idea.\n\[rmax\]:\ Another\ useful\ return\ value\ (maybe\ even\ closer\ to\ functional\n\nSee\ also:\n\n\ \ \ *\ \[for\]\n\ \ \ *\ \[while\]\n\n----\n\n\[\[\n\[Tcl\ syntax\ help\]\ |\n\[Arts\ and\ Crafts\ of\ Tcl-Tk\ Programming\]\ |\n\[Category\ Command\]\n\]\] regexp2} CALL {my render foreach foreach\ -\ Iterate\ over\ all\ elements\ in\ one\ or\ more\ lists\n\n'''foreach'''\ ''varname\ list\ body''\n**\ Synopsis\ **\n'''foreach'''\ ''varlist1\ list1\ ?varlist2\ list2\ ...?\ body''\n\ \ \ \ :\ \ \ '''foreach'''\ ''varlist\ list\ body''\nhttp://purl.org/tcl/home/man/tcl8.4/TclCmd/foreach.htm\n\ \ \ \ :\ \ \ '''foreach'''\ ''varlist1\ list1''\ ?''varlist2\ list2\ ...\ varlistn\ listn''?\ ''body''\nThe\ '''foreach'''\ command\ implements\ a\ loop\ where\ the\ loop\ variable(s)\ take\ on\ values\ from\ one\ or\ more\ lists.\ In\ the\ simplest\ case\ there\ is\ one\ loop\ variable,\ ''varname'',\ and\ one\ list,\ ''list'',\ that\ is\ a\ list\ of\ values\ to\ assign\ to\ ''varname''.\ The\ ''body''\ argument\ is\ a\ Tcl\ script.\ For\ each\ element\ of\ ''list''\ (in\ order\ from\ first\ to\ last),\ '''foreach'''\ assigns\ the\ contents\ of\ the\ element\ to\ ''varname''\ as\ if\ the\ '''\[lindex\]'''\ command\ had\ been\ used\ to\ extract\ the\ element,\ then\ calls\ the\ Tcl\ interpreter\ to\ execute\ ''body''.\n\nOccasionally\ developers\ are\ surprised\ to\ discover\ that\ if\ ''list''\ is\ modified\ within\ the\ confines\ of\ the\ ''body''\ 's\ code,\ ''varname''\ never\ reflects\ the\ change.\ \ This\ is\ due\ to\ the\ tcl\ parser\ having\ a\ fixed\ copy\ of\ the\ elements\ of\ ''list''\ in\ memory\ and\ not\ referring\ to\ the\ actual\ variable\ during\ the\ assignment\ of\ values\ to\ ''varname''\ during\ the\ loop\ construct.\n\nIn\ the\ general\ case\ there\ can\ be\ more\ than\ one\ value\ list\ (e.g.,\ ''list1''\ and\ ''list2''),\ and\ each\ value\ list\ can\ be\ associated\ with\ a\ list\ of\ loop\ variables\ (e.g.,\ ''varlist1''\ and\ ''varlist2'').\ During\ each\ iteration\ of\ the\ loop\ the\ variables\ of\ each\ varlist\ are\ assigned\ consecutive\ values\ from\ the\ corresponding\ ''list''.\ Values\ in\ each\ ''list''\ are\ used\ in\ order\ from\ first\ to\ last,\ and\ each\ value\ is\ used\ exactly\ once.\ The\ total\ number\ of\ loop\ iterations\ is\ large\ enough\ to\ use\ up\ all\ the\ values\ from\ all\ the\ value\ lists.\ If\ a\ value\ list\ does\ not\ contain\ enough\ elements\ for\ each\ of\ its\ loop\ variables\ in\ each\ iteration,\ empty\ values\ are\ used\ for\ the\ missing\ elements.\ \n\ \ \ \[http://www.tcl.tk/man/tcl/TclCmd/foreach.htm%|%official\ reference\ documentation\]:\ \ \ \nThe\ '''\[break\]'''\ and\ '''\[continue\]'''\ statements\ may\ be\ invoked\ inside\ ''body'',\ with\ the\ same\ effect\ as\ in\ the\ '''\[for\]'''\ command.\ '''Foreach'''\ returns\ an\ empty\ string.\n(From:\ \[TclHelp\])\n\n----\n\nIt\ is\ a\ popular\ \[idiom\]\ to\ use\ the\ varlist\ assignments\ to\ split\ up\ a\ list.\ The\ body\ in\ such\ cases\ would\ just\ be\ ''break''\ to\ stop\ foreach\ running\ into\ a\ second\ round:\nTo\ stride\ through\ a\ list,\ picking\ up\ every\ n'th\ item,\ a\ dummy\ variable\ like\ `\$-`\n\ foreach\ \{first\ second\ third\}\ \$list\ break\ \;#\ RS\n\nYou\ might\ as\ well\ swap\ variables\ with\ that:\n\n\ foreach\ \{a\ b\}\ \[list\ \$b\ \$a\]\ break\n\ \ \ a\ slightly\ faster\ version\ is\n\ foreach\ a\ \$b\ b\ \$a\ break\n\nGet\ every\ second\ element\ of\ a\ list\ with\ the\ following\ (\"-\"\ being\ a\ fancy\ variable\ name\ that\ indicates\ it\ will\ not\ be\ used):\n\n\ foreach\ \{-\ i\}\ \$list\ \{...\}\nTo\ save\ an\ array\ to\ a\ file:\n----\n\n'Foreach'\ is\ also\ a\ convenient\ way\ to\ work\ with\ Tcl's\ associative\ arrays.\ \ For\ instance,\ you\ can\ save\ an\ array\ to\ a\ file\ as\ a\ Tcl\ script\ by\ using:\n======\n\ foreach\ \{\ key\ value\ \}\ \[array\ get\ myArray\]\ \{\ \n\ \ \ \ \ puts\ \$myFile\ \[list\ set\ myArray(\$key)\ \$value\]\n\ \}\nOf\ course,\ you\ could\ have\ written:\nIf\ you\ want\ the\ keys\ alphabetized,\ then\n\n\ foreach\ \{\ key\ \}\ \[lsort\ -dictionary\ \[array\ names\ myArray\]\]\ \{\n\ \ \ \ \ puts\ \$myFile\ \[list\ set\ myArray(\$key)\ \$myArray(\$key)\]\n\ \}\n\n\n======\n\ puts\ \$myFile\ \[list\ array\ set\ myArray\ \[array\ get\ myArray\]\]\nbut\ when\ editing\ such\ a\ file,\ the\ lack\ of\ line\ endings\ might\ give\ your\ text\nbut\ that\ style\ creates\ scripts\ which\ cause\ trouble\ in\ many\ text\ editors.\nTo\ save\ an\ array\ to\ a\ file,\ ordering\ it\ alphabetically\ by\ key:\n----\n\nApplying\ 'foreach'\ to\ the\ result\ of\ the\ 'bbox'\ command\ in\ a\ canvas\ is\ often\ a\ convenient\ way\ to\ create\ canvas\ layouts.\ \ The\ following\ script\ gives\ the\ idea.\n======\n\ grid\ \[canvas\ .c\ -width\ 400\ -height\ 300\ -bg\ gray85\]\n\ set\ i\ \[.c\ create\ text\ 200\ 50\ -text\ \"One\"\ -anchor\ n\]\n\ foreach\ item\ \{\ Two\ Three\ Four\ \}\ \{\n\ \ \ \ \ foreach\ \{\ -\ -\ -\ y\ \}\ \[.c\ bbox\ \$i\]\ break\n\ \ \ \ \ set\ nexty\ \[expr\ \{\ \$y\ +\ 50\ \}\]\n\ \ \ \ \ .c\ create\ line\ 200\ \$y\ 200\ \$nexty\ -arrow\ last\n\ \ \ \ \ set\ i\ \[.c\ create\ text\ 200\ \$nexty\ -text\ \$item\ -anchor\ n\]\n\ \}\n\[KPV\]:\ \ A\ similar\ example\ illustrates\ finding\ the\ dimensions\ of\ a\ canvas\ to\nA\ similar\ example\ is\ when\ I\ wanted\ to\ find\ the\ dimensions\ of\ a\ canvas\ but\ I\ wanted\ to\ shrink\ the\ size\ to\ provide\ a\ margin\ around\ the\ layout.\ \[KPV\]\n======\n\ #\ Get\ canvas\ dimensions\ shrunk\ by\ some\n\ foreach\ who\ \{x0\ y0\ x1\ y1\}\ val\ \[.c\ cget\ -scrollregion\]\ d\ \{30\ 30\ -30\ -30\}\ \{\n\ \ \ \ \ set\ \$who\ \[expr\ \{\$val\ +\ \$d\}\]\n\ \}\n\[http://img684.imageshack.us/img684/1269/image71.gif\]\n----\n\n'''One-time\ loop:'''\ You\ can\ use\ \[foreach\]\ also\ for\ a\ loop\ that\ runs\ exactly\ once,\ and\ you're\ not\ interested\ in\ the\ iterator,\ but\ get\ the\ side\ effect\ that\ you\ can\ \"jump\ out\"\ of\ the\ body\ with\ \[break\]\ or\ \[continue\]\ (seen\ in\ a\ c.l.t\ post\ by\ \[Bruce\ Hartweg\]):\n\n\ foreach\ _\ _\ \{\n\ \ \ \ if\ \{\$somecondition\}\ break\n\ \ \ \ #\ some\ other\ processing\n\ \ \ \ if\ \{\$someothercondition\}\ break\n\ \ \ \ #\ still\ more\ processing\n\}\n\ \}\nThis\ is\ an\ alternative\ to\ nested\ `\[if\]`\ structures.\nHelps\ you\ avoid\ nested\ \[if\]\ structures.\ \[RS\]\ is\ not\ sure\ whether\ to\ recommend\ this\ style..\ but\ proof\ again\ that\ you\ can\ do\ more\ with\ Tcl\ than\ you'd\ imagine...\;-)\ Well,\ hell,\ then\ add\ some\ sugar:\n\[RS\]\ is\ not\ sure\ whether\ to\ recommend\ this\ style..\ but\ proof\ again\ that\ you\ can\n\ interp\ alias\ \{\}\ breakable\ \{\}\ foreach\ _\ _\n\ breakable\ \{\ \;#\ or\ 'fragile'?\n\ \ \ \ if\ \{\$somecondition\}\ break\n\ \ \ \ #\ some\ other\ processing\n\ \ \ \ if\ \{\$someothercondition\}\ break\n\ \ \ \ #\ still\ more\ processing\n\}\n\ \}\nOr,\ to\ make\ your\ intention\ clearer:\n\n======\n\ interp\ alias\ \{\}\ make\ \{\}\ foreach\n\ make\ or\ break\ \{\n\}\n\ \}\n\[AMG\]:\ This\ is\ like\ the\ '''`do\ \{...\}\ while\ (0)\;`'''\ idiom\ in\ \[C\],\ which\ is\n----\n\[SS\]\ wonders\ why\ foreach\ doesn't\ return\ the\ result\ of\ the\ last\ executed\ command.\ It\ can\ be\ useful\ for\ programmers\nusing\ Tcl\ in\ a\ functional\ style.\ The\ same\ also\ apply\ to\ \[for\].\ \ \[CL\]\ likes\ the\ idea.\n\[rmax\]:\ Another\ useful\ return\ value\ (maybe\ even\ closer\ to\ functional\n\nSee\ also:\n\n\ \ \ *\ \[for\]\n\ \ \ *\ \[while\]\n\n----\n\n\[\[\n\[Tcl\ syntax\ help\]\ |\n\[Arts\ and\ Crafts\ of\ Tcl-Tk\ Programming\]\ |\n\[Category\ Command\]\n\]\]} CALL {my revision foreach} CALL {::oo::Obj2129908 process revision/foreach} CALL {::oo::Obj2129906 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4