correct get_single_quoted_item, re: #48

This commit is contained in:
Mark Thom
2018-08-30 23:51:15 -06:00
parent ebd62a2c91
commit d9751671c8
2 changed files with 4 additions and 3 deletions

View File

@@ -279,6 +279,7 @@ impl<'a, Formatter: HCValueFormatter, Outputter: HCValueOutputter>
fn print_atom(&mut self, atom: &ClauseName) { fn print_atom(&mut self, atom: &ClauseName) {
match atom.as_str() { match atom.as_str() {
"" => self.outputter.append("''"),
";" | "!" => self.outputter.append(atom.as_str()), ";" | "!" => self.outputter.append(atom.as_str()),
s => if s.chars().all(non_quoted_token) { s => if s.chars().all(non_quoted_token) {
self.outputter.append(atom.as_str()); self.outputter.append(atom.as_str());
@@ -301,7 +302,7 @@ impl<'a, Formatter: HCValueFormatter, Outputter: HCValueOutputter>
} }
fn print_constant(&mut self, c: Constant) { fn print_constant(&mut self, c: Constant) {
match c { match c {
Constant::Atom(ref atom) => Constant::Atom(ref atom) =>
self.print_atom(atom), self.print_atom(atom),
Constant::Char(c) if c == '\n' => Constant::Char(c) if c == '\n' =>
@@ -406,7 +407,7 @@ impl<'a, Formatter: HCValueFormatter, Outputter: HCValueOutputter>
if let Some(loc_data) = self.state_stack.pop() { if let Some(loc_data) = self.state_stack.pop() {
match loc_data { match loc_data {
TokenOrRedirect::Atom(atom) => TokenOrRedirect::Atom(atom) =>
self.outputter.append(atom.as_str()), self.print_atom(&atom),
TokenOrRedirect::NumberedVar(num_var) => TokenOrRedirect::NumberedVar(num_var) =>
self.outputter.append(num_var.as_str()), self.outputter.append(num_var.as_str()),
TokenOrRedirect::Redirect => TokenOrRedirect::Redirect =>