y_lang/ast/parser.rs
1use pest::{iterators::Pairs, Parser};
2
3use super::parse_error::{ParseError, ParseResult};
4
5#[derive(Parser)]
6#[grammar = "y-lang.pest"]
7pub struct YParser;
8
9impl YParser {
10 pub fn parse_program(file: impl ToString, program: &str) -> ParseResult<Pairs<Rule>> {
11 Self::parse(Rule::program, program).map_err(|error| ParseError::from((error, file)))
12 }
13}