Skip to content

Commit 3dd9444

Browse files
author
Shashi Gowda
committed
fix bug in string parsing if condition. Fixes #34
1 parent b8dbaf4 commit 3dd9444

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/field.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ function tryparsenext{T}(s::StringToken{T}, str, i, len, opts)
222222

223223
while i <= len
224224
c, ii = next(str, i)
225-
if opts.spacedelim && c == ' ' || c == '\t'
225+
if opts.spacedelim && (c == ' ' || c == '\t')
226226
break
227227
elseif !opts.spacedelim && c == opts.endchar
228228
if opts.endchar == opts.quotechar
@@ -255,8 +255,6 @@ function tryparsenext{T}(s::StringToken{T}, str, i, len, opts)
255255
i = ii
256256
end
257257
break
258-
elseif opts.spacedelim && c == ' ' || c == '\t'
259-
break
260258
elseif (!opts.includenewlines && isnewline(c))
261259
break
262260
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ import TextParse: StringToken
6868
@test tryparsenext(Quoted(String), str) |> unwrap == (str, endof(str)+1)
6969
str1 = "\"Owner 2 ”Vicepresident\"\"\""
7070
@test tryparsenext(Quoted(String,quotechar=Nullable('"'), escapechar=Nullable('"')), str1) |> unwrap == (str, endof(str1)+1)
71-
71+
@test tryparsenext(Quoted(String), "\"\tx\"") |> unwrap == ("\tx", 5)
7272
opts = LocalOpts(',', true, '"', '\\', false, false)
7373
@test tryparsenext(StringToken(String), "x y",1,3, opts) |> unwrap == ("x", 2)
7474
end

0 commit comments

Comments
 (0)