correct printing of lists when double_quotes is set to atom
This commit is contained in:
@@ -339,8 +339,10 @@ impl<'a, Formatter: HCValueFormatter, Outputter: HCValueOutputter>
|
|||||||
}
|
}
|
||||||
// self.expand_char_list(s);
|
// self.expand_char_list(s);
|
||||||
} else { // for now, == DoubleQuotes::Atom
|
} else { // for now, == DoubleQuotes::Atom
|
||||||
|
let borrowed_str = s.borrow();
|
||||||
|
|
||||||
self.outputter.append("\"");
|
self.outputter.append("\"");
|
||||||
self.outputter.append(s.borrow().as_str());
|
self.outputter.append(&borrowed_str[s.cursor() ..]);
|
||||||
self.outputter.append("\"");
|
self.outputter.append("\"");
|
||||||
},
|
},
|
||||||
Constant::Usize(i) =>
|
Constant::Usize(i) =>
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ impl StringList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn cursor(&self) -> usize {
|
||||||
|
self.cursor
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn head(&self) -> Option<char> {
|
pub fn head(&self) -> Option<char> {
|
||||||
self.borrow()[self.cursor ..].chars().next()
|
self.borrow()[self.cursor ..].chars().next()
|
||||||
|
|||||||
@@ -1786,4 +1786,9 @@ fn test_queries_on_string_lists()
|
|||||||
assert_prolog_success!(&mut wam, "?- matcher(X, Y).",
|
assert_prolog_success!(&mut wam, "?- matcher(X, Y).",
|
||||||
[["X = [a, b, c | _1]", "Y = _1"]]);
|
[["X = [a, b, c | _1]", "Y = _1"]]);
|
||||||
assert_prolog_failure!(&mut wam, "?- matcher(\"abcdef\", Y).");
|
assert_prolog_failure!(&mut wam, "?- matcher(\"abcdef\", Y).");
|
||||||
|
|
||||||
|
submit(&mut wam, "?- set_prolog_flag(double_quotes, chars).");
|
||||||
|
|
||||||
|
assert_prolog_success!(&mut wam, "?- X = \"abc\", X = ['a' | Y], set_prolog_flag(double_quotes, atom).",
|
||||||
|
[["X = \"abc\"", "Y = \"bc\""]]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user