xo-reader: fix hardwired debug flag
This commit is contained in:
parent
1d40b5da55
commit
20b105d909
7 changed files with 20 additions and 15 deletions
|
|
@ -7,7 +7,10 @@
|
|||
|
||||
// presumeably replxx assumes input is a tty
|
||||
//
|
||||
bool replxx_getline(bool interactive, std::size_t parser_stack_size, replxx::Replxx & rx, std::string& input)
|
||||
bool replxx_getline(bool interactive,
|
||||
std::size_t parser_stack_size,
|
||||
replxx::Replxx & rx,
|
||||
std::string& input)
|
||||
{
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -58,7 +61,8 @@ welcome(std::ostream& os)
|
|||
}
|
||||
|
||||
int
|
||||
main() {
|
||||
main()
|
||||
{
|
||||
using namespace replxx;
|
||||
using namespace xo::scm;
|
||||
using xo::scm::Expression;
|
||||
|
|
|
|||
|
|
@ -165,7 +165,11 @@ namespace xo {
|
|||
**/
|
||||
explicit parser(bool debug_flag);
|
||||
|
||||
/** true if parser is at top-level, i.e. ready for next top-level expression **/
|
||||
bool debug_flag() const { return psm_.debug_flag(); }
|
||||
|
||||
/** true if parser is at top-level,
|
||||
* i.e. ready for next top-level expression
|
||||
**/
|
||||
bool is_at_toplevel() const { return stack_size() == 0; }
|
||||
|
||||
/** for diagnostics: number of entries in parser stack **/
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ namespace xo {
|
|||
public:
|
||||
explicit reader(bool debug_flag);
|
||||
|
||||
bool debug_flag() const { return parser_.debug_flag(); }
|
||||
|
||||
/** call once before calling .read_expr()
|
||||
* for a new interactive session
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -68,8 +68,7 @@ namespace xo {
|
|||
exprstate::on_def_token(const token_type & tk,
|
||||
parserstatemachine * p_psm)
|
||||
{
|
||||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
scope log(XO_DEBUG(p_psm->debug_flag()));
|
||||
|
||||
log && log(xtag("exstype", p_psm->top_exprstate().exs_type()));
|
||||
|
||||
|
|
@ -357,8 +356,7 @@ namespace xo {
|
|||
exprstate::on_input(const token_type & tk,
|
||||
parserstatemachine * p_psm)
|
||||
{
|
||||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
scope log(XO_DEBUG(p_psm->debug_flag()));
|
||||
log && log(xtag("tk", tk));
|
||||
log && log(xtag("state", *this));
|
||||
log && log(xtag("psm", p_psm));
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace xo {
|
|||
|
||||
void
|
||||
exprstatestack::push_exprstate(std::unique_ptr<exprstate> exs) {
|
||||
constexpr bool c_debug_flag = true;
|
||||
constexpr bool c_debug_flag = false;
|
||||
scope log(XO_DEBUG(c_debug_flag),
|
||||
xtag("exs", exs.get()));
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ namespace xo {
|
|||
|
||||
std::unique_ptr<exprstate>
|
||||
exprstatestack::pop_exprstate() {
|
||||
constexpr bool c_debug_flag = true;
|
||||
constexpr bool c_debug_flag = false;
|
||||
scope log(XO_DEBUG(c_debug_flag),
|
||||
xtag("top.exstype", top_exprstate().exs_type()));
|
||||
|
||||
|
|
|
|||
|
|
@ -339,8 +339,7 @@ namespace xo {
|
|||
progress_xs::on_expr_with_semicolon(bp<Expression> expr,
|
||||
parserstatemachine * p_psm)
|
||||
{
|
||||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
scope log(XO_DEBUG(p_psm->debug_flag()));
|
||||
|
||||
log && log(xtag("lhs", lhs_), xtag("op", op_type_), xtag("expr", expr));
|
||||
|
||||
|
|
@ -606,8 +605,7 @@ namespace xo {
|
|||
progress_xs::on_operator_token(const token_type & tk,
|
||||
parserstatemachine * p_psm)
|
||||
{
|
||||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
scope log(XO_DEBUG(p_psm->debug_flag()));
|
||||
|
||||
constexpr const char * c_self_name = "progress_xs::on_operator_token";
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ namespace xo {
|
|||
reader_result
|
||||
reader::read_expr(const span_type & input_arg, bool eof)
|
||||
{
|
||||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
scope log(XO_DEBUG(this->debug_flag()));
|
||||
|
||||
span_type input = input_arg;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue