mirror of
https://github.com/anoma/juvix.git
synced 2024-11-23 08:18:43 +03:00
[pretty] improve parentheses wip
This commit is contained in:
parent
d6fd0ae4e0
commit
aea7208d88
@ -3,7 +3,7 @@ module MiniJuvix.Syntax.Concrete.Fixity where
|
||||
import Language.Haskell.TH.Syntax (Lift)
|
||||
import MiniJuvix.Utils.Prelude
|
||||
|
||||
type Precedence = Natural
|
||||
type Precedence = Int
|
||||
|
||||
data UnaryAssoc = AssocPrefix | AssocPostfix
|
||||
deriving stock (Show, Eq, Ord, Lift)
|
||||
|
@ -543,6 +543,32 @@ ppPostfixApplication PostfixApplication {..} = do
|
||||
postfixAppOperator' <- ppSName postfixAppOperator
|
||||
return $ postfixAppParameter' <+> postfixAppOperator'
|
||||
|
||||
data Atomicity =
|
||||
Atom
|
||||
| NoAtom (Fixity, S.NameId)
|
||||
|
||||
atomicity :: Expression -> Atomicity
|
||||
atomicity e = case e of
|
||||
ExpressionIdentifier {} -> Atom
|
||||
ExpressionApplication a -> goApplication a
|
||||
ExpressionInfixApplication a -> goInfixApplication a
|
||||
ExpressionPostfixApplication a -> goPostfixApplication a
|
||||
ExpressionLambda {} -> Atom
|
||||
ExpressionMatch {} -> Atom
|
||||
ExpressionLetBlock {} -> Atom
|
||||
ExpressionUniverse {} -> Atom
|
||||
ExpressionFunction f -> goFunction f
|
||||
where
|
||||
goFunction :: Function 'Scoped -> Atomicity
|
||||
goFunction = undefined
|
||||
goApplication :: Application -> Atomicity
|
||||
goApplication = undefined
|
||||
goInfixApplication :: InfixApplication -> Atomicity
|
||||
goInfixApplication = undefined
|
||||
goPostfixApplication :: PostfixApplication -> Atomicity
|
||||
goPostfixApplication = undefined
|
||||
|
||||
|
||||
ppExpression :: forall r. Members '[Reader Options] r => Expression -> Sem r (Doc Ann)
|
||||
ppExpression = go
|
||||
where
|
||||
|
Loading…
Reference in New Issue
Block a user