From 6fc3bbd45794b78c3363060b9491459b414e3066 Mon Sep 17 00:00:00 2001 From: aarne Date: Mon, 2 Jul 2007 13:58:02 +0000 Subject: parsing overloaded constructors as result --- src/GF/Shell.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/GF/Shell.hs') diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs index dd8267a91..139a2ab07 100644 --- a/src/GF/Shell.hs +++ b/src/GF/Shell.hs @@ -30,6 +30,7 @@ import GF.Grammar.Values import GF.UseGrammar.GetTree import GF.UseGrammar.Generate (generateAll) ---- should be in API import GF.UseGrammar.Treebank +import GF.UseGrammar.MakeOverload (getOverloadResults) import GF.Shell.ShellCommands @@ -242,6 +243,9 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com CParse ---- | oElem showMulti opts -> do + | oElem (iOpt "overload") opts -> do + p <- parse $ prCommandArg a + changeArg (opTTs2CommandArg getOverloadResults) p | oElem byLines opts -> do let ss = (if oElem showAll opts then id else filter (not . null)) $ lines $ prCommandArg a @@ -576,3 +580,9 @@ opTT2CommandArg :: (Tree -> Err [Tree]) -> CommandArg -> CommandArg opTT2CommandArg f (ATrms ts) = err AError (ATrms . concat) $ mapM f ts opTT2CommandArg _ (AError s) = AError ("expected term, but got error:" ++++ s) opTT2CommandArg _ a = AError ("expected term, but got:" ++++ prCommandArg a) + +opTTs2CommandArg :: ([Tree] -> [Tree]) -> CommandArg -> CommandArg +opTTs2CommandArg f (ATrms ts) = ATrms $ f ts +opTTs2CommandArg _ (AError s) = AError ("expected terms, but got error:" ++++ s) +opTTs2CommandArg _ a = AError ("expected terms, but got:" ++++ prCommandArg a) + -- cgit v1.2.3