From 4d2716c5a44c910d639dac87d19a23db8f474dff Mon Sep 17 00:00:00 2001 From: joshvera Date: Wed, 29 Jun 2016 10:51:10 -0400 Subject: [PATCH] Add Ternary/Operator/MathAssignment/SubscriptAccess to Alignment --- src/Alignment.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Alignment.hs b/src/Alignment.hs index 0595ea174..12b6d5988 100644 --- a/src/Alignment.hs +++ b/src/Alignment.hs @@ -88,6 +88,10 @@ alignSyntax toJoinThese toNode getRange sources (infos :< syntax) = case syntax Fixed children -> catMaybes $ wrapInBranch Fixed <$> alignBranch getRange (join children) bothRanges Keyed children -> catMaybes $ wrapInBranch (Keyed . Map.fromList) <$> alignBranch (getRange . Prologue.snd) (Map.toList children >>= pairWithKey) bothRanges Object children -> catMaybes $ wrapInBranch Indexed <$> alignBranch getRange (children >>= pairWithTerm) bothRanges + Ternary expr cases -> catMaybes $ wrapInBranch Indexed <$> alignBranch getRange (expr <> join cases) bothRanges + Operator cases -> catMaybes $ wrapInBranch Indexed <$> alignBranch getRange (join cases) bothRanges + MathAssignment key value -> catMaybes $ wrapInBranch Indexed <$> alignBranch getRange (key <> value) bothRanges + SubscriptAccess key value -> catMaybes $ wrapInBranch Indexed <$> alignBranch getRange (key <> value) bothRanges where bothRanges = modifyJoin (fromThese [] []) lineRanges lineRanges = toJoinThese $ actualLineRanges <$> (characterRange <$> infos) <*> sources wrapInBranch constructor = applyThese $ toJoinThese ((\ info (range, children) -> toNode (setCharacterRange info range :< constructor children)) <$> infos)