31 inline void Foam::token::clear()
85 lineNumber_(t.lineNumber_)
160 punctuationToken_(
p),
161 lineNumber_(lineNumber)
168 wordTokenPtr_(new
word(w)),
169 lineNumber_(lineNumber)
176 stringTokenPtr_(new
string(
s)),
177 lineNumber_(lineNumber)
183 type_(VERBATIMSTRING),
185 lineNumber_(lineNumber)
193 lineNumber_(lineNumber)
201 lineNumber_(lineNumber)
207 type_(UNSIGNED_INTEGER_32),
208 unsignedInteger32Token_(l),
209 lineNumber_(lineNumber)
215 type_(UNSIGNED_INTEGER_64),
216 unsignedInteger64Token_(l),
217 lineNumber_(lineNumber)
224 floatScalarToken_(
s),
225 lineNumber_(lineNumber)
231 type_(DOUBLE_SCALAR),
232 doubleScalarToken_(
s),
233 lineNumber_(lineNumber)
239 type_(LONG_DOUBLE_SCALAR),
241 lineNumber_(lineNumber)
267 return (type_ != ERROR && type_ != UNDEFINED);
272 return (type_ == UNDEFINED);
277 return (type_ == ERROR);
282 return (type_ == PUNCTUATION);
287 if (type_ == PUNCTUATION)
289 return punctuationToken_;
293 parseError(
"punctuation character");
300 return (type_ == WORD);
307 return *wordTokenPtr_;
318 return (type_ == FUNCTIONNAME);
323 if (type_ == FUNCTIONNAME)
325 return *functionNameTokenPtr_;
336 return (type_ == VARIABLE);
341 if (type_ == VARIABLE)
343 return *variableTokenPtr_;
354 return (type_ == STRING);
361 return *stringTokenPtr_;
372 return (type_ == VERBATIMSTRING);
377 if (type_ == VERBATIMSTRING)
379 return *verbatimStringTokenPtr_;
393 || type_ == FUNCTIONNAME
396 || type_ == VERBATIMSTRING
404 return *wordTokenPtr_;
406 else if (type_ == FUNCTIONNAME)
408 return *functionNameTokenPtr_;
410 else if (type_ == VARIABLE)
412 return *variableTokenPtr_;
414 else if (type_ == STRING)
416 return *stringTokenPtr_;
418 else if (type_ == VERBATIMSTRING)
420 return *verbatimStringTokenPtr_;
435 && (integer64Token_ >= INT32_MIN) && (integer64Token_ <= INT32_MAX)
437 || (type_ == UNSIGNED_INTEGER_32 && unsignedInteger32Token_ <= INT32_MAX)
438 || (type_ == UNSIGNED_INTEGER_64 && unsignedInteger64Token_ <= INT32_MAX);
443 if (type_ == INTEGER_32)
445 return integer32Token_;
447 else if (type_ == INTEGER_64)
449 return integer64Token_;
451 if (type_ == UNSIGNED_INTEGER_32)
453 return unsignedInteger32Token_;
455 else if (type_ == UNSIGNED_INTEGER_64)
457 return unsignedInteger64Token_;
470 || type_ == INTEGER_64
471 || type_ == UNSIGNED_INTEGER_32
472 || (type_ == UNSIGNED_INTEGER_64 && unsignedInteger64Token_ <= INT64_MAX);
477 if (type_ == INTEGER_32)
479 return integer32Token_;
481 else if (type_ == INTEGER_64)
483 return integer64Token_;
485 if (type_ == UNSIGNED_INTEGER_32)
487 return unsignedInteger32Token_;
489 else if (type_ == UNSIGNED_INTEGER_64)
491 return unsignedInteger64Token_;
503 (type_ == INTEGER_32 && integer32Token_ >= 0)
506 && (integer64Token_ >= 0) && (integer64Token_ <= UINT32_MAX)
508 || type_ == UNSIGNED_INTEGER_32
509 || (type_ == UNSIGNED_INTEGER_64 && unsignedInteger64Token_ <= UINT32_MAX);
514 if (type_ == INTEGER_32)
516 return integer32Token_;
518 else if (type_ == INTEGER_64)
520 return integer64Token_;
522 if (type_ == UNSIGNED_INTEGER_32)
524 return unsignedInteger32Token_;
526 else if (type_ == UNSIGNED_INTEGER_64)
528 return unsignedInteger64Token_;
540 (type_ == INTEGER_32 && integer32Token_ >= 0)
541 || (type_ == INTEGER_64 && integer64Token_ >= 0)
542 || type_ == UNSIGNED_INTEGER_32
543 || type_ == UNSIGNED_INTEGER_64;
548 if (type_ == INTEGER_32)
550 return integer32Token_;
552 else if (type_ == INTEGER_64)
554 return integer64Token_;
556 if (type_ == UNSIGNED_INTEGER_32)
558 return unsignedInteger32Token_;
560 else if (type_ == UNSIGNED_INTEGER_64)
562 return unsignedInteger64Token_;
577 && integer64Token_ >= int64_t(
labelMin)
578 && integer64Token_ <= int64_t(
labelMax)
581 type_ == UNSIGNED_INTEGER_32
582 && uint64_t(unsignedInteger32Token_) <= uint64_t(
labelMax)
585 type_ == UNSIGNED_INTEGER_64
586 && unsignedInteger64Token_ <= uint64_t(
labelMax)
592 if (type_ == INTEGER_32)
594 return integer32Token_;
596 else if (type_ == INTEGER_64)
598 return integer64Token_;
600 if (type_ == UNSIGNED_INTEGER_32)
602 return unsignedInteger32Token_;
604 else if (type_ == UNSIGNED_INTEGER_64)
606 return unsignedInteger64Token_;
620 && integer32Token_ >= 0
624 && integer64Token_ >= 0
625 && uint64_t(integer64Token_) <= uint64_t(
uLabelMax)
627 || type_ == UNSIGNED_INTEGER_32
629 type_ == UNSIGNED_INTEGER_64
630 && unsignedInteger64Token_ <= uint64_t(
uLabelMax)
636 if (type_ == INTEGER_32)
638 return integer32Token_;
640 else if (type_ == INTEGER_64)
642 return integer64Token_;
644 if (type_ == UNSIGNED_INTEGER_32)
646 return unsignedInteger32Token_;
648 else if (type_ == UNSIGNED_INTEGER_64)
650 return unsignedInteger64Token_;
661 return (type_ == FLOAT_SCALAR);
666 if (type_ == FLOAT_SCALAR)
668 return floatScalarToken_;
672 parseError(
"floatScalar");
680 return (type_ == DOUBLE_SCALAR);
685 if (type_ == DOUBLE_SCALAR)
687 return doubleScalarToken_;
691 parseError(
"doubleScalar");
699 return (type_ == LONG_DOUBLE_SCALAR);
704 if (type_ == LONG_DOUBLE_SCALAR)
706 return *longDoubleScalarTokenPtr_;
710 parseError(
"longDoubleScalar");
719 type_ == FLOAT_SCALAR
720 || type_ == DOUBLE_SCALAR
721 || type_ == LONG_DOUBLE_SCALAR;
726 if (type_ == FLOAT_SCALAR)
728 return floatScalarToken_;
730 else if (type_ == DOUBLE_SCALAR)
732 return doubleScalarToken_;
734 else if (type_ == LONG_DOUBLE_SCALAR)
736 return *longDoubleScalarTokenPtr_;
749 || type_ == INTEGER_64
750 || type_ == UNSIGNED_INTEGER_32
751 || type_ == UNSIGNED_INTEGER_64
757 if (type_ == INTEGER_32)
759 return integer32Token_;
761 else if (type_ == INTEGER_64)
763 return integer64Token_;
765 if (type_ == UNSIGNED_INTEGER_32)
767 return unsignedInteger32Token_;
769 else if (type_ == UNSIGNED_INTEGER_64)
771 return unsignedInteger64Token_;
775 return scalarToken();
779 parseError(
"number (label or scalar)");
786 return (type_ == COMPOUND);
791 if (type_ == COMPOUND)
793 return *compoundTokenPtr_;
797 parseError(
"compound");
798 return *compoundTokenPtr_;
854 verbatimStringTokenPtr_ =
866 case UNSIGNED_INTEGER_32:
870 case UNSIGNED_INTEGER_64:
882 case LONG_DOUBLE_SCALAR:
883 longDoubleScalarTokenPtr_ =
889 compoundTokenPtr_->refCount::operator++();
896 lineNumber_ = t.lineNumber_;
903 punctuationToken_ =
p;
910 wordTokenPtr_ = wPtr;
915 operator=(
new word(w));
921 type_ = FUNCTIONNAME;
922 functionNameTokenPtr_ = fnPtr;
934 variableTokenPtr_ = vPtr;
946 stringTokenPtr_ = sPtr;
951 operator=(
new string(
s));
957 type_ = VERBATIMSTRING;
958 verbatimStringTokenPtr_ = vsPtr;
983 type_ = UNSIGNED_INTEGER_32;
984 unsignedInteger32Token_ = l;
990 type_ = UNSIGNED_INTEGER_64;
991 unsignedInteger64Token_ = l;
997 type_ = FLOAT_SCALAR;
998 floatScalarToken_ =
s;
1004 type_ = DOUBLE_SCALAR;
1005 doubleScalarToken_ =
s;
1011 type_ = LONG_DOUBLE_SCALAR;
1019 compoundTokenPtr_ = cPtr;
1025 if (type_ != t.type_)
1050 case VERBATIMSTRING:
1059 case UNSIGNED_INTEGER_32:
1062 case UNSIGNED_INTEGER_64:
1071 case LONG_DOUBLE_SCALAR:
1074 *longDoubleScalarTokenPtr_,
1090 return (type_ == PUNCTUATION && punctuationToken_ ==
p);
1095 return (type_ == WORD && wordToken() == w);
1100 return (type_ == FUNCTIONNAME && functionNameToken() == fn);
1105 return (type_ == VARIABLE && variableToken() == v);
1110 return (type_ == STRING && stringToken() ==
s);
1115 return (type_ == VERBATIMSTRING && verbatimStringToken() == vs);
1120 return (type_ == INTEGER_32 && integer32Token_ == l);
1125 return (type_ == INTEGER_64 && integer64Token_ == l);
1130 return (type_ == UNSIGNED_INTEGER_32 && unsignedInteger32Token_ == l);
1135 return (type_ == UNSIGNED_INTEGER_64 && unsignedInteger64Token_ == l);
1140 return (type_ == FLOAT_SCALAR &&
equal(floatScalarToken_,
s));
1145 return (type_ == DOUBLE_SCALAR &&
equal(doubleScalarToken_,
s));
1152 type_ == LONG_DOUBLE_SCALAR &&
equal(*longDoubleScalarTokenPtr_,
s)
A functionName is a word starting with '#'.
static const functionName null
An empty functionName.
static const char *const typeName
Traits class for primitives.
bool unique() const
Return true if the reference count is zero.
A class for handling character strings derived from std::string.
static const string null
An empty string.
static const char *const typeName
Abstract base class for complex tokens.
A token holds items read from Istream.
longDoubleScalar longDoubleScalarToken() const
const variable & variableToken() const
bool isUnsignedInteger32() const
bool isPunctuation() const
punctuationToken punctuationToken_
bool isDoubleScalar() const
tokenType
Enumeration defining the types of token.
bool isLongDoubleScalar() const
verbatimString * verbatimStringTokenPtr_
int32_t integer32Token() const
compound * compoundTokenPtr_
bool isVerbatimString() const
functionName * functionNameTokenPtr_
floatScalar floatScalarToken_
const functionName & functionNameToken() const
variable * variableTokenPtr_
floatScalar floatScalarToken() const
punctuationToken
Standard punctuation tokens.
const string & stringToken() const
punctuationToken pToken() const
bool isUnsignedInteger64() const
uint32_t unsignedInteger32Token() const
void operator=(const token &)
int64_t integer64Token() const
const string & anyStringToken() const
bool isFunctionName() const
const compound & compoundToken() const
bool isFloatScalar() const
uLabel uLabelToken() const
bool operator!=(const token &) const
uint64_t unsignedInteger64Token() const
doubleScalar doubleScalarToken() const
doubleScalar doubleScalarToken_
const word & wordToken() const
scalar scalarToken() const
const verbatimString & verbatimStringToken() const
uint32_t unsignedInteger32Token_
bool operator==(const token &) const
uint64_t unsignedInteger64Token_
longDoubleScalar * longDoubleScalarTokenPtr_
A variable is a word with support for additional characters, in particular '$' and '/'.
static const variable null
An empty variable.
static const char *const typeName
A class for handling verbatimStrings, derived from string.
static const verbatimString null
An empty verbatimString.
static const char *const typeName
A class for handling words, derived from string.
static const word null
An empty word.
static const char *const typeName
static bool isScalar[maxNames]
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
bool equal(const T &s1, const T &s2)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
double doubleScalar
Double precision floating point scalar type.
static const uLabel uLabelMax
float floatScalar
Float precision floating point scalar type.
uintWM_LABEL_SIZE_t uLabel
A uLabel is an uint32_t or uint64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static const label labelMax
long double longDoubleScalar
Lang double precision floating point scalar type.
static const label labelMin