compile special instructions for partial strings when recognized
This commit is contained in:
@@ -17,6 +17,8 @@ pub trait CompilationTarget<'a> {
|
||||
fn to_void(_: usize) -> Self;
|
||||
fn is_void_instr(&self) -> bool;
|
||||
|
||||
fn to_pstr(lvl: Level, string: String, r: RegType, has_tail: bool) -> Self;
|
||||
|
||||
fn incr_void_instr(&mut self);
|
||||
|
||||
fn constant_subterm(_: Constant) -> Self;
|
||||
@@ -62,6 +64,10 @@ impl<'a> CompilationTarget<'a> for FactInstruction {
|
||||
}
|
||||
}
|
||||
|
||||
fn to_pstr(lvl: Level, string: String, r: RegType, has_tail: bool) -> Self {
|
||||
FactInstruction::GetPartialString(lvl, string, r, has_tail)
|
||||
}
|
||||
|
||||
fn incr_void_instr(&mut self) {
|
||||
match self {
|
||||
&mut FactInstruction::UnifyVoid(ref mut incr) => *incr += 1,
|
||||
@@ -117,6 +123,10 @@ impl<'a> CompilationTarget<'a> for QueryInstruction {
|
||||
QueryInstruction::PutList(lvl, reg)
|
||||
}
|
||||
|
||||
fn to_pstr(lvl: Level, string: String, r: RegType, has_tail: bool) -> Self {
|
||||
QueryInstruction::PutPartialString(lvl, string, r, has_tail)
|
||||
}
|
||||
|
||||
fn to_void(subterms: usize) -> Self {
|
||||
QueryInstruction::SetVoid(subterms)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user