diff --git a/Cargo.toml b/Cargo.toml index aa4153a..87b4431 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "asciimath-rs" description = "AsciiMath parser" repository = "https://github.com/trivernis/asciimath-rs" -version = "0.5.2" +version = "0.5.3" authors = ["trivernis "] edition = "2018" readme = "README.md" diff --git a/src/format/mathml.rs b/src/format/mathml.rs index 3a5815c..1a8222b 100644 --- a/src/format/mathml.rs +++ b/src/format/mathml.rs @@ -373,7 +373,7 @@ impl ToMathML for Group { fn to_mathml(&self) -> String { match self { Group::Vector(v) => v.to_mathml(), - Group::MSep => ",".to_string(), + Group::MSep => ",".to_string(), Group::Parentheses(p) => p.to_mathml(), Group::Brackets(b) => b.to_mathml(), Group::Braces(b) => b.to_mathml(), diff --git a/src/lib.rs b/src/lib.rs index bb9853a..a59be21 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,7 +40,7 @@ pub fn parse(content: String) -> Expression { #[cfg(test)] mod tests { - use crate::elements::group::{Brackets, Group, Matrix, Vector}; + use crate::elements::group::{Brackets, Group, Matrix, Parentheses, Vector}; use crate::elements::literal::{Literal, Number}; use crate::elements::special::{Expression, Special, Sum}; use crate::elements::Element; @@ -311,7 +311,7 @@ mod tests { #[test] fn it_parses_vectors() { assert_eq!( - parse("((1), (2)) - f".to_string()), + parse("((1), (2))(1,2) - f".to_string()), Expression { children: vec![ Element::Group(Group::Vector(Vector { @@ -328,6 +328,20 @@ mod tests { }] ] })), + Element::Group(Group::Parentheses(Parentheses { + inner: Expression { + children: vec![ + Element::Literal(Literal::Number(Number { + number: "1".to_string() + })), + Element::Group(Group::MSep), + Element::Literal(Literal::Number(Number { + number: "2".to_string() + })) + ] + } + .boxed() + })), Element::Literal(Literal::Operation(Operation::Minus)), Element::Literal(Literal::Function(Function::F)) ]