20 if (((*s) >=
'a') && ((*s) <=
'z')) (*s) +=
'A' -
'a';
30 : loadedObject(nullptr),
125 const int enter_meta_group_mask = 1;
126 const int leave_meta_group_mask = 100;
133 case enter_meta_group_mask + 1:
136 case enter_meta_group_mask + 2:
139 case enter_meta_group_mask + 3:
142 case leave_meta_group_mask + 1:
145 case leave_meta_group_mask + 2:
207 std::map<std::string, Token>::const_iterator location;
233 for (index = 0; index <
length; index++)
255 int n =
static_cast<int>(strlen(str));
256 if (minSize == 0 || minSize > n) minSize = n;
257 for (; minSize <= n; minSize++)
258 dictionary[std::string(str).substr(0, minSize)] = token;
271 if (!
m_file)
return false;
300 bool tokenFilled =
false;
302 while (!tokenFilled) {
314 if (n > 0) tokenFilled =
true;
345 if (car ==
'\t') car =
' ';
348 ((car !=
' ') || (n > 0 &&
tokenBuffer[n - 1] !=
' ')))
350 }
while (car != EOF && car !=
'\n');
360 bool commentSymb =
false;
361 int commentBlockLevel = 1;
367 if (car ==
'\n' || car ==
'\t') car =
' ';
370 else if (car ==
'(' && commentSymb)
372 else if (car ==
')' && commentSymb)
378 ((car !=
' ') || (n > 0 &&
tokenBuffer[n - 1] !=
' ')))
381 }
while (car != EOF && commentBlockLevel > 0);
390 if (strncmp(
tokenBuffer,
"ENTERING IN GROUP:", 18) == 0) {
395 while ((*ptr2) ==
' ') {
401 while ((*ptr2) && (*ptr2) !=
' ') {
408 }
else if (strncmp(
tokenBuffer,
"LEAVING GROUP", 13) == 0) {
415 int opened = 0, state = 0;
418 for (
unsigned i = 0; i < strlen(
tokenBuffer); i++) {
424 if (opened > 0 && state == 0)
return;
427 while (!(opened > 0 && state == 0)) {
432 }
else if (car ==
')')
440 std::cerr <<
"[" <<
m_filename <<
"]@postprocessing : " << str
452 currentCommand(nullptr),
453 currentItem(nullptr),
467 PdmsObjects::Stack::Clear();
485 switch (currentToken) {
511 "Last token cannot be associated with a name");
531 "Unable to resolve previous command (this token "
532 "may be unexpected in current command)");
545 "Trying to create a second root for elements "
569 PdmsObjects::Stack::Init();
586 "there could be several hierarchy root specified in this file");
float PointCoordinateType
Type of the coordinates of a (N-D) point.
virtual void skipHandleCommand() override
virtual bool initializeSession() override
virtual void parseCurrentToken() override
virtual void skipComment() override
virtual void printWarning(const char *str) override
virtual bool moveForward() override
virtual void closeSession(bool destroyLoadedObject=false) override
PdmsFileSession(const std::string &filename)
virtual bool moveForward()
virtual void parseCurrentToken()
PdmsObjects::GenericItem * getLoadedObject() const
virtual void closeSession(bool destroyLoadedObject=false)
char tokenBuffer[c_max_buff_size]
static const int c_max_buff_size
PointCoordinateType valueFromBuffer()
std::map< std::string, Token > dictionary
const char * nameFromBuffer() const
virtual bool initializeSession()
virtual void skipHandleCommand()=0
char nextBuffer[c_max_buff_size]
virtual void printWarning(const char *str)=0
PdmsObjects::GenericItem * loadedObject
void setLoadedObject(PdmsObjects::GenericItem *o)
Token getCurrentToken() const
void pushIntoDictionary(const char *str, Token token, int minSize=0)
virtual void skipComment()=0
bool parseSessionContent()
bool processCurrentToken()
void linkWithSession(PdmsLexer *s)
PdmsObjects::GenericItem * getLoadedObject(bool forgetIt=true)
PdmsParser()
Default constructor.
PdmsObjects::GenericItem * currentItem
PdmsCommands::Command * currentCommand
PdmsObjects::GenericItem * root
__host__ __device__ float length(float2 v)
QTextStream & endl(QTextStream &stream)