mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Fix minor bug in ITstream
- The lineNumber of token::undefinedToken was being changed instead of just the lineNumber of the return token. - use List::first() and List::last() methods as well
This commit is contained in:
@ -79,7 +79,7 @@ Foam::Istream& Foam::ITstream::read(token& t)
|
|||||||
{
|
{
|
||||||
FatalIOErrorIn
|
FatalIOErrorIn
|
||||||
(
|
(
|
||||||
"ITstream::read(token& t)",
|
"ITstream::read(token&)",
|
||||||
*this
|
*this
|
||||||
) << "attempt to read beyond EOF"
|
) << "attempt to read beyond EOF"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
@ -91,17 +91,16 @@ Foam::Istream& Foam::ITstream::read(token& t)
|
|||||||
setEof();
|
setEof();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t = token::undefinedToken;
|
||||||
|
|
||||||
if (size())
|
if (size())
|
||||||
{
|
{
|
||||||
token::undefinedToken.lineNumber()
|
t.lineNumber() = tokenList::last().lineNumber();
|
||||||
= operator[](size() - 1).lineNumber();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
token::undefinedToken.lineNumber() = lineNumber();
|
t.lineNumber() = lineNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
t = token::undefinedToken;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -110,7 +109,7 @@ Foam::Istream& Foam::ITstream::read(token& t)
|
|||||||
|
|
||||||
Foam::Istream& Foam::ITstream::read(char&)
|
Foam::Istream& Foam::ITstream::read(char&)
|
||||||
{
|
{
|
||||||
notImplemented("Istream& ITstream::read(char& c)");
|
notImplemented("Istream& ITstream::read(char&)");
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,14 +156,13 @@ Foam::Istream& Foam::ITstream::read(char*, std::streamsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Rewind the token stream so that it may be read again
|
|
||||||
Foam::Istream& Foam::ITstream::rewind()
|
Foam::Istream& Foam::ITstream::rewind()
|
||||||
{
|
{
|
||||||
tokenIndex_ = 0;
|
tokenIndex_ = 0;
|
||||||
|
|
||||||
if (size())
|
if (size())
|
||||||
{
|
{
|
||||||
lineNumber_ = operator[](0).lineNumber();
|
lineNumber_ = tokenList::first().lineNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
setGood();
|
setGood();
|
||||||
|
|||||||
Reference in New Issue
Block a user