STYLE: simplify/shorten some token names

This commit is contained in:
Mark Olesen
2020-01-20 10:15:50 +01:00
parent 21456b8cdc
commit d7c18a328c
9 changed files with 113 additions and 90 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -250,11 +250,11 @@ Foam::Istream& Foam::UIPstream::read(token& t)
} }
// String // String
case token::tokenType::VERBATIMSTRING : case token::tokenType::VERBATIM :
{ {
// Recurse to read actual string // Recurse to read actual string
read(t); read(t);
t.setType(token::tokenType::VERBATIMSTRING); t.setType(token::tokenType::VERBATIM);
return *this; return *this;
} }
case token::tokenType::VARIABLE : case token::tokenType::VARIABLE :
@ -293,8 +293,8 @@ Foam::Istream& Foam::UIPstream::read(token& t)
return *this; return *this;
} }
// floatScalar // Float
case token::tokenType::FLOAT_SCALAR : case token::tokenType::FLOAT :
{ {
floatScalar val; floatScalar val;
if (read(val)) if (read(val))
@ -308,8 +308,8 @@ Foam::Istream& Foam::UIPstream::read(token& t)
return *this; return *this;
} }
// doubleScalar // Double
case token::tokenType::DOUBLE_SCALAR : case token::tokenType::DOUBLE :
{ {
doubleScalar val; doubleScalar val;
if (read(val)) if (read(val))

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -202,9 +202,9 @@ bool Foam::UOPstream::write(const token& tok)
return true; return true;
} }
case token::tokenType::VERBATIMSTRING : case token::tokenType::VERBATIM :
{ {
writeToBuffer(char(token::tokenType::VERBATIMSTRING)); writeToBuffer(char(token::tokenType::VERBATIM));
write(tok.stringToken()); write(tok.stringToken());
return true; return true;
@ -310,7 +310,7 @@ Foam::Ostream& Foam::UOPstream::write(const int64_t val)
Foam::Ostream& Foam::UOPstream::write(const floatScalar val) Foam::Ostream& Foam::UOPstream::write(const floatScalar val)
{ {
writeToBuffer(char(token::tokenType::FLOAT_SCALAR)); writeToBuffer(char(token::tokenType::FLOAT));
writeToBuffer(val); writeToBuffer(val);
return *this; return *this;
} }
@ -318,7 +318,7 @@ Foam::Ostream& Foam::UOPstream::write(const floatScalar val)
Foam::Ostream& Foam::UOPstream::write(const doubleScalar val) Foam::Ostream& Foam::UOPstream::write(const doubleScalar val)
{ {
writeToBuffer(char(token::tokenType::DOUBLE_SCALAR)); writeToBuffer(char(token::tokenType::DOUBLE));
writeToBuffer(val); writeToBuffer(val);
return *this; return *this;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -187,7 +187,7 @@ Foam::Istream& Foam::ISstream::read(token& t)
// Analyse input starting with this character. // Analyse input starting with this character.
switch (c) switch (c)
{ {
// Check for punctuation first - same as token::isSeparator // Check for punctuation first - same as token::isseparator()
case token::END_STATEMENT : case token::END_STATEMENT :
case token::BEGIN_LIST : case token::BEGIN_LIST :
@ -247,7 +247,7 @@ Foam::Istream& Foam::ISstream::read(token& t)
else else
{ {
t = std::move(val); // Move contents to token t = std::move(val); // Move contents to token
t.setType(token::tokenType::VERBATIMSTRING); t.setType(token::tokenType::VERBATIM);
} }
} }
else else
@ -382,7 +382,6 @@ Foam::Istream& Foam::ISstream::read(token& t)
return *this; return *this;
} }
// Should be a word (which can also be a single character) // Should be a word (which can also be a single character)
default: default:
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -45,7 +45,7 @@ bool Foam::OSstream::write(const token& tok)
return true; return true;
} }
case token::tokenType::VERBATIMSTRING : case token::tokenType::VERBATIM :
{ {
write(char(token::HASH)); write(char(token::HASH));
write(char(token::BEGIN_BLOCK)); write(char(token::BEGIN_BLOCK));

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2014 OpenFOAM Foundation Copyright (C) 2011-2014 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -54,7 +55,7 @@ Foam::prefixOSstream::prefixOSstream
: :
OSstream(os, name, format, version, compression), OSstream(os, name, format, version, compression),
printPrefix_(true), printPrefix_(true),
prefix_("") prefix_()
{} {}
@ -79,7 +80,7 @@ bool Foam::prefixOSstream::write(const token& tok)
return true; return true;
} }
case token::tokenType::VERBATIMSTRING : case token::tokenType::VERBATIM :
{ {
write(char(token::HASH)); write(char(token::HASH));
write(char(token::BEGIN_BLOCK)); write(char(token::BEGIN_BLOCK));

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -83,17 +83,22 @@ public:
PUNCTUATION, //!< single character punctuation PUNCTUATION, //!< single character punctuation
BOOL, //!< boolean type BOOL, //!< boolean type
LABEL, //!< label (integer) type LABEL, //!< label (integer) type
FLOAT_SCALAR, //!< float (single-precision) type FLOAT, //!< float (single-precision) type
DOUBLE_SCALAR, //!< double (double-precision) type DOUBLE, //!< double (double-precision) type
// Pointer types // Pointer types
WORD, //!< A Foam::word WORD, //!< A Foam::word
STRING, //!< A string STRING, //!< A string
VARIABLE, //!< A dictionary \c \$variable (string variant) VARIABLE, //!< A dictionary \c \$variable (string variant)
VERBATIMSTRING, //!< Verbatim string content VERBATIM, //!< Verbatim string content
COMPOUND, //!< Compound type such as \c List\<label\> etc. COMPOUND, //!< Compound type such as \c List\<label\> etc.
ERROR //!< A token error encountered ERROR, //!< A token error encountered
// Aliases
FLOAT_SCALAR = FLOAT,
DOUBLE_SCALAR = DOUBLE,
VERBATIMSTRING = VERBATIM
}; };
@ -155,7 +160,7 @@ public:
public: public:
//- Runtime type information //- Declare type-name, virtual type (with debug switch)
TypeName("compound"); TypeName("compound");
//- Declare run-time constructor selection table //- Declare run-time constructor selection table
@ -171,7 +176,7 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
compound() compound()
: :
empty_(false) empty_(false)
@ -224,7 +229,7 @@ public:
{ {
public: public:
//- Runtime type information //- Declare type-name, virtual type (with debug switch)
TypeName("Compound<T>"); TypeName("Compound<T>");
Compound(Istream& is) Compound(Istream& is)
@ -302,7 +307,7 @@ public:
// Constructors // Constructors
//- Construct null, initialized to an UNDEFINED token. //- Default construct, initialized to an UNDEFINED token.
inline constexpr token() noexcept; inline constexpr token() noexcept;
//- Copy construct //- Copy construct
@ -343,7 +348,7 @@ public:
inline ~token(); inline ~token();
// Static Member Functions // Static Functions
//- Create a bool token. //- Create a bool token.
inline static token boolean(bool on); inline static token boolean(bool on);
@ -375,7 +380,7 @@ public:
//- Change the token type, for similar types. //- Change the token type, for similar types.
// This can be used to change between string-like variants // This can be used to change between string-like variants
// (eg, STRING, VARIABLE, etc) // (eg, STRING, VARIABLE, etc)
// To change types entirely (eg, STRING to DOUBLE_SCALAR), // To change types entirely (eg, STRING to DOUBLE),
// use the corresponding assignment operator. // use the corresponding assignment operator.
// //
// \return true if the change was successful or no change was required // \return true if the change was successful or no change was required
@ -411,16 +416,16 @@ public:
//- Token is LABEL //- Token is LABEL
inline bool isLabel() const; inline bool isLabel() const;
//- Token is FLOAT_SCALAR //- Token is FLOAT
inline bool isFloatScalar() const; inline bool isFloat() const;
//- Token is DOUBLE_SCALAR //- Token is DOUBLE
inline bool isDoubleScalar() const; inline bool isDouble() const;
//- Token is FLOAT_SCALAR or DOUBLE_SCALAR //- Token is FLOAT or DOUBLE
inline bool isScalar() const; inline bool isScalar() const;
//- Token is LABEL, FLOAT_SCALAR or DOUBLE_SCALAR //- Token is LABEL, FLOAT or DOUBLE
inline bool isNumber() const; inline bool isNumber() const;
//- Token is WORD //- Token is WORD
@ -461,21 +466,21 @@ public:
inline label labelToken() const; inline label labelToken() const;
//- Return float value. //- Return float value.
// Report FatalIOError and return \b 0 if token is not FLOAT_SCALAR // Report FatalIOError and return \b 0 if token is not FLOAT
inline floatScalar floatScalarToken() const; inline floatScalar floatToken() const;
//- Return double value. //- Return double value.
// Report FatalIOError and return \b 0 if token is not DOUBLE_SCALAR // Report FatalIOError and return \b 0 if token is not DOUBLE
inline doubleScalar doubleScalarToken() const; inline doubleScalar doubleToken() const;
//- Return float or double value. //- Return float or double value.
// Report FatalIOError and return \b 0 if token is not a // Report FatalIOError and return \b 0 if token is not a
// FLOAT_SCALAR or DOUBLE_SCALAR // FLOAT or DOUBLE
inline scalar scalarToken() const; inline scalar scalarToken() const;
//- Return label, float or double value. //- Return label, float or double value.
// Report FatalIOError and return \b 0 if token is not a // Report FatalIOError and return \b 0 if token is not a
// LABEL, FLOAT_SCALAR or DOUBLE_SCALAR // LABEL, FLOAT or DOUBLE
inline scalar number() const; inline scalar number() const;
//- Return const reference to the word contents. //- Return const reference to the word contents.
@ -587,6 +592,22 @@ public:
// Housekeeping // Housekeeping
//- Token is FLOAT
// \deprecated(2020-01) - isFloat()
bool isFloatScalar() const { return isFloat(); };
//- Token is DOUBLE
// \deprecated(2020-01) - isDouble()
bool isDoubleScalar() const { return isDouble(); }
//- Return float value.
// \deprecated(2020-01) - floatToken()
floatScalar floatScalarToken() const { return floatToken(); }
//- Return double value.
// \deprecated(2020-01) - doubleToken()
doubleScalar doubleScalarToken() const { return doubleToken(); }
//- Deprecated(2017-11) transfer word pointer to the token //- Deprecated(2017-11) transfer word pointer to the token
// \deprecated(2017-11) - use move assign from word // \deprecated(2017-11) - use move assign from word
void operator=(word*) = delete; void operator=(word*) = delete;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -52,6 +52,8 @@ inline Foam::token Foam::token::flag(int bitmask)
inline bool Foam::token::isseparator(int c) inline bool Foam::token::isseparator(int c)
{ {
// NOTE: keep synchronized with ISstream::read(token&)
switch (c) switch (c)
{ {
case token::END_STATEMENT : case token::END_STATEMENT :
@ -119,7 +121,7 @@ inline Foam::token::token(const token& tok)
case tokenType::STRING: case tokenType::STRING:
case tokenType::VARIABLE: case tokenType::VARIABLE:
case tokenType::VERBATIMSTRING: case tokenType::VERBATIM:
{ {
data_.stringPtr = new string(*tok.data_.stringPtr); data_.stringPtr = new string(*tok.data_.stringPtr);
break; break;
@ -173,7 +175,7 @@ inline Foam::token::token(const label val, label lineNumber)
inline Foam::token::token(const floatScalar val, label lineNumber) inline Foam::token::token(const floatScalar val, label lineNumber)
: :
data_(), data_(),
type_(tokenType::FLOAT_SCALAR), type_(tokenType::FLOAT),
lineNumber_(lineNumber) lineNumber_(lineNumber)
{ {
data_.floatVal = val; data_.floatVal = val;
@ -183,7 +185,7 @@ inline Foam::token::token(const floatScalar val, label lineNumber)
inline Foam::token::token(const doubleScalar val, label lineNumber) inline Foam::token::token(const doubleScalar val, label lineNumber)
: :
data_(), data_(),
type_(tokenType::DOUBLE_SCALAR), type_(tokenType::DOUBLE),
lineNumber_(lineNumber) lineNumber_(lineNumber)
{ {
data_.doubleVal = val; data_.doubleVal = val;
@ -252,7 +254,7 @@ inline void Foam::token::reset()
case tokenType::STRING: case tokenType::STRING:
case tokenType::VARIABLE: case tokenType::VARIABLE:
case tokenType::VERBATIMSTRING: case tokenType::VERBATIM:
{ {
delete data_.stringPtr; delete data_.stringPtr;
break; break;
@ -327,14 +329,14 @@ inline bool Foam::token::setType(token::tokenType variant)
case tokenType::STRING: case tokenType::STRING:
case tokenType::VARIABLE: case tokenType::VARIABLE:
case tokenType::VERBATIMSTRING: case tokenType::VERBATIM:
{ {
switch (type_) switch (type_)
{ {
// could also go from WORD to STRING etc - to be decided // could also go from WORD to STRING etc - to be decided
case tokenType::STRING: case tokenType::STRING:
case tokenType::VARIABLE: case tokenType::VARIABLE:
case tokenType::VERBATIMSTRING: case tokenType::VERBATIM:
type_ = variant; type_ = variant;
return true; return true;
break; break;
@ -465,15 +467,15 @@ inline Foam::label Foam::token::labelToken() const
} }
inline bool Foam::token::isFloatScalar() const inline bool Foam::token::isFloat() const
{ {
return (type_ == tokenType::FLOAT_SCALAR); return (type_ == tokenType::FLOAT);
} }
inline Foam::floatScalar Foam::token::floatScalarToken() const inline Foam::floatScalar Foam::token::floatToken() const
{ {
if (type_ == tokenType::FLOAT_SCALAR) if (type_ == tokenType::FLOAT)
{ {
return data_.floatVal; return data_.floatVal;
} }
@ -483,15 +485,15 @@ inline Foam::floatScalar Foam::token::floatScalarToken() const
} }
inline bool Foam::token::isDoubleScalar() const inline bool Foam::token::isDouble() const
{ {
return (type_ == tokenType::DOUBLE_SCALAR); return (type_ == tokenType::DOUBLE);
} }
inline Foam::doubleScalar Foam::token::doubleScalarToken() const inline Foam::doubleScalar Foam::token::doubleToken() const
{ {
if (type_ == tokenType::DOUBLE_SCALAR) if (type_ == tokenType::DOUBLE)
{ {
return data_.doubleVal; return data_.doubleVal;
} }
@ -505,19 +507,19 @@ inline bool Foam::token::isScalar() const
{ {
return return
( (
type_ == tokenType::FLOAT_SCALAR type_ == tokenType::FLOAT
|| type_ == tokenType::DOUBLE_SCALAR || type_ == tokenType::DOUBLE
); );
} }
inline Foam::scalar Foam::token::scalarToken() const inline Foam::scalar Foam::token::scalarToken() const
{ {
if (type_ == tokenType::FLOAT_SCALAR) if (type_ == tokenType::FLOAT)
{ {
return data_.floatVal; return data_.floatVal;
} }
else if (type_ == tokenType::DOUBLE_SCALAR) else if (type_ == tokenType::DOUBLE)
{ {
return data_.doubleVal; return data_.doubleVal;
} }
@ -573,7 +575,7 @@ inline bool Foam::token::isString() const
( (
type_ == tokenType::STRING type_ == tokenType::STRING
|| type_ == tokenType::VARIABLE || type_ == tokenType::VARIABLE
|| type_ == tokenType::VERBATIMSTRING || type_ == tokenType::VERBATIM
); );
} }
@ -586,7 +588,7 @@ inline bool Foam::token::isVariable() const
inline bool Foam::token::isVerbatim() const inline bool Foam::token::isVerbatim() const
{ {
return (type_ == tokenType::VERBATIMSTRING); return (type_ == tokenType::VERBATIM);
} }
@ -602,7 +604,7 @@ inline const Foam::string& Foam::token::stringToken() const
( (
type_ == tokenType::STRING type_ == tokenType::STRING
|| type_ == tokenType::VARIABLE || type_ == tokenType::VARIABLE
|| type_ == tokenType::VERBATIMSTRING || type_ == tokenType::VERBATIM
) )
{ {
return *data_.stringPtr; return *data_.stringPtr;
@ -671,7 +673,7 @@ inline void Foam::token::operator=(const token& tok)
case tokenType::STRING: case tokenType::STRING:
case tokenType::VARIABLE: case tokenType::VARIABLE:
case tokenType::VERBATIMSTRING: case tokenType::VERBATIM:
{ {
data_.stringPtr = new string(*tok.data_.stringPtr); data_.stringPtr = new string(*tok.data_.stringPtr);
} }
@ -723,7 +725,7 @@ inline void Foam::token::operator=(const label val)
inline void Foam::token::operator=(const floatScalar val) inline void Foam::token::operator=(const floatScalar val)
{ {
reset(); reset();
type_ = tokenType::FLOAT_SCALAR; type_ = tokenType::FLOAT;
data_.floatVal = val; data_.floatVal = val;
} }
@ -731,7 +733,7 @@ inline void Foam::token::operator=(const floatScalar val)
inline void Foam::token::operator=(const doubleScalar val) inline void Foam::token::operator=(const doubleScalar val)
{ {
reset(); reset();
type_ = tokenType::DOUBLE_SCALAR; type_ = tokenType::DOUBLE;
data_.doubleVal = val; data_.doubleVal = val;
} }
@ -800,10 +802,10 @@ inline bool Foam::token::operator==(const token& tok) const
case tokenType::LABEL: case tokenType::LABEL:
return data_.labelVal == tok.data_.labelVal; return data_.labelVal == tok.data_.labelVal;
case tokenType::FLOAT_SCALAR: case tokenType::FLOAT:
return equal(data_.floatVal, tok.data_.floatVal); return equal(data_.floatVal, tok.data_.floatVal);
case tokenType::DOUBLE_SCALAR: case tokenType::DOUBLE:
return equal(data_.doubleVal, tok.data_.doubleVal); return equal(data_.doubleVal, tok.data_.doubleVal);
case tokenType::WORD: case tokenType::WORD:
@ -811,7 +813,7 @@ inline bool Foam::token::operator==(const token& tok) const
case tokenType::STRING: case tokenType::STRING:
case tokenType::VARIABLE: case tokenType::VARIABLE:
case tokenType::VERBATIMSTRING: case tokenType::VERBATIM:
return *data_.stringPtr == *tok.data_.stringPtr; return *data_.stringPtr == *tok.data_.stringPtr;
case tokenType::COMPOUND: case tokenType::COMPOUND:
@ -856,7 +858,7 @@ inline bool Foam::token::operator==(const floatScalar val) const
{ {
return return
( (
type_ == tokenType::FLOAT_SCALAR type_ == tokenType::FLOAT
&& equal(data_.floatVal, val) && equal(data_.floatVal, val)
); );
} }
@ -866,7 +868,7 @@ inline bool Foam::token::operator==(const doubleScalar val) const
{ {
return return
( (
type_ == tokenType::DOUBLE_SCALAR type_ == tokenType::DOUBLE
&& equal(data_.doubleVal, val) && equal(data_.doubleVal, val)
); );
} }

View File

@ -62,12 +62,12 @@ static OS& printTokenInfo(OS& os, const token& tok)
os << "label " << tok.labelToken(); os << "label " << tok.labelToken();
break; break;
case token::tokenType::FLOAT_SCALAR: case token::tokenType::FLOAT:
os << "float " << tok.floatScalarToken(); os << "float " << tok.floatToken();
break; break;
case token::tokenType::DOUBLE_SCALAR: case token::tokenType::DOUBLE:
os << "double " << tok.doubleScalarToken(); os << "double " << tok.doubleToken();
break; break;
case token::tokenType::WORD: case token::tokenType::WORD:
@ -82,8 +82,8 @@ static OS& printTokenInfo(OS& os, const token& tok)
os << "variable " << tok.stringToken(); os << "variable " << tok.stringToken();
break; break;
case token::tokenType::VERBATIMSTRING: case token::tokenType::VERBATIM:
os << "verbatim string " << tok.stringToken(); os << "verbatim " << tok.stringToken();
break; break;
case token::tokenType::COMPOUND: case token::tokenType::COMPOUND:
@ -132,11 +132,11 @@ Foam::word Foam::token::name() const
case token::tokenType::FLAG: return "flag"; case token::tokenType::FLAG: return "flag";
case token::tokenType::PUNCTUATION: return "punctuation"; case token::tokenType::PUNCTUATION: return "punctuation";
case token::tokenType::LABEL: return "label"; case token::tokenType::LABEL: return "label";
case token::tokenType::FLOAT_SCALAR: return "float"; case token::tokenType::FLOAT: return "float";
case token::tokenType::DOUBLE_SCALAR: return "double"; case token::tokenType::DOUBLE: return "double";
case token::tokenType::WORD: return "word"; case token::tokenType::WORD: return "word";
case token::tokenType::STRING: return "string"; case token::tokenType::STRING: return "string";
case token::tokenType::VERBATIMSTRING: return "verbatim"; case token::tokenType::VERBATIM: return "verbatim";
case token::tokenType::VARIABLE: return "variable"; case token::tokenType::VARIABLE: return "variable";
case token::tokenType::COMPOUND: return "compound"; case token::tokenType::COMPOUND: return "compound";
case token::tokenType::ERROR: return "error"; case token::tokenType::ERROR: return "error";
@ -181,11 +181,11 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const token& tok)
os << tok.data_.labelVal; os << tok.data_.labelVal;
break; break;
case token::tokenType::FLOAT_SCALAR: case token::tokenType::FLOAT:
os << tok.data_.floatVal; os << tok.data_.floatVal;
break; break;
case token::tokenType::DOUBLE_SCALAR: case token::tokenType::DOUBLE:
os << tok.data_.doubleVal; os << tok.data_.doubleVal;
break; break;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenFOAM Foundation Copyright (C) 2018 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -181,7 +181,7 @@ bool Foam::functionEntries::ifeqEntry::equalToken
return false; return false;
case token::VARIABLE: case token::VARIABLE:
case token::VERBATIMSTRING: case token::VERBATIM:
if (eqType) if (eqType)
{ {
return t1.stringToken() == t2.stringToken(); return t1.stringToken() == t2.stringToken();
@ -203,10 +203,10 @@ bool Foam::functionEntries::ifeqEntry::equalToken
} }
return false; return false;
case token::FLOAT_SCALAR: case token::FLOAT:
if (eqType) if (eqType)
{ {
return equal(t1.floatScalarToken(), t2.floatScalarToken()); return equal(t1.floatToken(), t2.floatToken());
} }
else if (t2.isScalar()) else if (t2.isScalar())
{ {
@ -214,10 +214,10 @@ bool Foam::functionEntries::ifeqEntry::equalToken
} }
return false; return false;
case token::DOUBLE_SCALAR: case token::DOUBLE:
if (eqType) if (eqType)
{ {
return equal(t1.doubleScalarToken(), t2.doubleScalarToken()); return equal(t1.doubleToken(), t2.doubleToken());
} }
else if (t2.isScalar()) else if (t2.isScalar())
{ {