rem: if (str[0] == 'q' || str[0] == 'Q')
add: if (str.empty() || str[0] == 'q' || str[0] == 'Q')
context: main(){    // look in tree_calc_grammar for the definition of calculator    calculator calc;    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;        tree_parse_info<> info = ast_parse(str.c_str(), calc);        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[calculator::integerID] = "integer";            rule_names[calculator::factorID] = "factor";            rule_names[calculator::termID] = "term";            rule_names[calculator::expressionID] = "expression";            tree_to_xml(cout, info.trees, str.c_str(), 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;}