Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/chemistry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1258,15 +1258,6 @@ fn is_order_ok(mrow: Element) -> bool {
}
}

// from https://learnwithdrscott.com/ionic-bond-definition/
// I don't include the noble gases since they don't interact with other elements and are ruled out elsewhere
// fn has_non_metal_element(elements: &[&str]) -> bool {
// static NON_METAL_ELEMENTS: phf::Set<&str> = phf_set! {
// "H", "B", "C", "N", "O", "F", "Si", "P", "S", "Cl", "As", "Se", "Br", "Te", "I", "At",
// };
// return elements.iter().any(|&e| NON_METAL_ELEMENTS.contains(e));
// }


fn has_noble_element(elements: &[NameStr<'_>]) -> bool {
static NOBLE_ELEMENTS: phf::Set<&str> = phf_set! {
Expand Down
32 changes: 0 additions & 32 deletions src/pretty_print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
use sxd_document_no_unsafe::dom::{Element, ChildOfElement, Attribute};
use sxd_document_no_unsafe::{as_str, as_qname};

// #[allow(dead_code)]
// pub fn pp_doc(doc: &Document) {
// for root_child in doc.root().children() {
// if let ChildOfRoot::Element(e) = root_child {
// format_element(&e, 0);
// break;
// }
// };
// }

/// Pretty-print the MathML represented by `element`.
pub fn mml_to_string(e: Element) -> String {
Expand Down Expand Up @@ -89,23 +80,6 @@ fn handle_special_chars(text: &str) -> String {
}


// /// Pretty print an xpath value.
// /// If the value is a `NodeSet`, the MathML for the node/element is returned.
// pub fn pp_xpath_value(value: Value) {
// use sxd_xpath_no_unsafe::Value;
// use sxd_xpath_no_unsafe::nodeset::Node;
// debug!("XPath value:");
// if let Value::Nodeset(nodeset) = &value {
// for node in nodeset.document_order() {
// match node {
// Node::Element(el) => {debug!("{}", crate::pretty_print::format_element(&el, 1))},
// Node::Text(t) => {debug!("found Text value: {}", t.text())},
// _ => {debug!("found unexpected node type")}
// }
// }
// }
// }

/// Convert YAML to a string using with `indent` amount of space.
pub fn yaml_to_string(yaml: &Yaml, indent: usize) -> String {
let mut result = String::new();
Expand Down Expand Up @@ -288,12 +262,6 @@ impl<'a> YamlEmitter<'a> {
self.compact
}

// fn dump(&mut self, doc: &Yaml) -> EmitResult {
// // write DocumentStart
// writeln!(self.writer, "---")?;
// self.level = -1;
// self.emit_node(doc)
// }

fn write_indent(&mut self) -> EmitResult {
if self.level <= 0 {
Expand Down
11 changes: 0 additions & 11 deletions src/speech.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,6 @@ fn yaml_type_err(yaml: &Yaml, str: &str) -> Error {
anyhow!("Expected {}, found {}", str, yaml_to_type(yaml))
}

// fn yaml_key_err(dict: &Yaml, key: &str, yaml_type: &str) -> String {
// if dict.as_hash().is_none() {
// return format!("Expected dictionary with key '{}', found\n{}", key, yaml_to_string(dict, 1));
// }
// let str = &dict[key];
// if str.is_badvalue() {
// return format!("Did not find '{}' in\n{}", key, yaml_to_string(dict, 1));
// }
// return format!("Type of '{}' is not a {}.\nIt is a {}. YAML value is\n{}",
// key, yaml_type, yaml_to_type(str), yaml_to_string(dict, 0));
// }

fn find_str<'a>(dict: &'a Yaml, key: &'a str) -> Option<&'a str> {
return dict[key].as_str();
Expand Down
Loading