summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-09-17 13:14:04 +0000
committerkrasimir <krasimir@chalmers.se>2009-09-17 13:14:04 +0000
commit49ca46d95835a74ec581431e668612b3b3589350 (patch)
tree00536e993011df2cdbf621d9c5fc9aef10e95e90 /src
parent6c7330131dab6ac9ba13bbb296c51c6427e06b2b (diff)
bugfix in the ai command
Diffstat (limited to 'src')
-rw-r--r--src/GF/Command/Commands.hs13
-rw-r--r--src/PGF/Expr.hs3
2 files changed, 10 insertions, 6 deletions
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)