Partial work toward a PEG parser library

This commit is contained in:
2025-04-30 00:12:04 -07:00
parent 58293ed625
commit b03cccb8dd
5 changed files with 110 additions and 0 deletions
+14
View File
@@ -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(())
}