person_struct_parser
Parser for Rust source code
- GITHUB: https://github.com/DavydKod/person_struct_parser
- CRATES.IO: https://crates.io/crates/person_struct_parser
Person_struct_parser(PSP) is a parsing library for parsing a String into a person object.
- PSP has structure Person(
person_struct_parser::person_module::Person) for containing the information about a person(name,age,city)
- Function
person_struct_parser::person_module::parseis implemented for Person, it's main method for parsing String into the Person object:
std::fmt::Displayis implemented for Person- There is function
person_struct_parser::person_module::normalizeimplemented for Person to reduce object data to normal form:
- The grammar for parsing is placed in
grammar.pestfile insrcfolder.
alpha = { 'a'..'z' | 'A'..'Z' }
digit = { '0'..'9' }
name = {(alpha)+}
age = {(digit)+}
city = {(alpha)+}
person = {name~age~city}