Partial work toward a PEG parser library
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
use super::super::preprocess::peg::Parser;
|
||||
use anyhow::Result;
|
||||
|
||||
fn parse_program(p: &mut Parser) -> Result<()> {
|
||||
p.star(|p| parse_line(p))?;
|
||||
p.eof()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn parse_line(p: &mut Parser) -> Result<()> {
|
||||
p.star(|p| p.char(|c| c != '\n'))?;
|
||||
p.literal("\n")?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user