Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hanjoosten committed Jul 10, 2024
1 parent 39c442f commit d5086e5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Ampersand/ADL1/P2A_Converters.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ pDecl2aDecl typ cptMap maybePatName defLanguage defFormat pd =
P_Rfx -> [Rfx]
P_Irf -> [Irf]
P_Prop -> [Sym, Asy]
P_Fun -> [Uni, Tot]
P_Map -> [Uni, Tot]
P_Bij -> [Inj, Sur]

decSign = pSign2aSign cptMap (dec_sign pd)
Expand Down
2 changes: 1 addition & 1 deletion src/Ampersand/Commands/AtlasImport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ instance JSON.FromJSON PProp where
"rfx" -> pure P_Rfx
"irf" -> pure P_Irf
"prop" -> pure P_Prop
"fun" -> pure P_Fun
"map" -> pure P_Map
"bij" -> pure P_Bij
_ ->
JSON.unexpected val
Expand Down
2 changes: 1 addition & 1 deletion src/Ampersand/Core/A2P_Converters.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ aProps2Pprops aps
`elem` xs
&& P_Tot
`elem` xs =
Set.singleton P_Fun `Set.union` aProps2Pprops (aps Set.\\ Set.fromList [Uni, Tot])
Set.singleton P_Map `Set.union` aProps2Pprops (aps Set.\\ Set.fromList [Uni, Tot])
| P_Inj
`elem` xs
&& P_Sur
Expand Down
8 changes: 5 additions & 3 deletions src/Ampersand/Core/ParseTree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1259,8 +1259,8 @@ data PProp
P_Irf
| -- | PROP keyword, the parser must replace this by [Sym, Asy].
P_Prop
| -- | FUN keyword, the parser must replace this by [Uni, Tot].
P_Fun
| -- | MAP keyword, the parser must replace this by [Uni, Tot].
P_Map
| -- | BIJ keyword, the parser must replace this by [Inj, Sur].
P_Bij
deriving (Eq, Ord, Typeable, Data, Enum, Bounded)
Expand All @@ -1276,7 +1276,7 @@ instance Show PProp where
show P_Rfx = "RFX"
show P_Irf = "IRF"
show P_Prop = "PROP"
show P_Fun = "FUN"
show P_Map = "MAP"
show P_Bij = "BIJ"

instance Unique PProp where
Expand All @@ -1287,6 +1287,8 @@ instance Flippable PProp where
flp P_Tot = P_Sur
flp P_Sur = P_Tot
flp P_Inj = P_Uni
flp P_Map = P_Bij
flp P_Bij = P_Map
flp x = x

data PRelationDefault
Expand Down
4 changes: 2 additions & 2 deletions src/Ampersand/Input/ADL1/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ pProps :: AmpParser (Set.Set PProp)
pProps = normalizeProps <$> pBrackets (pProp `sepBy` pComma)
where
--- PropList ::= Prop (',' Prop)*
--- Prop ::= 'UNI' | 'INJ' | 'SUR' | 'TOT' | 'SYM' | 'ASY' | 'TRN' | 'RFX' | 'IRF' | 'PROP' |'FUN' | 'BIJ'
--- Prop ::= 'UNI' | 'INJ' | 'SUR' | 'TOT' | 'SYM' | 'ASY' | 'TRN' | 'RFX' | 'IRF' | 'PROP' |'MAP' | 'BIJ'
pProp :: AmpParser PProp
pProp = choice [p <$ pKey (show p) | p <- [minBound ..]]
normalizeProps :: [PProp] -> PProps
Expand All @@ -442,7 +442,7 @@ pProps = normalizeProps <$> pBrackets (pProp `sepBy` pComma)
rep :: PProps -> PProps
rep ps
| P_Prop `elem` ps = Set.fromList [P_Sym, P_Asy] `Set.union` (P_Prop `Set.delete` ps)
| P_Fun `elem` ps = Set.fromList [P_Uni, P_Tot] `Set.union` (P_Fun `Set.delete` ps)
| P_Map `elem` ps = Set.fromList [P_Uni, P_Tot] `Set.union` (P_Map `Set.delete` ps)
| P_Bij `elem` ps = Set.fromList [P_Inj, P_Sur] `Set.union` (P_Bij `Set.delete` ps)
| otherwise = ps
-- add Uni and Inj if ps has neither Sym nor Asy
Expand Down

0 comments on commit d5086e5

Please sign in to comment.