From 8327505398ec930a5ffe956106ef16914eaef447 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sat, 26 Oct 2019 03:05:07 +0300 Subject: [PATCH] handle closing double quote properly Related #249 --- eval_test.go | 12 ++++++++++++ scan.go | 1 + 2 files changed, 13 insertions(+) diff --git a/eval_test.go b/eval_test.go index 6c30db81..788b4df4 100644 --- a/eval_test.go +++ b/eval_test.go @@ -131,6 +131,18 @@ var gEvalTests = []struct { []expr{&setExpr{"hidden", ""}, &setExpr{"preview", ""}}, }, + { + `set ifs ""`, + []string{"set", "ifs", "", "\n"}, + []expr{&setExpr{"ifs", ""}}, + }, + + { + `set ifs "\n"`, + []string{"set", "ifs", "\n", "\n"}, + []expr{&setExpr{"ifs", "\n"}}, + }, + { "set ratios 1:2:3", []string{"set", "ratios", "1:2:3", "\n"}, diff --git a/scan.go b/scan.go index a339e036..35743f29 100644 --- a/scan.go +++ b/scan.go @@ -249,6 +249,7 @@ scan: buf = append(buf, '\\', s.chr) } s.next() + continue } buf = append(buf, s.chr) s.next()