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

Bug: using `i\`, `a\` or `c\` at EOF #54

Open aureliojargas opened 5 years ago

aureliojargas commented 5 years ago
$ cat bug.sed
i\
$ ./sedsed.py -f bug.sed 

$ ./sedsed.py -e 'i\'

$

The i command was ignored in both -e and -f.

aureliojargas commented 5 years ago

Fixed by the new sedparse parser, see #52.

$ cat bug.sed
i\
$ ./sedsed.py -f bug.sed 
i\

$ ./sedsed.py -e 'i\'
i\

$
aureliojargas commented 5 years ago

Mmmm, but that extra blank line in the output does not seem right.

Indeed, when running the debug, it is adding an extra blank line that it shouldn't:

$ seq 5 | sed -e '3i\'
1
2
3
4
5
$ seq 5 | ./sedsed.py -d -e '3i\' --hide=patt,hold,comm
1
2

3
4
5
$

When the i command is not at EOF, it works as expected:

$ seq 5 | ./sedsed.py -d -e '3i\' -e foo --hide=patt,hold,comm
1
2
foo
3
4
5
$
aureliojargas commented 5 years ago

It seems it is a bug in sedparse, see https://github.com/aureliojargas/sedparse/issues/2