my_parser_kma_group_8 0.1.1

A brief description of my crate
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 1 items with examples
  • Size
  • Source code size: 74.98 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.08 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • bohdanaprokopchuk

My Parser

Short Description

This parser analyzes and processes lists of numbers in string format. It uses the peg library for parsing input data, providing a simple interface for parsing numbers enclosed in square brackets.

Screenshot of the parser in action

Example

peg::parser! {
    pub grammar list_parser() for str {
        rule number() -> u32
            = n:$(['0'..='9']+) {? n.parse().or(Err("u32")) }

        pub rule list() -> Vec<u32>
            = "[" l:(number() ** ",") "]" { l }
    }
}

pub fn main() {
    println!("{:?}", list_parser::list("[1,1,2,3,5,8]"));
}