diff --git a/src/GF/Command/Commands.hs b/src/GF/Command/Commands.hs index 282bd3066..584535279 100644 --- a/src/GF/Command/Commands.hs +++ b/src/GF/Command/Commands.hs @@ -615,12 +615,15 @@ allCommands cod env@(pgf, mos) = Map.fromList [ }), ("ai", emptyCommandInfo { longname = "abstract_info", - syntax = "ai IDENTIFIER", - synopsis = "provides an information about a function or a category from the abstract syntax", + syntax = "ai IDENTIFIER or ai EXPR", + synopsis = "Provides an information about a function, an expression or a category from the abstract syntax", explanation = unlines [ - "The command has one argument which is either function or a category defined in", - "the abstract syntax of the current grammar. If the argument is a function then", - "its type is printed out. If it is a category then the category definition is printed" + "The command has one argument which is either function, expression or", + "a category defined in the abstract syntax of the current grammar. ", + "If the argument is a function then ?its type is printed out.", + "If it is a category then the category definition is printed.", + "If a whole expression is given it prints the expression with refined", + "metavariables and the type of the expression." ], exec = \opts arg -> do case arg of diff --git a/src/PGF/Expr.hs b/src/PGF/Expr.hs index 97eb49f00..48d286ea1 100644 --- a/src/PGF/Expr.hs +++ b/src/PGF/Expr.hs @@ -186,10 +186,11 @@ ppExpr d scope (EFun f) = ppCId f ppExpr d scope (EVar i) = ppCId (scope !! i) ppExpr d scope (ETyped e ty)= ppParens (d > 0) (ppExpr 0 scope e PP.<+> PP.colon PP.<+> ppType 0 scope ty) +ppPatt :: Int -> [CId] -> Patt -> ([CId],PP.Doc) ppPatt d scope (PApp f ps) = let (scope',ds) = mapAccumL (ppPatt 2) scope ps in (scope',ppParens (not (List.null ps) && d > 1) (ppCId f PP.<+> PP.hsep ds)) ppPatt d scope (PLit l) = (scope,ppLit l) -ppPatt d scope (PVar f) = (scope,ppCId f) +ppPatt d scope (PVar f) = (f:scope,ppCId f) ppPatt d scope PWild = (scope,PP.char '_') ppLit (LStr s) = PP.text (show s)