pub enum State {
ParseError,
CodeTooLong,
UnexpectedEnd,
UnexpectedProgramEnd,
UnexpectedRegexpBegin,
UnterminatedBlock,
UnterminatedHeredoc,
UnterminatedString,
Valid,
}
Expand description
State shows whether artichoke can parse some code or why it cannot.
This enum only encapsulates whether artichoke can parse the code. It may still have syntactic or semantic errors.
Variants
ParseError
Internal parser error. This is a fatal error.
CodeTooLong
Code must be fewer than isize::MAX
bytes.
UnexpectedEnd
The code has too many end statements.
UnexpectedProgramEnd
The code has unclosed blocks.
UnexpectedRegexpBegin
The current expression is an unterminated Regexp
.
UnterminatedBlock
The current expression is an unterminated block.
UnterminatedHeredoc
The current expression is an unterminated heredoc.
UnterminatedString
The current expression is an unterminated String
.
Valid
Code is valid and fit to eval.
Implementations
sourceimpl State
impl State
sourcepub fn is_code_block_open(self) -> bool
pub fn is_code_block_open(self) -> bool
Whether this variant indicates a code block is open.
This method can be used by a REPL to check whether to buffer code or begin a multi-line editing session before attempting to eval the code on an interpreter.
sourcepub fn is_recoverable_error(self) -> bool
pub fn is_recoverable_error(self) -> bool
Whether this variant is a recoverable error.
Recoverable errors should be handled by resetting the parser and input buffer.
Trait Implementations
sourceimpl Ord for State
impl Ord for State
sourceimpl PartialOrd<State> for State
impl PartialOrd<State> for State
sourcefn partial_cmp(&self, other: &State) -> Option<Ordering>
fn partial_cmp(&self, other: &State) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for State
impl Eq for State
impl StructuralEq for State
impl StructuralPartialEq for State
Auto Trait Implementations
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnwindSafe for State
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more