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 "quit";
45pTactic :: Parser Tactic
46pTactic = do reserved "attack"; return Attack
47 <|> do reserved "claim"; n <- iname; lchar ':'; ty <- pTerm
49 <|> do reserved "fill"; tm <- pTerm; return (Fill tm)
50 <|> do reserved "regret"; return Regret
51 <|> do reserved "solve"; return Solve
52 <|> do reserved "intro"; n <- iname; return (Intro n)
53 <|> do reserved "state"; return ProofState
54 <|> do reserved "qed"; return QED
57iname = identifier >>= (\n -> return (UN [n]))
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