diff options
| author | Krasimir Angelov <kr.angelov@gmail.com> | 2018-05-28 10:14:27 +0200 |
|---|---|---|
| committer | Krasimir Angelov <kr.angelov@gmail.com> | 2018-05-28 10:14:27 +0200 |
| commit | 44e387ec16e72f3a194fc2391b47391fc49c0bab (patch) | |
| tree | 2008c0f8ded8f70f8e533c6c6de263bc7d02bedf /src/runtime/haskell | |
| parent | e862968305af0adbba9adcddc1e2c209602a82a4 (diff) | |
| parent | 1e71e18e212e8f1eb628041067bf244d4410ddec (diff) | |
Merge branch 'master' of https://github.com/GrammaticalFramework/GF
Diffstat (limited to 'src/runtime/haskell')
| -rw-r--r-- | src/runtime/haskell/PGF.hs | 2 | ||||
| -rw-r--r-- | src/runtime/haskell/PGF/Linearize.hs | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/runtime/haskell/PGF.hs b/src/runtime/haskell/PGF.hs index 6c0002a8a..134a13c3b 100644 --- a/src/runtime/haskell/PGF.hs +++ b/src/runtime/haskell/PGF.hs @@ -58,7 +58,7 @@ module PGF( -- * Operations -- ** Linearization - linearize, linearizeAllLang, linearizeAll, bracketedLinearize, tabularLinearizes, + linearize, linearizeAllLang, linearizeAll, bracketedLinearize, bracketedLinearizeAll, tabularLinearizes, groupResults, -- lins of trees by language, removing duplicates showPrintName, 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 |
