mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-14 17:35:03 +01:00
remove prints
This commit is contained in:
parent
9ed7998401
commit
f222e0cb10
3 changed files with 14 additions and 22 deletions
|
|
@ -1,10 +1,10 @@
|
||||||
//!
|
//!
|
||||||
//! This modules handles error reporting in the interpreter
|
//! This modules handles error reporting in the interpreter
|
||||||
//!
|
//!
|
||||||
//! The `span` submodule handles Spans, which are used for tracking locations in the source code.
|
//! The `span` submodule handles Spans, which are used for tracking locations in the source code.
|
||||||
//!
|
//!
|
||||||
//! There is a single type `CompilerError` that can be created from anywhere, and reported using
|
//! There is a single type `CompilerError` that can be created from anywhere, and reported using
|
||||||
//! functions from here.
|
//! functions from here.
|
||||||
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
|
|
@ -101,11 +101,11 @@ pub fn display_error(source: &str, error: CompilerError) {
|
||||||
if chars + line.len() > span.start {
|
if chars + line.len() > span.start {
|
||||||
let offset_on_line = span.start - chars;
|
let offset_on_line = span.start - chars;
|
||||||
|
|
||||||
println!("{}error: {}{}", RED, error.message, RESET);
|
eprintln!("{}error: {}{}", RED, error.message, RESET);
|
||||||
println!(" {}|{}", CYAN, RESET);
|
eprintln!(" {}|{}", CYAN, RESET);
|
||||||
println!("{}{:>5} |{} {}", CYAN, idx + 1, RESET, line);
|
eprintln!("{}{:>5} |{} {}", CYAN, idx + 1, RESET, line);
|
||||||
print!(" {}|{} ", CYAN, RESET);
|
eprint!(" {}|{} ", CYAN, RESET);
|
||||||
println!(
|
eprintln!(
|
||||||
"{}{}{}{}",
|
"{}{}{}{}",
|
||||||
" ".repeat(offset_on_line),
|
" ".repeat(offset_on_line),
|
||||||
RED,
|
RED,
|
||||||
|
|
@ -113,8 +113,8 @@ pub fn display_error(source: &str, error: CompilerError) {
|
||||||
RESET,
|
RESET,
|
||||||
);
|
);
|
||||||
if let Some(note) = error.note {
|
if let Some(note) = error.note {
|
||||||
println!(" {}|{}", CYAN, RESET);
|
eprintln!(" {}|{}", CYAN, RESET);
|
||||||
println!(
|
eprintln!(
|
||||||
" {}|{} {}note: {}{}",
|
" {}|{} {}note: {}{}",
|
||||||
CYAN, RESET, GREEN, note, RESET
|
CYAN, RESET, GREEN, note, RESET
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ pub fn run_program(program: &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process_ast(program: &str, ast: Program, mut runtime: RtAlloc) {
|
fn process_ast(program: &str, ast: Program, mut runtime: RtAlloc) {
|
||||||
println!("AST:\n{:?}\n", ast);
|
// println!("AST:\n{:?}\n", ast);
|
||||||
|
|
||||||
let bytecode_alloc = Bump::new();
|
let bytecode_alloc = Bump::new();
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ fn process_ast(program: &str, ast: Program, mut runtime: RtAlloc) {
|
||||||
|
|
||||||
match bytecode {
|
match bytecode {
|
||||||
Ok(code) => {
|
Ok(code) => {
|
||||||
println!("Bytecode:\n{:#?}\n", code);
|
// println!("Bytecode:\n{:#?}\n", code);
|
||||||
|
|
||||||
let result = vm::execute(&code, runtime);
|
let result = vm::execute(&code, runtime);
|
||||||
if let Err(result) = result {
|
if let Err(result) = result {
|
||||||
|
|
|
||||||
10
test.dil
10
test.dil
|
|
@ -1,9 +1 @@
|
||||||
let x = 5;
|
print "hi brit";
|
||||||
print x + 4;
|
|
||||||
|
|
||||||
let test = x + 6 * 159353.004;
|
|
||||||
print test;
|
|
||||||
|
|
||||||
if x > test {
|
|
||||||
print "lmao";
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue