summaryrefslogtreecommitdiff
path: root/src/compiler/GF
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2016-06-09 13:12:14 +0000
committerhallgren <hallgren@chalmers.se>2016-06-09 13:12:14 +0000
commit096b4cfceea03007ae1ac7d46080c2a5f8e99688 (patch)
tree58ce3c746cc1782d6a69022781586cf9103c647d /src/compiler/GF
parent617624e2a81ec00dd5484a7e0ee7ca8f21a3ffff (diff)
PGF service & minibar: only show dependency diagrams if the labels are known
+ The PGF service now reads and caches dependency label configuration files. + The grammar info returned by command=grammar has a new boolean field 'hasDependencyLabels' to indicate if dependency labels were found for the grammar. Also, command=deptree will now fail if no labels are present. + The minibar only shows word dependency trees if labels are present. + Also changed the type of getDepLabels from [String] -> Labels to String -> Labels, since all uses were in the form "getDepLabels . lines".
Diffstat (limited to 'src/compiler/GF')
-rw-r--r--src/compiler/GF/Command/Commands.hs4
-rw-r--r--src/compiler/GF/Server.hs2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs
index cf1262f35..ea62ba69a 100644
--- a/src/compiler/GF/Command/Commands.hs
+++ b/src/compiler/GF/Command/Commands.hs
@@ -551,7 +551,7 @@ pgfCommands = Map.fromList [
let outp = valStrOpts "output" "dot" opts
mlab <- case file of
"" -> return Nothing
- _ -> (Just . getDepLabels . lines) `fmap` restricted (readFile file)
+ _ -> (Just . getDepLabels) `fmap` restricted (readFile file)
let lang = optLang pgf opts
let grphs = map (graphvizDependencyTree outp debug mlab Nothing pgf lang) es
if isOpt "conll2latex" opts
@@ -616,7 +616,7 @@ pgfCommands = Map.fromList [
let depfile = valStrOpts "file" "" opts
mlab <- case depfile of
"" -> return Nothing
- _ -> (Just . getDepLabels . lines) `fmap` restricted (readFile depfile)
+ _ -> (Just . getDepLabels) `fmap` restricted (readFile depfile)
let grphs = map (graphvizParseTreeDep mlab pgf lang gvOptions) es
if isFlag "view" opts || isFlag "format" opts
then do
diff --git a/src/compiler/GF/Server.hs b/src/compiler/GF/Server.hs
index 3a193cc33..d5c84b87c 100644
--- a/src/compiler/GF/Server.hs
+++ b/src/compiler/GF/Server.hs
@@ -174,7 +174,7 @@ handle logLn documentroot state0 cache execute1 stateVar
(_ ,_ ,".pgf") -> do --debug $ "PGF service: "++path
wrapCGI $ PS.cgiMain' cache path
(dir,"grammars.cgi",_ ) -> grammarList dir (decoded qs)
- (dir ,"exb.fcgi" ,_ ) -> wrapCGI $ ES.cgiMain' root dir (fst cache)
+ (dir ,"exb.fcgi" ,_ ) -> wrapCGI $ ES.cgiMain' root dir (PS.pgfCache cache)
_ -> serveStaticFile rpath path
where path = translatePath rpath
_ -> return $ resp400 upath