Alex Bethel
2c35691ec4
BF functios can now be declared and called from AbleScript code. Function parameters supplied from AbleScript are serialized manually into byte sequences using the `BfWriter` trait, and are available from BF code using the input operator, `,`. At the moment, BF functios simply write output to stdout, and are therefore incapable of communicating results to the rest of the program; this might change in the future if we can get something close to pass-by-reference working.
23 lines
433 B
Rust
23 lines
433 B
Rust
use std::ops::Range;
|
|
|
|
use crate::brian::InterpretError;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Error {
|
|
pub kind: ErrorKind,
|
|
pub position: Range<usize>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub enum ErrorKind {
|
|
SyntaxError(String),
|
|
EndOfTokenStream,
|
|
InvalidIdentifier,
|
|
UnknownVariable(String),
|
|
MeloVariable(String),
|
|
TypeError(String),
|
|
TopLevelBreak,
|
|
ArithmeticError,
|
|
BfInterpretError(InterpretError),
|
|
}
|