From 6d72126ffced8aaee001d1c766dfce41935d9b6d Mon Sep 17 00:00:00 2001 From: hallgren Date: Tue, 24 Mar 2015 17:37:43 +0000 Subject: PGF Service: add an option to return syntax trees in JSON format The parse/translate/c-parse/c-translate commands now recognize the option jsontree=true to augment the returned JSON structure with a field called "jsontree" next to the field "tree", or "jsontrees" next to "trees", containing the the returned syntax tree in JSON format (the same format returned by the abstrjson command, similar to the format returned in the "brackets" field). --- src/runtime/haskell/PGF.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/runtime/haskell') diff --git a/src/runtime/haskell/PGF.hs b/src/runtime/haskell/PGF.hs index 8c901c7a9..d2e70166c 100644 --- a/src/runtime/haskell/PGF.hs +++ b/src/runtime/haskell/PGF.hs @@ -349,12 +349,12 @@ browse pgf id = fmap (\def -> (def,producers,consumers)) definition expIds _ ids = ids -- | A type for plain applicative trees -data ATree = Other Tree | App CId [ATree] deriving Show -data Trie = Oth Tree | Ap CId [[Trie ]] deriving Show +data ATree t = Other t | App CId [ATree t] deriving Show +data Trie = Oth Tree | Ap CId [[Trie ]] deriving Show -- ^ A type for tries of plain applicative trees -- | Convert a 'Tree' to an 'ATree' -toATree :: Tree -> ATree +toATree :: Tree -> ATree Tree toATree e = maybe (Other e) app (unApp e) where app (f,es) = App f (map toATree es) -- cgit v1.2.3