rem: if (str[0] == 'q' || str[0] == 'Q')
add: if (str.empty() || str[0] == 'q' || str[0] == 'Q')
context: main(){    //  Start grammar definition    integer     =   lexeme_d[ token_node_d[ (!ch_p('-') >> +digit_p) ] ];    factor      =   integer                |   '(' >> expression >> ')'                |   ('-' >> factor);    term        =   factor >>                    *(  ('*' >> factor)                      | ('/' >> factor)                    );    expression  =   term >>                    *(  ('+' >> term)                      | ('-' >> 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* first = str.c_str();        tree_parse_info<> info = pt_parse(first, expression);        if (info.full)        {#if defined(BOOST_SPIRIT_DUMP_PARSETREE_AS_XML)            // dump parse tree as XML            std::map<parser_id, std::string> rule_names;            rule_names[integer.id()] = "integer";            rule_names[factor.id()] = "factor";            rule_names[term.id()] = "term";            rule_names[expression.id()] = "expression";            tree_to_xml(cout, info.trees, first, rule_names);#endif            // print the result            cout << "parsing succeeded\n";            cout << "result = " << evaluate(info) << "\n\n";        }        else        {            cout << "parsing failed\n";        }    }    cout << "Bye... :-) \n\n";    return 0;}