Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Format trait to support different BNF syntaxes, and a basic implementation of ABNF to demonstrate #154

Merged
merged 10 commits into from
Jan 5, 2025
Prev Previous commit
Next Next commit
applied clippy
Carlyle-Foster committed Jan 2, 2025
commit a2881a3e017f00fe48627f9095ed841d3ee7df3f
1 change: 1 addition & 0 deletions src/augmented.rs
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ use nom::{
IResult,
};

#[non_exhaustive]
pub struct ABNF;

impl Format for ABNF {
1 change: 0 additions & 1 deletion src/grammar.rs
Original file line number Diff line number Diff line change
@@ -228,7 +228,6 @@ impl Grammar {
}

/// parse a grammar given a format

pub fn parse_from<F: Format>(input: &str) -> Result<Self, self::Error> {
match parsers::grammar_complete::<F>(input) {
Result::Ok((_, o)) => Ok(o),
1 change: 1 addition & 0 deletions src/parsers.rs
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ pub trait Format {
fn nonterminal(input: &str) -> IResult<&str, Term, VerboseError<&str>>;
}

#[non_exhaustive]
pub struct BNF;

impl Format for BNF {
4 changes: 2 additions & 2 deletions src/tracing.rs
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ mod defs {
pub struct Span {}

impl Span {
pub fn entered(&self) -> Self {
pub const fn entered(&self) -> Self {
Self {}
}
}
@@ -42,7 +42,7 @@ mod defs {
pub(crate) use event;

#[allow(dead_code)]
pub fn init_subscriber() {}
pub const fn init_subscriber() {}
}

pub(crate) use defs::*;
Loading
Oops, something went wrong.