From 0721f8dbdda4f0f9618d16fb63e1e4e6b43c51b4 Mon Sep 17 00:00:00 2001 From: Trouble-Truffle Date: Wed, 23 Mar 2022 20:49:03 +0800 Subject: [PATCH] made table mode useful again --- CHANGELOG.md | 4 ++++ src/Process.hs | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2323b8e..efebf76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,3 +30,7 @@ :i -- Print options ``` * Accidentally made table mode useless + + +* 2.0.0.1 -- 2022-03-23 + ** Made table mode useful again diff --git a/src/Process.hs b/src/Process.hs index 86ebdc7..d44e6d4 100644 --- a/src/Process.hs +++ b/src/Process.hs @@ -40,10 +40,11 @@ flattenForm xs = applyUntil (all isElem) (concatMap foldForm) $ groupForm xs reactProdP :: Parser ([Element], [Element]) reactProdP = ((,) `on` (flattenForm . concat)) - <$> formulaP `sepByParser` charP '+' + <$> formulaP' `sepByParser` charP '+' <*> (whiteSpace *> separators - *> formulaP `sepByParser` charP '+') + *> formulaP' `sepByParser` charP '+') where + formulaP' = (\a b -> map (onLeaforBranch (second (*a)) (second (*a))) b) <$> (whiteSpace *> numP <|> pure 1) <*> formulaP separators = foldr1 (<|>) [ stringP x | x <- ["->", "→", "\\rightarrow"] ]