diff options
| author | hallgren <hallgren@chalmers.se> | 2015-03-24 17:37:43 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2015-03-24 17:37:43 +0000 |
| commit | 6d72126ffced8aaee001d1c766dfce41935d9b6d (patch) | |
| tree | b75d142c3c9e3cdd79b369068ce3a2170e32cb8c /src/runtime/haskell | |
| parent | 2041578406b0b8c7e0dfda59387e1ee7078eb79f (diff) | |
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).
Diffstat (limited to 'src/runtime/haskell')
| -rw-r--r-- | src/runtime/haskell/PGF.hs | 6 |
1 files changed, 3 insertions, 3 deletions
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) |
