mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-03 08:12:51 -06:00
cleanup the code of the PGF interpreter and polish the binary serialization to match the preliminary specification
This commit is contained in:
@@ -25,17 +25,17 @@ buildMorpho pgf lang = Morpho $
|
||||
Nothing -> Map.empty
|
||||
|
||||
collectWords pinfo = Map.fromListWith (++)
|
||||
[(t, [(fun,lbls ! l)]) | (s,e,lbls) <- Map.elems (startCats pinfo)
|
||||
[(t, [(fun,lbls ! l)]) | (CncCat s e lbls) <- Map.elems (cnccats pinfo)
|
||||
, fid <- [s..e]
|
||||
, FApply funid _ <- maybe [] Set.toList (IntMap.lookup fid (pproductions pinfo))
|
||||
, let FFun fun lins = functions pinfo ! funid
|
||||
, PApply funid _ <- maybe [] Set.toList (IntMap.lookup fid (pproductions pinfo))
|
||||
, let CncFun fun lins = cncfuns pinfo ! funid
|
||||
, (l,seqid) <- assocs lins
|
||||
, sym <- elems (sequences pinfo ! seqid)
|
||||
, t <- sym2tokns sym]
|
||||
where
|
||||
sym2tokns (FSymKS ts) = ts
|
||||
sym2tokns (FSymKP ts alts) = ts ++ [t | Alt ts ps <- alts, t <- ts]
|
||||
sym2tokns _ = []
|
||||
sym2tokns (SymKS ts) = ts
|
||||
sym2tokns (SymKP ts alts) = ts ++ [t | Alt ts ps <- alts, t <- ts]
|
||||
sym2tokns _ = []
|
||||
|
||||
lookupMorpho :: Morpho -> String -> [(Lemma,Analysis)]
|
||||
lookupMorpho (Morpho mo) s = maybe [] id $ Map.lookup s mo
|
||||
|
||||
Reference in New Issue
Block a user