Rename error variants
This commit is contained in:
@@ -9,14 +9,12 @@ fn compile_from_string(
|
||||
input: &safer_ffi::string::String,
|
||||
output: &mut safer_ffi::string::String,
|
||||
) -> bool {
|
||||
let buffer = Vec::<u8>::new();
|
||||
|
||||
let mut writer = BufWriter::new(buffer);
|
||||
let mut writer = BufWriter::new(Vec::new());
|
||||
|
||||
let tokenizer = Tokenizer::from(input.to_string());
|
||||
let parser = Parser::new(tokenizer);
|
||||
|
||||
let compiler = Compiler::new(parser, &mut writer);
|
||||
let compiler = Compiler::new(parser, &mut writer, None);
|
||||
|
||||
let Ok(()) = compiler.compile() else {
|
||||
return false;
|
||||
|
||||
10
src/main.rs
10
src/main.rs
@@ -9,20 +9,20 @@ use std::{
|
||||
io::{BufWriter, Read, Write},
|
||||
path::PathBuf,
|
||||
};
|
||||
use tokenizer::{Tokenizer, TokenizerError};
|
||||
use tokenizer::{self, Tokenizer};
|
||||
|
||||
quick_error! {
|
||||
#[derive(Debug)]
|
||||
enum StationlangError {
|
||||
TokenizerError(err: TokenizerError) {
|
||||
TokenizerError(err: tokenizer::Error) {
|
||||
from()
|
||||
display("Tokenizer error: {}", err)
|
||||
}
|
||||
ParserError(err: parser::ParseError) {
|
||||
ParserError(err: parser::Error) {
|
||||
from()
|
||||
display("Parser error: {}", err)
|
||||
}
|
||||
CompileError(err: compiler::CompileError) {
|
||||
CompileError(err: compiler::Error) {
|
||||
from()
|
||||
display("Compile error: {}", err)
|
||||
}
|
||||
@@ -71,7 +71,7 @@ fn run_logic() -> Result<(), StationlangError> {
|
||||
None => BufWriter::new(Box::new(std::io::stdout())),
|
||||
};
|
||||
|
||||
let compiler = Compiler::new(parser, &mut writer);
|
||||
let compiler = Compiler::new(parser, &mut writer, None);
|
||||
|
||||
compiler.compile()?;
|
||||
writer.flush()?;
|
||||
|
||||
Reference in New Issue
Block a user