We do a little... whatever... value printing.
This commit is contained in:
parent
1c4b04dc6d
commit
9bf1a6b633
|
@ -1,4 +1,4 @@
|
||||||
use crate::{error::Error, syntax::parser::parse};
|
use crate::{error::Error, interpreter::value::Value, syntax::parser::parse};
|
||||||
use rustyline::{error::ReadlineError, Editor};
|
use rustyline::{error::ReadlineError, Editor};
|
||||||
|
|
||||||
pub fn repl() -> rustyline::Result<()> {
|
pub fn repl() -> rustyline::Result<()> {
|
||||||
|
@ -7,7 +7,9 @@ pub fn repl() -> rustyline::Result<()> {
|
||||||
loop {
|
loop {
|
||||||
match rl.readline(prompt) {
|
match rl.readline(prompt) {
|
||||||
Ok(line) => match parse(&line) {
|
Ok(line) => match parse(&line) {
|
||||||
Ok(values) => values.iter().for_each(|e| println!("{e}")),
|
Ok(values) => values
|
||||||
|
.into_iter()
|
||||||
|
.for_each(|e| println!("{}", Into::<Value>::into(e))),
|
||||||
Err(e) => e.into_iter().map(Error::Parse).for_each(|e| {
|
Err(e) => e.into_iter().map(Error::Parse).for_each(|e| {
|
||||||
if let Err(e) = e.report(&line) {
|
if let Err(e) = e.report(&line) {
|
||||||
eprintln!("Failed to generate error report\n{e:?}")
|
eprintln!("Failed to generate error report\n{e:?}")
|
||||||
|
|
Loading…
Reference in a new issue