fix(frontends/lean/parser): tactic notation that may take numerical parameters

This commit is contained in:
Leonardo de Moura 2015-12-17 11:27:31 -08:00
parent 70f71a18c8
commit 2502039a5c
3 changed files with 10 additions and 0 deletions

View file

@ -2025,6 +2025,8 @@ expr parser::parse_tactic_nud() {
}
} else if (curr_is_keyword()) {
return parse_tactic_notation(tactic_nud(), nullptr);
} else if (curr_is_numeral() || curr_is_decimal()) {
return parse_expr();
} else {
throw parser_error("invalid tactic expression", pos());
}

View file

@ -357,6 +357,7 @@ public:
bool curr_is_identifier() const { return curr() == scanner::token_kind::Identifier; }
/** \brief Return true iff the current token is a numeral */
bool curr_is_numeral() const { return curr() == scanner::token_kind::Numeral; }
bool curr_is_decimal() const { return curr() == scanner::token_kind::Decimal; }
/** \brief Return true iff the current token is a string */
bool curr_is_string() const { return curr() == scanner::token_kind::String; }
/** \brief Return true iff the current token is a keyword */

View file

@ -0,0 +1,7 @@
tactic_notation `foo` A := tactic.id
example (a : nat) : a = a :=
begin
foo (10:nat),
reflexivity
end