[][src]Struct dark_vm::code::Code

pub struct Code { /* fields omitted */ }

Implementations

impl Code[src]

pub fn new(tokens: VecDeque<Token>) -> Result<Code, Error>[src]

This constructs a new Code struct with the specified tokens. Internally, the tokens are converted to reference counted values.

Arguments

tokens - The tokens from the lexer.

pub fn jump(&mut self, jump_location: i64, pos: usize) -> Option<Error>[src]

This function updates the value_pointer to have the value of jump_location if and only if jump_location is a valid index. Note that counting is 0-based.

Arguments

jump_location - The new value of value_pointer. pos - The position where this was needed.

pub fn relative_jump(&mut self, jump_location: i64, pos: usize) -> Option<Error>[src]

This function updates the value_pointer by the value of jump_location if and only if jump_location is a valid index. Note that counting is 0-based.

Arguments

jump_location - The new value of value_pointer. pos - The position where this was needed.

pub fn set_label_location(
    &mut self,
    label_name: &String,
    pos: usize
) -> Result<(usize, usize), Error>
[src]

Sets the value pointer to the location of the label passed in. If the label name does not exist, an error is reported. Additionally, it returns the position of the label.

Arguments

label_name - The name of the label. pos - The position where this was needed.

pub fn get_label_start_end(&self, label_name: &String) -> Option<(usize, usize)>[src]

This function gets the start and end locations of the given label. This function returns None if the label does not exist.

pub fn get_current_pos(&self) -> usize[src]

This function gets the current value of value pointer.

pub fn is_finished(&self) -> bool[src]

This function returns true if there are no more values in the Code struct.

Trait Implementations

impl Debug for Code[src]

impl Iterator for Code[src]

type Item = Rc<Value>

The type of the elements being iterated over.

Auto Trait Implementations

impl !RefUnwindSafe for Code

impl !Send for Code

impl !Sync for Code

impl Unpin for Code

impl UnwindSafe for Code

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.