Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

groupmark bugs #168

Closed
LilithHafner opened this issue Jun 2, 2023 · 1 comment · Fixed by #169
Closed

groupmark bugs #168

LilithHafner opened this issue Jun 2, 2023 · 1 comment · Fixed by #169

Comments

@LilithHafner
Copy link

Two bugs

  1. groupmark::UInt8 is broken
  2. The groupmark == decimal check fails when groupmark::Char and decimal::UInt8

Relevant source code

if groupmark !== nothing && (groupmark == decimal || isnumeric(groupmark) || (del == groupmark && !quoted) || (openquotechar == groupmark) || (closequotechar == groupmark))

MWE

julia> Parsers.parse(Int, "1,729", Parsers.Options(groupmark=','))
1729

julia> Parsers.parse(Int, "1,729", Parsers.Options(groupmark=UInt8(',')))
ERROR: MethodError: no method matching isnumeric(::UInt8)

Closest candidates are:
  isnumeric(::AbstractChar)
   @ Base strings/unicode.jl:488

Stacktrace:
 [1] Parsers.Options(sentinel::Nothing, wh1::UInt8, wh2::UInt8, openquotechar::UInt8, closequotechar::UInt8, escapechar::UInt8, delim::UInt8, decimal::UInt8, trues::Nothing, falses::Nothing, dateformat::Nothing, ignorerepeated::Bool, ignoreemptylines::Bool, comment::Nothing, quoted::Bool, debug::Bool, stripwhitespace::Bool, stripquoted::Bool, groupmark::UInt8)
   @ Parsers ~/.julia/packages/Parsers/1hkUk/src/Parsers.jl:242
 [2] #Options#5
   @ ~/.julia/packages/Parsers/1hkUk/src/Parsers.jl:284 [inlined]
 [3] top-level scope
   @ REPL[8]:1

julia> Parsers.parse(Int, "3.14", Parsers.Options(groupmark='.', decimal='.'))
ERROR: ArgumentError: `groupmark` cannot be a number, a quoting char, coincide with `decimal` and `delim` unless `quoted=true`.
Stacktrace:
 [1] Parsers.Options(sentinel::Nothing, wh1::UInt8, wh2::UInt8, openquotechar::UInt8, closequotechar::UInt8, escapechar::UInt8, delim::UInt8, decimal::Char, trues::Nothing, falses::Nothing, dateformat::Nothing, ignorerepeated::Bool, ignoreemptylines::Bool, comment::Nothing, quoted::Bool, debug::Bool, stripwhitespace::Bool, stripquoted::Bool, groupmark::Char)
   @ Parsers ~/.julia/packages/Parsers/1hkUk/src/Parsers.jl:243
 [2] #Options#5
   @ ~/.julia/packages/Parsers/1hkUk/src/Parsers.jl:284 [inlined]
 [3] top-level scope
   @ REPL[11]:1

julia> Parsers.parse(Int, "3.14", Parsers.Options(groupmark='.'))
314

julia> Parsers.parse(Int, "3.14", Parsers.Options(groupmark='.', decimal=UInt8('.')))
314

cc @Drvi, @quinnj, pr #128

@Drvi
Copy link
Collaborator

Drvi commented Jun 3, 2023

Thanks @LilithHafner, I'll look into it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants