rem: if (str[0] == 'q' || str[0] == 'Q')
add: if (str.empty() || str[0] == 'q' || str[0] == 'Q')
context: main(){    BOOST_SPIRIT_DEBUG_RULE(integer);    BOOST_SPIRIT_DEBUG_RULE(factor);    BOOST_SPIRIT_DEBUG_RULE(term);    BOOST_SPIRIT_DEBUG_RULE(expression);    //  Start grammar definition    integer     =   leaf_node_d[ lexeme_d[ (!ch_p('-') >> +digit_p) ] ];    factor      =   integer                |   inner_node_d[ch_p('(') >> expression >> ch_p(')')]                |   (root_node_d[ch_p('-')] >> factor);    term        =   factor >>                    *(  (root_node_d[ch_p('*')] >> factor)                      | (root_node_d[ch_p('/')] >> factor)                    );    expression  =   term >>                    *(  (root_node_d[ch_p('+')] >> term)                      | (root_node_d[ch_p('-')] >> term)                    );    //  End grammar definition    cout << "/////////////////////////////////////////////////////////\n\n";    cout << "\t\tThe simplest working calculator...\n\n";    cout << "/////////////////////////////////////////////////////////\n\n";    cout << "Type an expression...or [q or Q] to quit\n\n";    string str;    while (getline(cin, str))    {        if (str[0] == 'q' || str[0] == 'Q')            break;        const char* str_begin = str.c_str();        const char* str_end = str.c_str();        while (*str_end)            ++str_end;        scanner_t scan(str_begin, str_end);        parse_tree_match_t hit = expression.parse(scan);        if (hit && str_begin == str_end)        {#if defined(BOOST_SPIRIT_DUMP_PARSETREE_AS_XML)            // dump parse tree as XML            std::map<rule_id, std::string> rule_names;            rule_names[&integer] = "integer";            rule_names[&factor] = "factor";            rule_names[&term] = "term";            rule_names[&expression] = "expression";            tree_to_xml(cout, hit.trees, str.c_str(), rule_names);#endif            // print the result            cout << "parsing succeeded\n";            cout << "result = " << evaluate(hit) << "\n\n";        }        else        {            cout << "parsing failed\n";        }    }    cout << "Bye... :-) \n\n";    return 0;}