improve matching on partial strings as lists
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "scryer-prolog"
|
||||
version = "0.8.77"
|
||||
version = "0.8.78"
|
||||
authors = ["Mark Thom <markjordanthom@gmail.com>"]
|
||||
repository = "https://github.com/mthom/scryer-prolog"
|
||||
description = "A modern Prolog implementation written mostly in Rust."
|
||||
|
||||
@@ -58,8 +58,13 @@ impl CodeOffsets {
|
||||
let is_initial_index = self.lists.is_empty();
|
||||
self.lists.push(Self::add_index(is_initial_index, index));
|
||||
},
|
||||
&Term::Constant(_, Constant::String(_))
|
||||
if !self.flags.double_quotes.is_atom() => { // strings are lists in this case.
|
||||
&Term::Constant(_, Constant::String(ref s))
|
||||
if !self.flags.double_quotes.is_atom() && !s.is_empty() => { // strings are lists in this case.
|
||||
let is_initial_index = self.lists.is_empty();
|
||||
self.lists.push(Self::add_index(is_initial_index, index));
|
||||
},
|
||||
&Term::Constant(_, Constant::String(ref s))
|
||||
if !self.flags.double_quotes.is_atom() && s.is_expandable() => {
|
||||
let is_initial_index = self.lists.is_empty();
|
||||
self.lists.push(Self::add_index(is_initial_index, index));
|
||||
},
|
||||
|
||||
@@ -1496,7 +1496,8 @@ impl MachineState {
|
||||
|
||||
let offset = match addr {
|
||||
Addr::HeapCell(_) | Addr::StackCell(..) | Addr::AttrVar(..) => v,
|
||||
Addr::Con(Constant::String(_)) if !self.flags.double_quotes.is_atom() => l,
|
||||
Addr::Con(Constant::String(ref s)) if !self.flags.double_quotes.is_atom() =>
|
||||
if s.is_empty() && !s.is_expandable() { c } else { l },
|
||||
Addr::Con(_) => c,
|
||||
Addr::Lis(_) => l,
|
||||
Addr::Str(_) => s,
|
||||
|
||||
Reference in New Issue
Block a user