BurntSushi / BurntSushi/rust-csv

add a "strict" parsing mode

Open
#77 1 comment 0 reactions 0 assignees View on GitHub
enhancement help-wanted
Dominant language
Rust
Stars
2k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

It is occasionally useful to parse CSV in a "strict" mode, where by the parser returns an error if the CSV data is invalid. A use case came up for this on the xsv project: https://github.com/BurntSushi/xsv/issues/79

Normally, adding a "strict" mode to the existing parser would incur a performance hit, but since the parser uses a DFA, we can compile away the case analysis. So what this means, I think, is just adding a few more conditionals to the NFA state machine that causes it to fail when strict mode is enabled and invalid CSV data is seen. Basically, if this doesn't require adding any new states, then this should be as easy as it is to think through the error handling. (If a new state needs to be added, then you need to mess with the DFA transition table sizes to make room for it. And we need to be careful not to increase the table size too much.)

I'd be happy to mentor this.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.