[−][src]Struct xbasic::xbasic::XBasic
Represents an xBASIC Interpreter.
Fields
error_handler: ErrorHandler
Keeps track of errors that have been encountered while interpreting source code. Errors are recorded as user-friendly strings so that they can be passed directly to the user.
Implementations
impl<T> XBasic<T> where
T: BasicIO,
[src]
T: BasicIO,
pub fn new(stdio: T) -> Self
[src]
Creates a new XBasic
struct with the given BasicIO
instance.
pub fn run(&mut self, source: &str) -> Result<(), ()>
[src]
Runs a snippet of XBasic source code using the interpreter. Returns Ok
if there are no errors. Otherwise returns Err
and keeps track of errors in the error_handler
field.
Arguments
- source - The XBasic code. This should be terminated by a newline character.
pub fn clear_errors(&mut self)
[src]
Clears all existing errors in the various stages of the interpreter.
pub fn call_function(
&mut self,
name: &str,
arguments: &[ExprValue]
) -> Result<ExprValue, ()>
[src]
&mut self,
name: &str,
arguments: &[ExprValue]
) -> Result<ExprValue, ()>
Calls an xBASIC function from Rust code.
Arguments
- name - The name of the function to call
- arguments - The arguments of the function to be called
pub fn get_io(&self) -> &T
[src]
Gets a reference to the IO object. Useful if you are using the IO object for some kind of state.
pub fn get_io_mut(&mut self) -> &mut T
[src]
Gets a mutable reference to the IO object. Useful if you are using the IO object for some kind of state.
Auto Trait Implementations
impl<T> !RefUnwindSafe for XBasic<T>
[src]
impl<T> !Send for XBasic<T>
[src]
impl<T> !Sync for XBasic<T>
[src]
impl<T> Unpin for XBasic<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> !UnwindSafe for XBasic<T>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,