[−][src]Enum endbasic_core::ast::Statement
Represents a statement in the program along all data to execute it.
Variants
Represents a variable assignment.
The first parameter is the reference to the variable to set. The second parameter is the expression to compute the value for the variable.
Represents a call to a builtin command such as PRINT
.
The first parameter is the name of the builtin. The second parameter is the sequence of arguments to pass to the builtin.
Each argument is represented as an optional expression to evaluate and the separator that
was to separate it from the next argument. Because of this, the last argument always
carries ArgSep::End
as the separator. The reason the expression is optional is to support
calls of the form PRINT a, , b
.
Represents an IF
statement.
The first and only parameter is a sequence containing all the branches of the statement.
Each element is a pair of the conditional guard for the branch and the collection of
statements in that branch. The final ELSE
branch, if present, is also included here
and its guard clause is always a true expression.
Represents a FOR
statement.
The first parameter is the loop's iterator name, which is expressed a variable reference that must be either automatic or an integer. The second parameter is the expression to compute the iterator's initial value, which must evaluate to an integer. The third parameter is the condition to test after each body execution, which if false terminates the loop. The fourth parameter is the expression to compute the iterator's next value. The fifth parameter is the collection of statements within the loop.
Note that we do not store the original end and step values, and instead use expressions to represent the loop condition and the computation of the next iterator value. We do this for run-time efficiency. The reason this is possible is because we force the step to be an integer literal at parse time and do not allow it to be an expression.
Represents a WHILE
statement.
The first parameter is the loop's condition. The second parameter is the collection of statements within the loop.
Trait Implementations
impl Debug for Statement
[src]
impl PartialEq<Statement> for Statement
[src]
impl StructuralPartialEq for Statement
[src]
Auto Trait Implementations
impl RefUnwindSafe for Statement
[src]
impl Send for Statement
[src]
impl Sync for Statement
[src]
impl Unpin for Statement
[src]
impl UnwindSafe for Statement
[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>,