Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/split?V=25
QUERY_STRINGV=25
CONTENT_TYPE
DOCUMENT_URI/revision/split
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.70.127.44
REMOTE_PORT54826
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR18.225.57.223
HTTP_CF_RAY88888bc13f602a18-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_IP18.225.57.223
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 split {split - Split a string into a proper Tcl list

 split string ?splitChars? 

Returns a list created by splitting string at each character that is in the splitChars argument. Each element of the result list will consist of the characters from string that lie between instances of the characters in splitChars. Empty list elements will be generated if string contains adjacent characters in splitChars, or if the first or last character of string is in splitChars. If splitChars is an empty string then each character of string becomes a separate element of the result list. SplitChars defaults to the standard white-space characters. For example,

 split "comp.unix.misc" .

returns "comp unix misc" and

 split "Hello world" {}

returns "H e l l o { } w o r l d".
======none

[DKF]: I believe there's a standard (ANSI? POSIX?) somewhere.  But the answer
[DKF]: I believe there's a standard (ANSI? POSIX?) somewhere.  But the answer includes "space", "tab", and "newline".
----
Note that the argument named ''splitChars'' above is a series of 0 to n individual characters.  However, if you want to split on a specific sequence of 2 or more characters together, or if you want to split on a regular expression, split will not work for you.  See [Tcllib]'s [textutil]::split::splitx for that functionality.

[SS] 2004/01/31 - or you can use the following function:
This version is recursive, so it may be better to rewrite it if you plan to use
 proc wsplit {string sep} {
     set first [string first $sep $string]
     if {$first == -1} {
         return [list $string]
     } else {
         set l [string length $sep]
         set left [string range $string 0 [expr {$first-1}]]
         set right [string range $string [expr {$first+$l}] end]
         return [concat [list $left] [wsplit $right $sep]]
     }
 }

This version is recursive, so it may be better to rewrite it if you plan to use the function
against very long strings with many separators. The difference between wsplit and splitx
is that splitx uses regexp, so it may create problems with unknown separators.


So what should you use when you don't care how many spaces were between tokens,
you just want the nonblank tokens in the list and none of the separators?
''-- [escargo]''
[RS]: Easy, just use a filter:

 proc filter {cond list} {
    set res {}
    foreach element $list {if [$cond $element] {lappend res $element}}
    set res
 }
 % filter llength [split "a   list   with many   spaces"]
 a list with many spaces
... or use
... or use regsub to eliminate the excess white space before splitting ...
... or use 
----
See [Counting characters in a string] where [split] was pretty good...
----
See also the man page at http://www.purl.org/tcl/home/man/tcl8.4/TclCmd/split.htm .
----
[Splitting strings with embedded strings] - [list]
----
[Tcl syntax help] - [Arts and crafts of Tcl-Tk programming]
- [Category Command]} regexp2} CALL {my render split {split - Split a string into a proper Tcl list

 split string ?splitChars? 

Returns a list created by splitting string at each character that is in the splitChars argument. Each element of the result list will consist of the characters from string that lie between instances of the characters in splitChars. Empty list elements will be generated if string contains adjacent characters in splitChars, or if the first or last character of string is in splitChars. If splitChars is an empty string then each character of string becomes a separate element of the result list. SplitChars defaults to the standard white-space characters. For example,

 split "comp.unix.misc" .

returns "comp unix misc" and

 split "Hello world" {}

returns "H e l l o { } w o r l d".
======none

[DKF]: I believe there's a standard (ANSI? POSIX?) somewhere.  But the answer
[DKF]: I believe there's a standard (ANSI? POSIX?) somewhere.  But the answer includes "space", "tab", and "newline".
----
Note that the argument named ''splitChars'' above is a series of 0 to n individual characters.  However, if you want to split on a specific sequence of 2 or more characters together, or if you want to split on a regular expression, split will not work for you.  See [Tcllib]'s [textutil]::split::splitx for that functionality.

[SS] 2004/01/31 - or you can use the following function:
This version is recursive, so it may be better to rewrite it if you plan to use
 proc wsplit {string sep} {
     set first [string first $sep $string]
     if {$first == -1} {
         return [list $string]
     } else {
         set l [string length $sep]
         set left [string range $string 0 [expr {$first-1}]]
         set right [string range $string [expr {$first+$l}] end]
         return [concat [list $left] [wsplit $right $sep]]
     }
 }

This version is recursive, so it may be better to rewrite it if you plan to use the function
against very long strings with many separators. The difference between wsplit and splitx
is that splitx uses regexp, so it may create problems with unknown separators.


So what should you use when you don't care how many spaces were between tokens,
you just want the nonblank tokens in the list and none of the separators?
''-- [escargo]''
[RS]: Easy, just use a filter:

 proc filter {cond list} {
    set res {}
    foreach element $list {if [$cond $element] {lappend res $element}}
    set res
 }
 % filter llength [split "a   list   with many   spaces"]
 a list with many spaces
... or use
... or use regsub to eliminate the excess white space before splitting ...
... or use 
----
See [Counting characters in a string] where [split] was pretty good...
----
See also the man page at http://www.purl.org/tcl/home/man/tcl8.4/TclCmd/split.htm .
----
[Splitting strings with embedded strings] - [list]
----
[Tcl syntax help] - [Arts and crafts of Tcl-Tk programming]
- [Category Command]}} CALL {my revision split} CALL {::oo::Obj2073376 process revision/split} CALL {::oo::Obj2073374 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