Skip to content

Commit

Permalink
Merge pull request #855 from rsteube/lexer-quote-workaround
Browse files Browse the repository at this point in the history
lexer: quote workaround
  • Loading branch information
rsteube authored Jul 29, 2023
2 parents f39db97 + 99682eb commit 7e7513c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions internal/lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@ type Tokenset struct {
func Split(s string, pipelines bool) (*Tokenset, error) {
tokenset, err := split(s, pipelines)
if err != nil && err.Error() == "EOF found when expecting closing quote" {
tokenset, err = split(s+`"`, pipelines)
tokenset, err = split(s+`_"`, pipelines)
if err == nil {
tokenset.State = OPEN_DOUBLE
last := tokenset.Tokens[len(tokenset.Tokens)-1]
tokenset.Tokens[len(tokenset.Tokens)-1] = last[:len(last)-1]
}
}
if err != nil && err.Error() == "EOF found when expecting closing quote" {
tokenset, err = split(s+`'`, pipelines)
tokenset, err = split(s+`_'`, pipelines)
if err == nil {
tokenset.State = OPEN_SINGLE
last := tokenset.Tokens[len(tokenset.Tokens)-1]
tokenset.Tokens[len(tokenset.Tokens)-1] = last[:len(last)-1]
}
}
return tokenset, err
Expand Down
1 change: 0 additions & 1 deletion internal/lexer/lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ func TestSplit(t *testing.T) {
State: OPEN_DOUBLE,
})

t.Skip("skipping test that don't work yet") // TODO these need to work
_test(`example "`, Tokenset{
Tokens: []string{"example", ""},
Prefix: `example `,
Expand Down

0 comments on commit 7e7513c

Please sign in to comment.