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

Nicknames do not allow for numeric characters #2

Open
miam-miam opened this issue Oct 11, 2023 · 1 comment
Open

Nicknames do not allow for numeric characters #2

miam-miam opened this issue Oct 11, 2023 · 1 comment

Comments

@miam-miam
Copy link

The following ballot fails to parse as one1 contains a 1

4 2
[nick one1 two three four]
[withdrawn two]
3 one1 three four 0
4 one1 three two 0
2 four one1=three 0
1 two 0
2 two=four=three one1 0
1 three four two 0
0
"Adam"
"Basil"
"Charlotte"
"Donald"
"Title"

With the following error:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/miam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stv-rs-0.2.0/src/parse.rs:87:44
stack backtrace:
   0: rust_begin_unwind
             at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/panicking.rs:67:14
   2: core::panicking::panic
             at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/panicking.rs:117:5
   3: stv_rs::parse::parse_election
   4: stv_rs::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Nicknames should allow for numeric characters and should potentially even be optional.

@gendx
Copy link
Owner

gendx commented Dec 21, 2023

This should be fixed in fb1f658 (included in the v0.3.0 release). Ultimately the parsing should be more robust than with regexes though.

Regarding making nicknames optional, the example in https://github.com/gendx/stv-rs/blob/main/examples/remove_nicknames.rs replaces them by integers, but indeed the parser doesn't allow such files yet.

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

No branches or pull requests

2 participants