pub struct Interpreter {
pub cursor: Cursor,
actions: Vec<InterpreterAction>,
handler: Handler,
pub node_builder: NodeBuilder,
breakpoints: Vec<Breakpoint>,
pub watchpoints: Vec<Watchpoint>,
saved_cursors: Vec<Cursor>,
filename_to_program: HashMap<PathBuf, String>,
parsed_inputs: u32,
network: NetworkName,
}
Expand description
Contains the state of interpretation, in the form of the Cursor
,
as well as information needed to interact with the user, like
the breakpoints.
Fields§
§cursor: Cursor
§actions: Vec<InterpreterAction>
§handler: Handler
§node_builder: NodeBuilder
§breakpoints: Vec<Breakpoint>
§watchpoints: Vec<Watchpoint>
§saved_cursors: Vec<Cursor>
§filename_to_program: HashMap<PathBuf, String>
§parsed_inputs: u32
§network: NetworkName
The network.
Implementations§
Source§impl Interpreter
impl Interpreter
pub fn new<'a, Q: 'a + AsRef<Path> + ?Sized>( leo_source_files: &[(PathBuf, Vec<PathBuf>)], aleo_source_files: impl IntoIterator<Item = &'a Q>, signer: Value, block_height: u32, network: NetworkName, ) -> Result<Self>
Sourcefn get_ast(
path: &PathBuf,
modules: &[PathBuf],
handler: &Handler,
node_builder: &NodeBuilder,
network: NetworkName,
) -> Result<Ast>
fn get_ast( path: &PathBuf, modules: &[PathBuf], handler: &Handler, node_builder: &NodeBuilder, network: NetworkName, ) -> Result<Ast>
Parses a Leo source file and its modules into an Ast
.
§Arguments
path
: The path to the main.leo
source file (e.g.main.leo
).modules
: A list of paths to module.leo
files associated with the main file.handler
: The compiler’s diagnostic handler for reporting errors.node_builder
: Utility for constructing unique node IDs in the AST.network
: The target network.
§Returns
Ok(Ast)
: If parsing succeeds.Err(CompilerError)
: If file I/O or parsing fails.
§Behavior
- Reads the contents of the main file and all modules.
- Registers each source file with the compiler’s source map (via
with_session_globals
). - Invokes the parser to produce the full AST including modules.
fn new_impl( leo_source_files: &[(PathBuf, Vec<PathBuf>)], aleo_source_files: &mut dyn Iterator<Item = &Path>, signer: Value, block_height: u32, network: NetworkName, ) -> Result<Self>
pub fn save_cursor(&mut self)
Sourcepub fn restore_cursor(&mut self) -> bool
pub fn restore_cursor(&mut self) -> bool
Returns false if there was no saved cursor to restore.
fn get_aleo_program(path: &Path) -> Result<Program<TestnetV0>>
Sourcepub fn update_watchpoints(&mut self) -> Result<bool>
pub fn update_watchpoints(&mut self) -> Result<bool>
Returns true if any watchpoints changed.
pub fn action(&mut self, act: InterpreterAction) -> Result<Option<Value>>
pub fn view_current(&self) -> Option<impl Display>
pub fn view_current_in_context(&self) -> Option<(impl Display, usize, usize)>
fn current_program_and_line(&self) -> Option<(String, usize)>
fn current_span(&self) -> Option<Span>
Auto Trait Implementations§
impl !Freeze for Interpreter
impl !RefUnwindSafe for Interpreter
impl !Send for Interpreter
impl !Sync for Interpreter
impl Unpin for Interpreter
impl !UnwindSafe for Interpreter
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more