forked from GitHub/gf-core
random gen to fill given term
This commit is contained in:
@@ -173,15 +173,17 @@ execC co@(comm, opts0) sa@((st,(h,_)),a) = case comm of
|
||||
CTranslate il ol -> do
|
||||
let a' = opST2CommandArg (optParseArgErr opts (sgr il)) a
|
||||
returnArg (opTS2CommandArg (optLinearizeTreeVal opts (sgr ol)) a') sa
|
||||
CGenerateRandom n -> case a of
|
||||
ASTrm _ -> do
|
||||
case s2t a of
|
||||
ATrms [trm] -> do
|
||||
CGenerateRandom n -> do
|
||||
let
|
||||
a' = case a of
|
||||
ASTrm _ -> s2t a
|
||||
_ -> a
|
||||
case a' of
|
||||
ATrms (trm:_) -> do
|
||||
g <- newStdGen
|
||||
case (goFirstMeta (tree2loc trm) >>= refineRandom g 41 cgr) of
|
||||
Ok trm' -> returnArg (ATrms [loc2tree trm']) sa
|
||||
Bad s -> returnArg (AError s) sa
|
||||
_ -> returnArg a sa
|
||||
_ -> do
|
||||
ts <- randomTreesIO opts gro (optIntOrN opts flagNumber n)
|
||||
returnArg (ATrms ts) sa
|
||||
|
||||
Reference in New Issue
Block a user