Skip to content

Extra \n in unterminated aic command at EOF  #2

@aureliojargas

Description

@aureliojargas
$ cat x.sed 
3i\
foo\
$ sedparse -f x.sed 
[
    {
        "a1": {
            "addr_number": 3,
            "addr_type": 3
        },
        "cmd": "i",
        "line": 1,
        "x": {
            "cmd_txt": {
                "text": [
                    "f",
                    "o",
                    "o",
                    "\\",
                    "\n",
                    "\n"
                ]
            }
        }
    }
]
$

Note that inside x.cmd_txt.text, there's a double \n when there should be only one.

In the x.sed file, the last line is foo\, which implies there will be a new line to the i command text. But there isn't. Note that for GNU sed, it works the same as if it was a normal foo in the last line:

$ seq 5 | sed -e '3i\' -e 'foo'
1
2
foo
3
4
5
$ seq 5 | sed -e '3i\' -e 'foo\'
1
2
foo
3
4
5
$

sedparse should not return that extra \n in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions