correct ordinary input
This commit is contained in:
@@ -5,7 +5,6 @@ use prolog::instructions::*;
|
|||||||
use prolog::iterators::*;
|
use prolog::iterators::*;
|
||||||
use prolog::machine::*;
|
use prolog::machine::*;
|
||||||
use prolog::machine::machine_state::MachineState;
|
use prolog::machine::machine_state::MachineState;
|
||||||
use prolog::toplevel::*;
|
|
||||||
|
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::io::{Read, stdin};
|
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)");
|
println!("(type Enter + Ctrl-D to terminate the stream when finished)");
|
||||||
Ok(Input::Batch)
|
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))?))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -669,13 +669,6 @@ impl RelationWorker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// used to parse queries. mostly.
|
|
||||||
pub fn parse_term<R: Read>(wam: &Machine, buf: R) -> Result<Term, ParserError>
|
|
||||||
{
|
|
||||||
let mut parser = Parser::new(buf, wam.atom_tbl(), wam.machine_flags());
|
|
||||||
parser.read_term(composite_op!(&wam.op_dir))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub
|
pub
|
||||||
fn consume_term<'a>(static_code_dir: Rc<RefCell<CodeDir>>, term: Term,
|
fn consume_term<'a>(static_code_dir: Rc<RefCell<CodeDir>>, term: Term,
|
||||||
mut indices: MachineCodeIndices<'a>)
|
mut indices: MachineCodeIndices<'a>)
|
||||||
|
|||||||
Reference in New Issue
Block a user