Crates.io | csv_parser_moshkovskyi |
lib.rs | csv_parser_moshkovskyi |
version | 0.1.0 |
source | src |
created_at | 2024-11-14 06:30:23.372571 |
updated_at | 2024-11-14 06:30:23.372571 |
description | CSV parser built with Pest parser for Rust. |
homepage | |
repository | |
max_upload_size | |
id | 1447483 |
size | 22,881 |
Realisation of basic csv parser
This parser is parsing a csv file. He will parse file, show it in structured way and check file on correctnes.
The result can be used for basic data analytics
WHITESPACE = _{ " " | "\t" | "\n" | "\r" } NEWLINE = _{ "\n" | "\r\n" } csv = { (WHITESPACE | NEWLINE)* ~ record ~ (NEWLINE ~ record)* ~ (WHITESPACE | NEWLINE)* } record = { field ~ ("," ~ field)* } field = { empty_field | quoted_field | unquoted_field } empty_field = _{ "," } quoted_field = _{ """ ~ (!""" ~ ANY | """ ~ """)* ~ """ } unquoted_field = _{ (!("," | NEWLINE | " ") ~ ANY)+ }