]> Repositorios git - scryer-prolog.git/commitdiff
don't count the terminator in PStrIter len
authorMark Thom <[email protected]>
Wed, 15 Apr 2020 16:07:44 +0000 (10:07 -0600)
committerMark Thom <[email protected]>
Sat, 18 Apr 2020 20:16:40 +0000 (14:16 -0600)
src/prolog/examples/plres.pl
src/prolog/machine/partial_string.rs

index a19ca5a73a9dc7f6c86f5f6a70fc7020edbab801..9bc2931bed606280c86e680410f7def39768e4ef 100644 (file)
@@ -31,6 +31,7 @@
 
 :- use_module(library(dcgs)).
 :- use_module(library(dif)).
+:- use_module(library(format)).
 :- use_module(library(lists)).
 
 pl_resolution(Clauses0, Chain) :-
index eaaad1819ff25af0ad8fdb2379a28adf5fa79ad6..cb95b44c15f579df36fb2ae56e44f8eec1d88d24 100644 (file)
@@ -200,7 +200,7 @@ impl PartialString {
 
     #[inline]
     pub fn range_from(&self, index: RangeFrom<usize>) -> PStrIter {
-        PStrIter::from(self.buf, self.len, index.start)
+        PStrIter::from(self.buf, self.len - '\u{0}'.len_utf8(), index.start)
     }
 
     #[inline]