diff options
author | JSDurand <mmemmew@gmail.com> | 2023-07-08 12:30:21 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2023-07-08 12:31:13 +0800 |
commit | 9a317e56f8a6126583f7d0c431bf878d9b1fe7b1 (patch) | |
tree | 7bb6004196b38446a5ab0cb3a0ab642d35f113e9 /grammar/src/abnf.rs | |
parent | 691f969eb104fa3d4c2a1667693fd0382eb9d6b5 (diff) |
Finished the Emacs binding.
Now the binding part is finished.
What remains is a bug encountered when planting a fragment to the
forest which intersects a packed node, which would lead to invalid
forests. This will also cause problem when planting a packed
fragment, but until now my testing grammars do not produce packed
fragments, so this problem is not encountered yet.
I am still figuring out efficient ways to solve this problem.
Diffstat (limited to 'grammar/src/abnf.rs')
-rw-r--r-- | grammar/src/abnf.rs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/grammar/src/abnf.rs b/grammar/src/abnf.rs deleted file mode 100644 index eb56819..0000000 --- a/grammar/src/abnf.rs +++ /dev/null @@ -1,37 +0,0 @@ -//! This file implements the function to read a grammar from a string, -//! in the [augmented Backus Naur -//! form](https://en.wikipedia.org/wiki/Augmented_Backus–Naur_form). -//! See [RFC5234](https://www.rfc-editor.org/rfc/rfc5234) for its -//! specifications. -//! -//! In fact, the rules of ABNF are considered to be too strict. For -//! example, only ASCII characters are allowed in the format, even -//! within comments. I think any character should be allowed within -//! comments, so the implementation here does that. - -use super::*; - -/// The type of errors encountered during parsing a grammar in the -/// ABNF format. See the function [`abnf_to_grammar`] for the parsing -/// function. -#[derive(Debug, Clone, Copy)] -pub enum Error { - /// Something invalid has occurred. - Invalid, -} - -impl core::fmt::Display for Error { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - match self { - Error::Invalid => write!(f, "invalid"), - } - } -} - -#[allow(unused)] -/// This function converts a string to a grammar. -pub fn abnf_to_grammar(str: impl AsRef<str>) -> Result<Grammar, Error> { - let str = str.as_ref(); - - todo!() -} |