Skip to content

Commit 6120951

Browse files
committed
Fix some parser and pretty printer issues related to extended infix expr changes.
1 parent abfdf5a commit 6120951

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Language/PureScript/Parser/Declarations.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,17 +358,17 @@ parseValueAtom = P.choice
358358
, parseOperatorSection ]
359359

360360
-- |
361-
-- Parse an identifier in backticks or an operator
361+
-- Parse an expression in backticks or an operator
362362
--
363-
parseIdentInfix :: TokenParser Expr
364-
parseIdentInfix = P.between tick tick parseValue
365-
<|> Var <$> parseQualified (Op <$> symbol)
363+
parseInfixExpr :: TokenParser Expr
364+
parseInfixExpr = P.between tick tick parseValue
365+
<|> Var <$> parseQualified (Op <$> symbol)
366366

367367
parseOperatorSection :: TokenParser Expr
368368
parseOperatorSection = parens $ left <|> right
369369
where
370-
right = OperatorSection <$> parseIdentInfix <* indented <*> (Right <$> parseValueAtom)
371-
left = flip OperatorSection <$> (Left <$> parseValueAtom) <* indented <*> parseIdentInfix
370+
right = OperatorSection <$> parseInfixExpr <* indented <*> (Right <$> parseValueAtom)
371+
left = flip OperatorSection <$> (Left <$> parseValueAtom) <* indented <*> parseInfixExpr
372372

373373
parsePropertyUpdate :: TokenParser (String, Maybe Expr)
374374
parsePropertyUpdate = do
@@ -419,7 +419,7 @@ parseValue = withSourceSpan PositionedValue
419419
]
420420
operators = [ [ P.Prefix (P.try (C.indented *> symbol' "-") >> return UnaryMinus)
421421
]
422-
, [ P.Infix (P.try (C.indented *> parseIdentInfix P.<?> "operator") >>= \ident ->
422+
, [ P.Infix (P.try (C.indented *> parseInfixExpr P.<?> "infix expression") >>= \ident ->
423423
return (BinaryNoParens ident)) P.AssocRight
424424
]
425425
]

src/Language/PureScript/Pretty/Values.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ literals = mkPattern' match
7373
, withIndent $ prettyPrintMany prettyPrintDoNotationElement els
7474
, currentIndent
7575
]
76-
match (OperatorSection op (Right val)) = return $ "(" ++ show op ++ " " ++ prettyPrintValue val ++ ")"
77-
match (OperatorSection op (Left val)) = return $ "(" ++ prettyPrintValue val ++ " " ++ show op ++ ")"
76+
match (OperatorSection op (Right val)) = return $ "(" ++ prettyPrintValue op ++ " " ++ prettyPrintValue val ++ ")"
77+
match (OperatorSection op (Left val)) = return $ "(" ++ prettyPrintValue val ++ " " ++ prettyPrintValue op ++ ")"
7878
match (TypeClassDictionary name _ _) = return $ "<<dict " ++ show name ++ ">>"
7979
match (SuperClassDictionary name _) = return $ "<<superclass dict " ++ show name ++ ">>"
8080
match (TypedValue _ val _) = prettyPrintValue' val

0 commit comments

Comments
 (0)