From b0a467eda2d7d5ed7d285f0c58d0678d49b86274 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Wed, 18 Oct 2023 23:23:10 -0400 Subject: [PATCH] Add a placeholder for doing parser-recovery tests --- error-training/src/flow.rs | 2 +- error-training/src/parser-recovery.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 error-training/src/parser-recovery.rs diff --git a/error-training/src/flow.rs b/error-training/src/flow.rs index 12f07ba..d5c9c2f 100644 --- a/error-training/src/flow.rs +++ b/error-training/src/flow.rs @@ -3,7 +3,7 @@ //! FatalError, Error>. use super::*; -use ::result_extended::{error, fatal, ok, return_error, return_fatal, Result}; +use ::result_extended::{error, fatal, ok, return_fatal, Result}; use std::collections::HashMap; pub struct DB(HashMap); diff --git a/error-training/src/parser-recovery.rs b/error-training/src/parser-recovery.rs new file mode 100644 index 0000000..d4e3657 --- /dev/null +++ b/error-training/src/parser-recovery.rs @@ -0,0 +1,9 @@ +//! Let's figure out a recovery mechanism in terms of a parser. For this example I'm going to +//! assume an SGF parser in which a player's rank is specified in some non-standard, but still +//! somewhat comprehensible, way. +//! +//! Correct: 5d +//! Incorrect, but recoverable: 5 Dan +//! +//! In strict mode, the incorrect one would be rejected. In permissive mode, the incorrect one +//! would be corrected. I don't know that this actually makes any sense in this context, though.