reading with parser differed from reading from stream, and did not handle missing id number correctly (NumKeyword.cxx)

Revised ex5 and ex7 user_graph.

Through example 7 in examples.fm.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@5448 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2011-06-21 20:34:36 +00:00
parent 2b11772777
commit 67258ef6ef

View File

@ -49,6 +49,7 @@ cxxNumKeyword::read_number_description(CParser & parser)
// skip keyword
parser.copy_token(keyword, ptr);
/*
std::istream::pos_type ptr1 = ptr;
std::string::size_type pos;
std::string token;
@ -72,37 +73,31 @@ cxxNumKeyword::read_number_description(CParser & parser)
// ptr1 = ptr;
}
}
/*
else if ( (pos = token.find_first_of("-")) != std::string::npos )
{
token.replace(pos, 1, " ");
std::istringstream iss(token);
if (!(iss >> this->n_user >> this->n_user_end))
{
std::ostringstream err_oss;
if (parser.next_keyword() >= 0)
{
err_oss << "Reading number range for " << keyword << ".";
}
else
{
err_oss << "Reading number range for keyword.";
}
parser.error_msg(err_oss, CParser::OT_CONTINUE);
parser.incr_input_error();
}
ptr1 = ptr;
}
else
{
std::istringstream iss(token);
iss >> this->n_user;
this->n_user_end = this->n_user;
ptr1 = ptr;
}
*/
// reset get position
//parser.get_iss().seekg(ptr1);
*/
// skip whitespace
while (::isspace(parser.get_iss().peek()))
parser.get_iss().ignore();
// read number
if (::isdigit(parser.get_iss().peek()))
{
parser.get_iss() >> this->n_user;
char ch = parser.get_iss().peek();
if (ch == '-')
{
parser.get_iss() >> ch; // eat '-'
parser.get_iss() >> this->n_user_end;
}
else
{
this->n_user_end = this->n_user;
}
}
else
{
this->n_user = this->n_user_end = 1;
}
// skip whitespace
while (::isspace(parser.get_iss().peek()))