@@ -29,10 +29,13 @@ unary_occ name tac = tac <$> (identifier name *> variable)
29
29
variadic_occ :: T. Text -> ([OccName ] -> TacticsM () ) -> Parser (TacticsM () )
30
30
variadic_occ name tac = tac <$> (identifier name *> P. many variable)
31
31
32
-
33
- tactic :: Parser ( TacticsM () )
34
- tactic = flip P. makeExprParser operators $ P. choice
32
+ oneTactic :: Parser ( TacticsM () )
33
+ oneTactic =
34
+ P. choice
35
35
[ braces tactic
36
+ -- TODO(sandy): lean uses braces for control flow, but i always forget
37
+ -- and want to use parens. is there a semantic difference?
38
+ , parens tactic
36
39
, nullary " assumption" assumption
37
40
, unary_occ " assume" assume
38
41
, variadic_occ " intros" $ \ case
@@ -42,19 +45,25 @@ tactic = flip P.makeExprParser operators $ P.choice
42
45
, nullary " destruct_all" destructAll
43
46
, unary_occ " destruct" $ useNameFromHypothesis destruct
44
47
, unary_occ " homo" $ useNameFromHypothesis homo
48
+ , nullary " application" application
45
49
, unary_occ " apply" $ useNameFromHypothesis apply
46
- , unary_occ " split" userSplit
50
+ , nullary " split" split
51
+ , unary_occ " ctor" userSplit
47
52
, nullary " obvious" obvious
48
53
, nullary " auto" auto
49
- , R. try <$> (keyword " try" *> tactic)
50
54
]
51
55
56
+
57
+ tactic :: Parser (TacticsM () )
58
+ tactic = flip P. makeExprParser operators oneTactic
59
+
52
60
bindOne :: TacticsM a -> TacticsM a -> TacticsM a
53
61
bindOne t t1 = t R. <@> [t1]
54
62
55
63
operators :: [[P. Operator Parser (TacticsM () )]]
56
64
operators =
57
65
[ [ P. Prefix (symbol " *" $> R. many_) ]
66
+ , [ P. Prefix (symbol " try" $> R. try) ]
58
67
, [ P. InfixR (symbol " |" $> (R. <%>) )]
59
68
, [ P. InfixL (symbol " ;" $> (>>) )
60
69
, P. InfixL (symbol " ," $> bindOne)
0 commit comments