Skip to content
Tcl Source Code History Of Ticket 785392ffffffffff
Login

History Of Ticket 785392ffffffffff

Artifacts Associated With Ticket 785392ffffffffff

  1. Ticket change [8dbe675a1f] (rid 127989) by nobody on 2003-08-08 13:46:35:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. 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
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "11. Conversions from String"
    10. title initialized to: "split command:"
    11. type initialized to: "Bug"
  2. Ticket change [76a82da9db] (rid 105621) by dgp on 2003-08-08 22:28:24:

    1. assignee changed to: "dgp"
    2. closedate changed to: "2003-08-08T15:28:24"
    3. closer changed to: "dgp"
    4. 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 \{ ] {
      
      
      
    5. login: "dgp"
    6. mimetype: "text/plain"
    7. resolution changed to: "Invalid"
    8. status changed to: "Closed"
    9. subsystem changed to: "45. Parsing and Eval"
    10. username: "dgp"