1
0
forked from GitHub/gf-core

added option -depth to command gr

This commit is contained in:
krasimir
2010-10-12 13:36:37 +00:00
parent de0354f991
commit 8970184578

View File

@@ -306,14 +306,16 @@ allCommands env@(pgf, mos) = Map.fromList [
("cat","generation category"), ("cat","generation category"),
("lang","uses only functions that have linearizations in all these languages"), ("lang","uses only functions that have linearizations in all these languages"),
("number","number of trees generated"), ("number","number of trees generated"),
("depth","the maximum generation depth"),
("probs", "file with biased probabilities (format 'f 0.4' one by line)") ("probs", "file with biased probabilities (format 'f 0.4' one by line)")
], ],
exec = \opts xs -> do exec = \opts xs -> do
pgf <- optProbs opts (optRestricted opts) pgf <- optProbs opts (optRestricted opts)
gen <- newStdGen gen <- newStdGen
let dp = valIntOpts "depth" 4 opts
let ts = case mexp xs of let ts = case mexp xs of
Just ex -> generateRandomFrom gen pgf ex Just ex -> generateRandomFromDepth gen pgf ex (Just dp)
Nothing -> generateRandom gen pgf (optType opts) Nothing -> generateRandomDepth gen pgf (optType opts) (Just dp)
returnFromExprs $ take (optNum opts) ts returnFromExprs $ take (optNum opts) ts
}), }),
("gt", emptyCommandInfo { ("gt", emptyCommandInfo {