diff --git a/internal/lexer/lexer.go b/internal/lexer/lexer.go index b51220d30..84b9f6aa9 100644 --- a/internal/lexer/lexer.go +++ b/internal/lexer/lexer.go @@ -22,6 +22,9 @@ type Tokenset struct { func Split(s string, pipelines bool) (*Tokenset, error) { tokenset, err := split(s, pipelines) + if err != nil && err.Error() == "EOF found after escape character" { + return Split(s[:len(s)-1], pipelines) // TODO mark this in tokenset + } if err != nil && err.Error() == "EOF found when expecting closing quote" { tokenset, err = split(s+`_"`, pipelines) if err == nil { diff --git a/internal/lexer/lexer_test.go b/internal/lexer/lexer_test.go index 77bf2b830..1f52d0b5a 100644 --- a/internal/lexer/lexer_test.go +++ b/internal/lexer/lexer_test.go @@ -161,4 +161,9 @@ func TestSplit(t *testing.T) { Prefix: `example `, State: OPEN_SINGLE, }) + + _test(`example \`, Tokenset{ + Tokens: []string{"example", ""}, + Prefix: `example `, + }) }