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§
Source§impl 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§
Source§impl Ord for State
impl Ord for State
Source§impl PartialOrd for State
impl PartialOrd for State
impl Copy for State
impl Eq for State
impl StructuralPartialEq for State
Auto Trait Implementations§
impl Freeze for State
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnwindSafe for State
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)