Go to the documentation of this file.
32 static constexpr
const unsigned errLen = 80;
45 static inline bool validVariableChar(
char c)
60 while (
get(c) && isspace(c))
64 if (
bad() || isspace(c))
81 while (
get(c) && c !=
'\n')
90 if (
get(c) && c ==
'*')
147 constexpr
const unsigned maxLen = 1024;
148 static char buf[maxLen];
158 <<
"Invalid first character found : " << c <<
nl;
167 str.assign(buf, nChar);
169 <<
"Truncated variable name : " << str <<
nl;
189 str.append(buf, nChar);
202 str.append(buf, nChar);
210 str.append(buf, nChar);
212 nChar = str.length();
213 if (str.length() >
errLen)
219 <<
"stream terminated while reading variable '"
220 << str.c_str() <<
"...' [" <<
static_cast<int32>(nChar) <<
"]\n";
225 else if (validVariableChar(c))
231 (nChar < maxLen) && get(c)
232 && (validVariableChar(c))
259 <<
"Bad variable name: " << buf <<
nl <<
endl;
267 <<
"variable '" << buf <<
"...'\n"
268 <<
" is too long (max. " <<
static_cast<int32>(maxLen) <<
" characters)";
282 <<
"Problem while reading variable '" << buf <<
"...' after "
283 <<
static_cast<int32>(nChar) <<
" characters\n";
294 <<
"Missing " <<
static_cast<int32>(depth)
295 <<
" closing ')' while parsing" <<
nl <<
nl
300 str.assign(buf, nChar);
310 const word& streamName
324 setState(is_.rdstate());
331 setState(is_.rdstate());
333 if (good() && c ==
'\n')
350 std::getline(is_, str, delim);
351 setState(is_.rdstate());
365 setState(is_.rdstate());
367 std::streamsize
count = is_.gcount();
369 if (
count && delim ==
'\n')
390 setState(is_.rdstate());
397 constexpr
const unsigned maxLen = 128;
398 static char buf[maxLen];
412 char c = nextValid();
450 if (readString(val).bad())
465 if (read(nextC).bad())
477 if (readVariable(val).bad())
484 t.
setType(token::tokenType::VARIABLE);
499 case '0' :
case '1' :
case '2' :
case '3' :
case '4' :
500 case '5' :
case '6' :
case '7' :
case '8' :
case '9' :
502 int64 int64Val = (c !=
'.');
524 int64Val = isdigit(c);
531 buf[maxLen-1] =
'\0';
534 <<
"number '" << buf <<
"...'\n"
535 <<
" is too long (max. " <<
536 static_cast<int32>(maxLen) <<
" characters)";
545 setState(is_.rdstate());
554 if (nChar == 1 && buf[0] ==
'-')
559 else if (int64Val &&
readInt64(buf, int64Val))
604 constexpr
const unsigned maxLen = 1024;
605 static char buf[maxLen];
638 <<
"word '" << buf <<
"...'\n"
639 <<
" is too long (max. " <<
640 static_cast<int32>(maxLen) <<
" characters)";
654 <<
"Problem while reading word '" << buf <<
"...' after "
655 <<
static_cast<int32>(nChar) <<
" characters\n";
664 <<
"Invalid first character found : " << c;
670 <<
"Missing " <<
static_cast<int32>(depth)
671 <<
" closing ')' while parsing" <<
nl <<
nl
676 str.assign(buf, nChar);
685 constexpr
const unsigned maxLen = 1024;
686 static char buf[maxLen];
693 <<
"cannot read start of string";
703 <<
"Incorrect start of string character found : " << c;
710 bool escaped =
false;
728 str.assign(buf, nChar);
741 buf[
errLen] = buf[nChar] =
'\0';
744 <<
"found '\\n' while reading string \""
768 <<
"string \"" << buf <<
"...\"\n"
769 <<
" is too long (max. " <<
static_cast<int32>(maxLen) <<
" characters)";
776 buf[
errLen] = buf[nChar] =
'\0';
779 <<
"Problem while reading string \"" << buf <<
"...\"";
788 setState(is_.rdstate());
795 setState(is_.rdstate());
802 setState(is_.rdstate());
809 setState(is_.rdstate());
816 setState(is_.rdstate());
823 setState(is_.rdstate());
830 setState(is_.rdstate());
837 setState(is_.rdstate());
845 setState(is_.rdstate());
858 stdStream().rdbuf()->pubseekpos(0, std::ios_base::in);
bool setType(const tokenType tokType)
void readWordToken(token &t)
static constexpr const unsigned errLen
#define warningInFunction
@ END_BLOCK
End block [isseparator].
bool readReal(const word &w, real &val)
iOstream & endl(iOstream &os)
@ BEGIN_BLOCK
Begin block [isseparator].
bool readInt64(const word &w, int64 &val)
virtual iIstream & readString(word &str) override
unsigned short int uint16
Istream & readVariable(word &str)
INLINE_FUNCTION_H Type max(const Type *first, int32 numElems)
virtual iIstream & read(token &t) override
@ BEGIN_STRING
Begin string with double quote.
@ END_LIST
End list [isseparator].
@ DOLLAR
Dollar - start variable.
auto count(const Vector< T, Allocator > &vec, const T &val)
@ COLON
Colon [isseparator].
@ END_STATEMENT
End entry [isseparator].
@ SUBTRACT
Subtract or start of negative number.
@ BEGIN_LIST
Begin list [isseparator].
Istream(std::istream &is, const word &streamName)
@ BEGIN_SQR
Begin dimensions [isseparator].
@ DIVIDE
Divide [isseparator].
#define ioErrorInFile(fileName, lineNumber)
@ COMMA
Comma [isseparator].
virtual ios_base::fmtflags flags() const
@ END_STRING
End string with double quote.
Istream & putback(const char c)
Istream & getLine(word &str, char delim='\n')
@ END_SQR
End dimensions [isseparator].