change wording of QueryCannotBePostedAsFact to QueryCannotBeDefinedAsFact, remove old commented code in read.rs
This commit is contained in:
@@ -358,12 +358,12 @@ impl MachineError {
|
|||||||
SessionError::ParserError(err) => {
|
SessionError::ParserError(err) => {
|
||||||
Self::syntax_error(h, err)
|
Self::syntax_error(h, err)
|
||||||
}
|
}
|
||||||
SessionError::QueryCannotBePostedAsGoal => {
|
SessionError::QueryCannotBeDefinedAsFact => {
|
||||||
Self::permission_error(
|
Self::permission_error(
|
||||||
h,
|
h,
|
||||||
Permission::Create,
|
Permission::Create,
|
||||||
"static_procedure",
|
"static_procedure",
|
||||||
functor!("query_cannot_be_posted_as_goal")
|
functor!("query_cannot_be_defined_as_fact")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -707,7 +707,7 @@ pub enum SessionError {
|
|||||||
ModuleDoesNotContainExport(ClauseName, PredicateKey),
|
ModuleDoesNotContainExport(ClauseName, PredicateKey),
|
||||||
NamelessEntry,
|
NamelessEntry,
|
||||||
OpIsInfixAndPostFix(ClauseName),
|
OpIsInfixAndPostFix(ClauseName),
|
||||||
QueryCannotBePostedAsGoal,
|
QueryCannotBeDefinedAsFact,
|
||||||
ParserError(ParserError),
|
ParserError(ParserError),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1290,7 +1290,7 @@ impl<'a> TopLevelBatchWorker<'a> {
|
|||||||
TopLevel::Declaration(decl) =>
|
TopLevel::Declaration(decl) =>
|
||||||
return Ok(Some(decl)),
|
return Ok(Some(decl)),
|
||||||
TopLevel::Query(_) =>
|
TopLevel::Query(_) =>
|
||||||
return Err(SessionError::QueryCannotBePostedAsGoal),
|
return Err(SessionError::QueryCannotBeDefinedAsFact),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,38 +167,8 @@ impl<'a> TermWriter<'a> {
|
|||||||
&TermRef::Clause(..) => {
|
&TermRef::Clause(..) => {
|
||||||
Addr::Str(h)
|
Addr::Str(h)
|
||||||
}
|
}
|
||||||
&TermRef::PartialString(..) => {//_, _, ref pstr, tail) => {
|
&TermRef::PartialString(..) => {
|
||||||
Addr::PStrLocation(h, 0)
|
Addr::PStrLocation(h, 0)
|
||||||
/*
|
|
||||||
match tail {
|
|
||||||
Term::AnonVar => {
|
|
||||||
let h = self.machine_st.heap.h();
|
|
||||||
self.machine_st.heap.allocate_pstr(pstr);
|
|
||||||
|
|
||||||
Addr::PStrLocation(h, 0)
|
|
||||||
}
|
|
||||||
Term::Constant(_, Constant::EmptyList) => {
|
|
||||||
self.machine_st.heap.put_complete_string(pstr)
|
|
||||||
}
|
|
||||||
Term::Var(_, ref var) => {
|
|
||||||
let h = self.machine_st.heap.h();
|
|
||||||
|
|
||||||
self.machine_st.heap.allocate_pstr(pstr);
|
|
||||||
let tail_h = self.machine_st.heap.h() - 1;
|
|
||||||
|
|
||||||
if let Some(addr) = self.var_dict.get(var) {
|
|
||||||
self.machine_st.heap[tail_h] = HeapCellValue::Addr(*addr);
|
|
||||||
} else {
|
|
||||||
self.var_dict.insert(var.clone(), Addr::HeapCell(tail_h));
|
|
||||||
}
|
|
||||||
|
|
||||||
Addr::PStrLocation(h, 0)
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -319,8 +319,8 @@ impl fmt::Display for SessionError {
|
|||||||
&SessionError::ParserError(ref e) => {
|
&SessionError::ParserError(ref e) => {
|
||||||
write!(f, "syntax_error({})", e.as_str())
|
write!(f, "syntax_error({})", e.as_str())
|
||||||
}
|
}
|
||||||
&SessionError::QueryCannotBePostedAsGoal => {
|
&SessionError::QueryCannotBeDefinedAsFact => {
|
||||||
write!(f, "query forms cannot be posted as goals.")
|
write!(f, "queries cannot be defined as facts.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user