my_parser_prymochenko 0.1.0

A simple list parser for KMA practice lesson.
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 1 items with examples
  • Size
  • Source code size: 15.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 25.6 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • prymochenkovictoria/my_parser_prymochenko
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • prymochenkovictoria

My parser

my parser for education purpose

alt text

code example

peg::parser!{
    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]"));
  }