correct ordinary input

This commit is contained in:
Mark Thom
2018-09-17 20:24:58 -06:00
parent 8eb327c735
commit 43ba8f23dc
2 changed files with 6 additions and 9 deletions

View File

@@ -5,7 +5,6 @@ use prolog::instructions::*;
use prolog::iterators::*;
use prolog::machine::*;
use prolog::machine::machine_state::MachineState;
use prolog::toplevel::*;
use std::collections::VecDeque;
use std::io::{Read, stdin};
@@ -43,7 +42,12 @@ pub fn read_toplevel(wam: &Machine) -> Result<Input, ParserError> {
println!("(type Enter + Ctrl-D to terminate the stream when finished)");
Ok(Input::Batch)
},
_ => Ok(Input::Term(parse_term(wam, buffer.as_bytes())?))
_ => {
let mut parser = Parser::new(stdin.lock(), wam.atom_tbl(), wam.machine_flags());
parser.add_to_top(buffer.as_str());
Ok(Input::Term(parser.read_term(composite_op!(&wam.op_dir))?))
}
}
}