aureliojargas / sedsed

Debugger and code formatter for sed scripts
https://aurelio.net/projects/sedsed/
GNU General Public License v3.0
115 stars 10 forks source link

`lastaddr` property should also include address flags #68

Closed aureliojargas closed 5 years ago

aureliojargas commented 5 years ago

Since the lastaddr property is used in a void /lastaddr/y/!/!/ command, just to reset the "last address" status, it should also contain any address flag, if used, because otherwise it would not be a 100% equivalent address. Example:

$ python sedsed.py --token -e '/foo/Ip;s///'
    linenr:1
     addr1:/foo/
 addr1flag:I
     addr2:
 addr2flag:
  lastaddr:
  modifier:
        id:p
   content:
 delimiter:
   pattern:
   replace:
      flag:
   comment:

    linenr:1
     addr1:
 addr1flag:
     addr2:
 addr2flag:
  lastaddr:/foo/
  modifier:
        id:s
   content:
 delimiter:/
   pattern:
   replace:
      flag:
   comment:

Note how the lastaddr:/foo/ line is missing the I flag for the address.

Investigate if the s flags should also be saved, i.e., s/foo//im; s///.