1{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}
3module ShellParser(parseCommand, parseTactic) where
9import Text.ParserCombinators.Parsec
10import Text.ParserCombinators.Parsec.Expr
11import Text.ParserCombinators.Parsec.Language
12import qualified Text.ParserCombinators.Parsec.Token as PTok
16type TokenParser a = PTok.TokenParser a
18lexer :: TokenParser ()
19lexer = PTok.makeTokenParser haskellDef
21whiteSpace= PTok.whiteSpace lexer
22lexeme = PTok.lexeme lexer
23symbol = PTok.symbol lexer
24natural = PTok.natural lexer
25parens = PTok.parens lexer
27comma = PTok.comma lexer
28identifier= PTok.identifier lexer
29reserved = PTok.reserved lexer
30operator = PTok.operator lexer
31reservedOp= PTok.reservedOp lexer
34parseCommand = parse pCommand "(input)"
35parseTactic = parse (pTactic >>= return . Tac) "(input)"
37pCommand :: Parser Command
38pCommand = do reserved "theorem"; n <- iName; lchar ':'; ty <- pTerm
40 <|> do reserved "eval"; tm <- pTerm
42 <|> do reserved "print"; n <- iName; return (Print n)
43 <|> do reserved "quit";
46pTactic :: Parser Tactic
47pTactic = do reserved "attack"; return Attack
48 <|> do reserved "claim"; n <- iName; lchar ':'; ty <- pTerm
50 <|> do reserved "fill"; tm <- pTerm; return (Fill tm)
51 <|> do reserved "regret"; return Regret
52 <|> do reserved "solve"; return Solve
53 <|> do reserved "compute"; return Compute
54 <|> do reserved "intro"; n <- iName; return (Intro n)
55 <|> do reserved "eval"; t <- pTerm; return (EvalIn t)
56 <|> do reserved "check"; t <- pTerm; return (CheckIn t)
57 <|> do reserved "focus"; n <- iName; return (Focus n)
58 <|> do reserved "state"; return ProofState
59 <|> do reserved "qed"; return QED
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list