Document parser crate.

This commit is contained in:
Dimitris Fasarakis Hilliard 2023-02-07 21:42:15 +02:00
parent 4ee4fcf407
commit 66cbe3fe62
6 changed files with 429 additions and 86 deletions

View file

@ -1,9 +1,14 @@
//! Control in the different modes by which a source file can be parsed.
use crate::token::Tok;
/// The mode argument specifies in what way code must be parsed.
#[derive(Clone, Copy)]
pub enum Mode {
/// The code consists of a sequence of statements.
Module,
/// The code consists of a sequence of interactive statement.
Interactive,
/// The code consists of a single expression.
Expression,
}
@ -39,6 +44,7 @@ impl std::str::FromStr for Mode {
}
}
/// Returned when a given mode is not valid.
#[derive(Debug)]
pub struct ModeParseError {
_priv: (),