Skip to content
Snippets Groups Projects
Commit 21456b8c authored by Mark OLESEN's avatar Mark OLESEN
Browse files

BUG: verbatim token output strips type (#1497)

- use os::write(token) for verbatim string to preserve its type
parent 5d335868
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2017-2018 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -194,12 +194,13 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const token& tok) ...@@ -194,12 +194,13 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const token& tok)
break; break;
case token::tokenType::STRING: case token::tokenType::STRING:
case token::tokenType::VERBATIMSTRING:
os << *tok.data_.stringPtr; os << *tok.data_.stringPtr;
break; break;
case token::tokenType::VARIABLE: case token::tokenType::VARIABLE:
// Behaviour differs according to stream type case token::tokenType::VERBATIMSTRING:
// Different behaviour for (serial/parallel) stream type
// - preserve its type
os.write(tok); os.write(tok);
break; break;
......
...@@ -62,8 +62,12 @@ static inline void writeEntryIfPresent ...@@ -62,8 +62,12 @@ static inline void writeEntryIfPresent
if (eptr) if (eptr)
{ {
const token& tok = eptr->stream()[0]; const tokenList& toks = eptr->stream();
os.writeKeyword(key) << tok << token::END_STATEMENT << nl;
if (!toks.empty())
{
os.writeEntry(key, toks[0]);
}
} }
} }
//! \endcond //! \endcond
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment