@@ -38,6 +38,7 @@ topicsFromMetaData md = concatMap (fDef "" sc) ds
38
38
fDef pr sc (DE n es) = []
39
39
fDef pr sc (DK n ks) = [makeTopicMD pr sc n ks]
40
40
fDef pr sc (DC n v) = []
41
+ fDef pr sc (DP n pfx) = []
41
42
fT :: String -> Scope -> T -> [TopicMD ]
42
43
fT pr sc (TDef d) = fDef pr sc d
43
44
fT pr sc (TSeq b t) = fT pr sc t
@@ -179,7 +180,7 @@ xpMetaData = xpWrap (MD, \(MD ds) -> ds) $
179
180
xpElem " MetaData" $ xpAddFixedAttr " version" " 1.0.0" $ xpickle
180
181
181
182
type Name = String
182
- data Def = DT Name T | DM Name [Def ] | DS Name [M ] | DU Name T [UC ] | DE Name [E ] | DC Name Int | DK Name [Name ] deriving (Show , Eq )
183
+ data Def = DT Name T | DM Name [Def ] | DS Name [M ] | DU Name T [UC ] | DE Name [E ] | DC Name Int | DK Name [Name ] | DP Name Name deriving (Show , Eq )
183
184
instance XmlPickler Def where
184
185
xpickle = xpAlt tag ps
185
186
where
@@ -190,6 +191,7 @@ instance XmlPickler Def where
190
191
tag (DE _ _) = 4
191
192
tag (DC _ _) = 5 -- Const isn't part of OSPL meta data, temp for getting enum const in Scope
192
193
tag (DK _ _) = 6 -- Keylist isn't part, but should've been :) (certainly makes parsing IDL easier)
194
+ tag (DP _ _) = 7 -- Field prefix (Haskell specific)
193
195
ps = [ xpWrap (uncurry DT , \ (DT nm t) -> (nm, t)) $
194
196
(xpElem " TypeDef" $ xpPair (xpAttr " name" xpText) xpickle)
195
197
, xpWrap (uncurry DM , \ (DM nm ds) -> (nm, ds)) $
@@ -204,6 +206,8 @@ instance XmlPickler Def where
204
206
(xpElem " Const" $ xpPair (xpAttr " name" xpText) $ xpickle)
205
207
, xpWrap (\ (nm, ks) -> DK nm (splitOn " ," ks), \ (DK nm ks) -> (nm, intercalate " ," ks)) $
206
208
(xpElem " KeyList" $ xpPair (xpAttr " name" xpText) (xpAttr " keys" xpText))
209
+ , xpWrap (\ (nm, pfx) -> DP nm pfx, \ (DP nm pfx) -> (nm, pfx)) $
210
+ (xpElem " FieldPrefix" $ xpPair (xpAttr " name" xpText) (xpAttr " prefix" xpText))
207
211
]
208
212
209
213
data E = E Name Int deriving (Show , Eq )
@@ -307,6 +311,7 @@ cDef ps t@(DE nm es) = res
307
311
cDef ps t@ (DT nm _) = Scope ps [] [(nm, t)]
308
312
cDef ps t@ (DC nm _) = Scope ps [] [(nm, t)]
309
313
cDef ps (DK _ _) = Scope ps [] []
314
+ cDef ps t@ (DP nm pfx) = Scope ps [] [(nm ++ " 'Prefix" , t)] -- a bit of a hack to use a 'Prefix suffix
310
315
311
316
cT :: Maybe Scope -> T -> Scope
312
317
cT ps (TDef d) = cDef ps d
0 commit comments