Skip to content
Tcl Source Code History Of Ticket 2826551fffffffff
Login

History Of Ticket 2826551fffffffff

Artifacts Associated With Ticket 2826551fffffffff

  1. Ticket change [0ad9565c2a] (rid 113891) by lars_h on 2009-07-24 12:53:45:

    1. assignee initialized to: "pvgoran"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      I was going to use [regexp -all -inline] to split a unified diff into chunks, 
      but found that this would skip every second chunk. This seems to be 
      related to ^ not matching the beginning of line if the newline is before 
      the -start position.
      
      SMALL EXAMPLE:
      
      set data {
      @1
       2
      +3
      @4
      -5
      +6
       7
      @8
       9
      }
      regexp -all -inline {(?n)^@.*\n(?:[^@].*\n?)*} $data
      
      RETURNS
      
      {@1
       2
      +3
      } {@8
       9
      }
      
      RATHER THAN
      
      {@1
       2
      +3
      } {@4
      -5
      +6
       7
      } {@8
       9
      }
      
      EXPLANATION: A diff chunk consists of one header line beginning with @, followed by a body 
      consisting of lines not beginning with @ (but rather space, plus, or minus). The header line
      is thus in line-sensitive mode matched by ^@.* and a body line is matched by ^[^@].*, so 
      a sensible combined regexp is (?n)^@.*\n(?:[^@].*\n?)*  Each chunk is indeed matched by
      this, but when -all is used, only every second chunk is found.
      
      In this case, dropping the ^ from the regexp allows all chunks to be found:
      
      % regexp -all -inline {(?n)@.*\n(?:[^@].*\n?)*} $data
      {@1
       2
      +3
      } {@4
      -5
      +6
       7
      } {@8
       9
      }
      
      This suggests the problem may be that ^ fails to match when at the -start position, as one obvious 
      way to implement [regexp -all] is as the equivalent of a loop around [regexp -start]. Indeed,
      
      % regexp -start 1 -indices {(?n)^a} "\nab" match
      0
      % regexp -start 0 -indices {(?n)^a} "\nab" match
      1
      % set match
      1 1
      
      
      
    4. foundin initialized to: "obsolete: 8.6b1"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "lars_h"
    10. subsystem initialized to: "43. Regexp"
    11. title initialized to: "Line-sensitivity at -start, but also -all"
    12. type initialized to: "Bug"
  2. Ticket change [ca87afa673] (rid 95364) by jkock on 2009-10-16 05:25:56:

    1. icomment:
      Here is another description of the bug, and a contrast:
      
      In regexp with the -all option, it is clear that the matches
      must not overlap.  But how is the rule if the expression
      starts with a constraint (width zero), like for example ^
      or \m ?
      
      To my surprise you cannot find a linestart after a
      matched \n:
      
      % regexp -all -inline -indices {(?n)^a\n} "a\na\na\n"
      {0 1} {4 5}
      
      The behaviour I expected is the one seen with \m instead of ^:
      you _can_ find a wordstart after a matched \n:
      
      % regexp -all -inline -indices {(?n)\ma\n} "a\na\na\n"
      {0 1} {2 3} {4 5}
      
      So somehow the regexp engine is allowed to look back to
      see that a \n preceded and hence constitutes a word boundary,
      but it is not allowed to look back and detect that this same
      \n also constitutes a line boundary...
      
      
      
    2. login: "jkock"
    3. mimetype: "text/plain"
    4. username: "jkock"
  3. Ticket change [b0a888e561] (rid 98024) by mdejong on 2010-02-09 18:28:48:

    1. icomment:
      Added patch 2948425 to addres this issue.
      
      
    2. login: "mdejong"
    3. mimetype: "text/plain"
    4. username: "mdejong"
  4. Ticket change [278f3026ba] (rid 88539) by dkf on 2010-02-11 18:15:48:

    1. icomment:
      That patch now applied.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  5. Ticket change [fdd0a1e2bf] (rid 108483) by dgp on 2010-08-09 23:23:45:

    1. icomment:
      status?  This bug is/was 8.6 branch only?
      Or is there still a need to fix a bug for new 8.5.* releases too?
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [8bafbc1947] (rid 127608) by dgp on 2010-08-10 00:54:31:

    1. priority changed to: "9 Immediate"
  7. Ticket change [9e4bffb7f1] (rid 96452) by lars_h on 2010-08-12 04:20:26:

    1. icomment:
      To answer dgp's question: the bug was originally encountered under 8.5 (possibly even 8.4), so a fix there would be nice too. Given how little tends to change in the regexp engine, I would be surprised if fixing 8.5 is different from fixing 8.6.
      
      
    2. login: "lars_h"
    3. mimetype: "text/plain"
    4. username: "lars_h"
  8. Ticket change [0535067d9e] (rid 89017) by dkf on 2010-08-12 15:56:35:

    1. assignee changed to: "dkf"
    2. closedate changed to: "2010-08-12T08:56:35"
    3. closer changed to: "dkf"
    4. icomment:
      
      
      allow_comments - 1
      
      Backported patch to 8.5.
      
      
    5. login: "dkf"
    6. mimetype: "text/plain"
    7. status changed to: "Closed"
    8. username: "dkf"