diff options
| author | Prasanth Kolachina <pkolachi@users.noreply.github.com> | 2018-05-24 09:52:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-24 09:52:48 +0200 |
| commit | 19c6090e8555fe3d5225f36d481792aaa7e5259f (patch) | |
| tree | 7357a63e20abe5af7599010c3037ca6ab44a6477 /src/runtime/haskell/PGF/Linearize.hs | |
| parent | 10df5a7269721ab0807ec7a0fe4b75cd1bb16d87 (diff) | |
| parent | ef4731e8ba5cada83b97b6d8068366f68bd8adff (diff) | |
Merge pull request #50 from pkolachi/master
function for linearizing variants (bracketedStringAll)
Diffstat (limited to 'src/runtime/haskell/PGF/Linearize.hs')
| -rw-r--r-- | src/runtime/haskell/PGF/Linearize.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/runtime/haskell/PGF/Linearize.hs b/src/runtime/haskell/PGF/Linearize.hs index e3e8d92db..5fdb186c1 100644 --- a/src/runtime/haskell/PGF/Linearize.hs +++ b/src/runtime/haskell/PGF/Linearize.hs @@ -4,6 +4,7 @@ module PGF.Linearize , linearizeAll , linearizeAllLang , bracketedLinearize + , bracketedLinearizeAll , tabularLinearizes ) where @@ -47,6 +48,12 @@ bracketedLinearize pgf lang = head . map (snd . untokn Nothing . firstLin cnc) . head [] = [] head (bs:bss) = bs +-- | Linearizes given expression as a bracketed string in the language +bracketedLinearizeAll :: PGF -> Language -> Tree -> [[BracketedString]] +bracketedLinearizeAll pgf lang = map (snd . untokn Nothing . firstLin cnc) . linTree pgf cnc + where + cnc = lookMap (error "no lang") lang (concretes pgf) + firstLin cnc arg@(ct@(cat,n_fid),fid,fun,es,(xs,lin)) = case IntMap.lookup fid (linrefs cnc) of Just (funid:_) -> snd (mkLinTable cnc (const True) [] funid [arg]) ! 0 |
