Artifacts Associated With Ticket 785392ffffffffffffffffffffffffffffffffff
Ticket change [8dbe675a1f] (rid 127989) by nobody on 2003-08-08 13:46:35:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Bug desciption: If a text string contains a { or } sign and you want to split on the "{" or "}" characters the bug occures. proc bug {} { Text "hello how are you { see you}" msglines [split $text "{" ] { set msgline($linenumber) $msglines incr linenumber 1} for {set f 0} {$f <$linenumber} {incr f 1} { puts $config $msgline($f);puts $config $f} } this give a compile error : Extra character after close brace. but this is not true.. It has nothing to do with the proc. it is part of a string and should not be recognized as a part of the procedure - foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "11. Conversions from String"
- title initialized to: "split command:"
- type initialized to: "Bug"
Ticket change [76a82da9db] (rid 105621) by dgp on 2003-08-08 22:28:24:
- assignee changed to: "dgp"
- closedate changed to: "2003-08-08T15:28:24"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 Your example script has one command, [proc]. Its first argument is "bug" Its second argument is "" (empty string) To determine the third argument, the parser sees that it is quoted with a leading "{" so it starts scanning the text for the matching "}" that marks the end of the word. 0 { 1 1 Text "hello how are you { see you}" 1 2 msglines [split $text "{" ] { set msgline($linenumber) $msglines 2 incr linenumber 1} 2 2 2 2 2 2 2 for {set f 0} {$f <$linenumber} {incr f 1} { 2 puts $config $msgline($f);puts $config $f} 1 } ...and your script ends without providing the closing "}" to end the third argument. The correct fix is to use backslash-quoting to mark those "{" and "}" characters that the parser should not count. So change the [split] line above to msglines [split $text \{ ] { - login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- subsystem changed to: "45. Parsing and Eval"
- username: "dgp"