diff --git a/src/frontends/lean/parser.cpp b/src/frontends/lean/parser.cpp index 9e32dd8c4..9dbd13879 100644 --- a/src/frontends/lean/parser.cpp +++ b/src/frontends/lean/parser.cpp @@ -1724,7 +1724,7 @@ unsigned parser::curr_lbp_core(bool as_tactic) const { else return get_token_info().expr_precedence(); case scanner::token_kind::CommandKeyword: case scanner::token_kind::Eof: - case scanner::token_kind::ScriptBlock: case scanner::token_kind::QuotedSymbol: + case scanner::token_kind::QuotedSymbol: return 0; case scanner::token_kind::Backtick: return m_in_backtick ? 0 : get_max_prec(); @@ -2225,8 +2225,6 @@ bool parser::curr_is_command_like() const { switch (curr()) { case scanner::token_kind::CommandKeyword: return true; - case scanner::token_kind::ScriptBlock: - return true; case scanner::token_kind::Eof: return true; case scanner::token_kind::Keyword: diff --git a/src/frontends/lean/scanner.cpp b/src/frontends/lean/scanner.cpp index d57ce249e..188efa6c7 100644 --- a/src/frontends/lean/scanner.cpp +++ b/src/frontends/lean/scanner.cpp @@ -282,11 +282,6 @@ void scanner::read_until(char const * end_str, char const * error_msg) { } } -auto scanner::read_script_block() -> token_kind { - read_until("*)", "unexpected end of script"); - return token_kind::ScriptBlock; -} - void scanner::move_back(unsigned offset, unsigned u_offset) { lean_assert(m_uskip == 0); if (offset != 0) { @@ -419,18 +414,15 @@ auto scanner::read_key_cmd_id() -> token_kind { } } -static name * g_begin_script_tk = nullptr; static name * g_begin_comment_tk = nullptr; static name * g_begin_comment_block_tk = nullptr; void initialize_scanner() { - g_begin_script_tk = new name("(*"); g_begin_comment_tk = new name("--"); g_begin_comment_block_tk = new name("/-"); } void finalize_scanner() { - delete g_begin_script_tk; delete g_begin_comment_tk; delete g_begin_comment_block_tk; } @@ -468,8 +460,6 @@ auto scanner::scan(environment const & env) -> token_kind { read_single_line_comment(); else if (n == *g_begin_comment_block_tk) read_comment_block(); - else if (n == *g_begin_script_tk) - return read_script_block(); else return k; } else { diff --git a/src/frontends/lean/scanner.h b/src/frontends/lean/scanner.h index cdc20267b..0b2b637bc 100644 --- a/src/frontends/lean/scanner.h +++ b/src/frontends/lean/scanner.h @@ -17,13 +17,13 @@ namespace lean { /** \brief Scanner. The behavior of the scanner is controlled using a token set. - The scanner has builtin support for comments, script blocks, + The scanner has builtin support for comments, identifiers, numerals, decimals, strings. Everything else is only accepted if they are in the token set. */ class scanner { public: - enum class token_kind {Keyword, CommandKeyword, ScriptBlock, Identifier, Numeral, Decimal, String, QuotedSymbol, Backtick, Eof}; + enum class token_kind {Keyword, CommandKeyword, Identifier, Numeral, Decimal, String, QuotedSymbol, Backtick, Eof}; protected: token_table const * m_tokens; std::istream & m_stream; @@ -66,7 +66,6 @@ protected: token_kind read_string(); token_kind read_number(); - token_kind read_script_block(); token_kind read_key_cmd_id(); token_kind read_quoted_symbol(); diff --git a/src/tests/frontends/lean/scanner.cpp b/src/tests/frontends/lean/scanner.cpp index e86368a65..466ab9346 100644 --- a/src/tests/frontends/lean/scanner.cpp +++ b/src/tests/frontends/lean/scanner.cpp @@ -158,7 +158,6 @@ static void tst2() { check("{x}", {tk::Keyword, tk::Identifier, tk::Keyword}); check("\u03BB \u2200 \u2192", {tk::Keyword, tk::Keyword, tk::Keyword}); check_keyword("\u03BB", "fun"); - scan("x10 ... (* print('hello') *) have by"); scan("0..1"); check("0..1", {tk::Numeral, tk::Keyword, tk::Keyword, tk::Numeral}); scan("theorem a : Prop axiom b : Int");