2014-01-14 00:54:21 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "util/exception.h"
|
|
|
|
#include "kernel/pos_info_provider.h"
|
2014-04-30 17:28:07 +00:00
|
|
|
#include "library/io_state_stream.h"
|
2014-01-14 00:54:21 +00:00
|
|
|
|
|
|
|
namespace lean {
|
2014-07-31 19:45:54 +00:00
|
|
|
/** \brief Auxiliary object for "inserting" delimiters for flycheck */
|
|
|
|
class flycheck_scope {
|
|
|
|
io_state_stream const & m_ios;
|
2014-08-01 02:54:21 +00:00
|
|
|
bool m_flycheck;
|
2014-07-31 19:45:54 +00:00
|
|
|
public:
|
2014-08-01 00:41:39 +00:00
|
|
|
flycheck_scope(io_state_stream const & ios, char const * kind);
|
2014-07-31 19:45:54 +00:00
|
|
|
~flycheck_scope();
|
|
|
|
};
|
|
|
|
|
2014-08-01 00:41:39 +00:00
|
|
|
struct flycheck_error : public flycheck_scope {
|
|
|
|
flycheck_error(io_state_stream const & ios):flycheck_scope(ios, "ERROR") {}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct flycheck_warning : public flycheck_scope {
|
|
|
|
flycheck_warning(io_state_stream const & ios):flycheck_scope(ios, "WARNING") {}
|
|
|
|
};
|
|
|
|
|
2014-08-01 02:54:21 +00:00
|
|
|
class flyinfo_scope {
|
|
|
|
io_state_stream const & m_ios;
|
|
|
|
bool m_flyinfo;
|
|
|
|
public:
|
|
|
|
flyinfo_scope(io_state_stream const & ios);
|
|
|
|
~flyinfo_scope();
|
2014-08-01 00:41:39 +00:00
|
|
|
};
|
|
|
|
|
2014-06-29 16:47:25 +00:00
|
|
|
/**
|
|
|
|
\brief Display position information associated with \c e (IF avaiable).
|
|
|
|
If it is not available, it just displays "error:"
|
|
|
|
*/
|
|
|
|
void display_error_pos(io_state_stream const & ios, pos_info_provider const * p, expr const & e);
|
2014-01-14 00:54:21 +00:00
|
|
|
/**
|
|
|
|
\brief Display exception in the regular stream of \c ios, using the configuration options and formatter from \c ios.
|
|
|
|
Exceptions that contain expressions use the given \c pos_info_provider (if available) to retrieve line number information.
|
|
|
|
*/
|
2014-04-30 17:28:07 +00:00
|
|
|
void display_error(io_state_stream const & ios, pos_info_provider const * p, exception const & ex);
|
2014-01-14 00:54:21 +00:00
|
|
|
}
|