MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
HighParser Class Reference

#include <parser.h>

Inheritance diagram for HighParser:
Collaboration diagram for HighParser:

Classes

class  ErrColonExpected
 
class  ErrIllegalDelimiter
 
class  ErrIntegerExpected
 
class  ErrInvalidCallToGetDescription
 
class  ErrKeyWordExpected
 
class  ErrMissingSeparator
 
struct  ErrOut
 
class  ErrRealExpected
 
class  ErrSemicolonExpected
 
class  ErrStringExpected
 
class  ErrValueOutOfRange
 
struct  range_2_base
 
struct  range_any
 
struct  range_base
 
struct  range_ge
 
struct  range_ge_le
 
struct  range_ge_lt
 
struct  range_gt
 
struct  range_gt_le
 
struct  range_gt_lt
 
struct  range_le
 
struct  range_lt
 
struct  WordSet
 

Public Types

enum  Token {
  UNKNOWN = -1, DESCRIPTION, FIRSTARG, ARG,
  LASTARG, NOARGS, WORD, NUMBER,
  STRING, ENDOFFILE, LASTITEM
}
 
enum  Delims {
  UNKNOWNDELIM = -1, PLAINBRACKETS, SQUAREBRACKETS, CURLYBRACKETS,
  SINGLEQUOTE, DOUBLEQUOTE, DEFAULTDELIM, LASTDELIM
}
 
enum  {
  NONE = 0x00U, EATSPACES = 0x01U, ESCAPE = 0x02U, LOWER = 0x04U,
  UPPER = 0x08U
}
 

Public Member Functions

 HighParser (MathParser &MP, InputStream &streamIn)
 
virtual ~HighParser (void)
 
virtual const KeyTablePutKeyTable (const KeyTable &KT)
 
virtual int GetLineNumber (void) const
 
virtual HighParser::ErrOut GetLineData (void) const
 
virtual MathParserGetMathParser (void)
 
virtual void Close (void)
 
bool IsDescription (void) const
 
Token GotDescription (void)
 
int GetDescription (void)
 
virtual void ExpectDescription (void)
 
virtual void ExpectArg (void)
 
virtual bool IsKeyWord (const char *sKeyWord)
 
virtual int IsKeyWord (void)
 
virtual bool IsArg (void)
 
virtual bool IsStringWithDelims (enum Delims Del=DEFAULTDELIM)
 
virtual const char * IsWord (const HighParser::WordSet &ws)
 
virtual void PutBackSemicolon (void)
 
virtual bool GetBool (bool bDefval=false)
 
virtual bool GetYesNo (bool &bRet)
 
virtual bool GetYesNoOrBool (bool bDefval=false)
 
virtual integer GetInt (integer iDefval=0)
 
template<class Range >
integer GetInt (integer iDefval, Range r)
 
virtual doublereal GetReal (const doublereal &dDefval=0.0)
 
template<class Range >
doublereal GetReal (const doublereal &dDefval, Range r)
 
virtual std::string GetString (const std::string &sDefVal)
 
virtual TypedValue GetValue (const TypedValue &v)
 
template<class Range >
TypedValue GetValue (const TypedValue &v, Range r)
 
virtual mbsleep_t GetTimeout (const mbsleep_t &DefVal)
 
virtual int GetWord (void)
 
virtual const char * GetString (unsigned flags=HighParser::NONE)
 
virtual const char * GetStringWithDelims (enum Delims Del=DEFAULTDELIM, bool escape=true)
 
template<class Range >
integer GetInt (int iDefVal, Range range)
 

Public Attributes

const char ESCAPE_CHAR
 

Protected Member Functions

virtual HighParser::Token FirstToken (void)
 
virtual void NextToken (const char *sFuncName)
 
int iGetDescription_int (const char *const s)
 
virtual void Eof (void)
 
virtual void SetDelims (enum Delims Del, char &cLdelim, char &cRdelim) const
 
int ParseWord (unsigned flags=HighParser::NONE)
 
void PutbackWord (void)
 

Protected Attributes

LowParser LowP
 
InputStreampIn
 
std::ifstream * pf
 
char sStringBuf [iDefaultBufSize]
 
char sStringBufWithSpaces [iDefaultBufSize]
 
MathParserMathP
 
const KeyTableKeyT
 
LowParser::Token CurrLowToken
 
Token CurrToken
 

Detailed Description

Definition at line 221 of file parser.h.

Member Enumeration Documentation

anonymous enum
Enumerator
NONE 
EATSPACES 
ESCAPE 
LOWER 
UPPER 

Definition at line 314 of file parser.h.

314  {
315  NONE = 0x00U,
316  EATSPACES = 0x01U,
317  ESCAPE = 0x02U,
318  LOWER = 0x04U,
319  UPPER = 0x08U
320  };
Enumerator
UNKNOWNDELIM 
PLAINBRACKETS 
SQUAREBRACKETS 
CURLYBRACKETS 
SINGLEQUOTE 
DOUBLEQUOTE 
DEFAULTDELIM 
LASTDELIM 

Definition at line 287 of file parser.h.

Enumerator
UNKNOWN 
DESCRIPTION 
FIRSTARG 
ARG 
LASTARG 
NOARGS 
WORD 
NUMBER 
STRING 
ENDOFFILE 
LASTITEM 

Definition at line 271 of file parser.h.

Constructor & Destructor Documentation

HighParser::HighParser ( MathParser MP,
InputStream streamIn 
)

Definition at line 622 of file parser.cc.

References CurrToken, DEBUGCOUTFNAME, DESCRIPTION, InitDescData(), and pHP.

623 : ESCAPE_CHAR('\\'),
624 LowP(*this),
625 pIn(&streamIn),
626 pf(NULL),
627 MathP(MP),
628 KeyT(0)
629 {
630  DEBUGCOUTFNAME("HighParser::HighParser");
632 
633  InitDescData();
634 
635  pHP.push(this);
636 }
const char ESCAPE_CHAR
Definition: parser.h:300
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
std::ifstream * pf
Definition: parser.h:420
Token CurrToken
Definition: parser.h:435
LowParser LowP
Definition: parser.h:416
const KeyTable * KeyT
Definition: parser.h:431
static void InitDescData(void)
Definition: parser.cc:553
MathParser & MathP
Definition: parser.h:428
InputStream * pIn
Definition: parser.h:419
static std::stack< const HighParser * > pHP
Definition: parser.cc:598

Here is the call graph for this function:

HighParser::~HighParser ( void  )
virtual

Definition at line 639 of file parser.cc.

References ASSERT, Close(), DEBUGCOUTFNAME, DestroyDescData(), and pHP.

640 {
641  DEBUGCOUTFNAME("HighParser::~HighParser");
642  Close();
643  ASSERT(pHP.top() == this);
644  pHP.pop();
645 
646  DestroyDescData();
647 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
virtual void Close(void)
Definition: parser.cc:651
#define ASSERT(expression)
Definition: colamd.c:977
static std::stack< const HighParser * > pHP
Definition: parser.cc:598
static void DestroyDescData(void)
Definition: parser.cc:575

Here is the call graph for this function:

Member Function Documentation

void HighParser::Close ( void  )
virtual

Reimplemented in IncludeParser.

Definition at line 651 of file parser.cc.

References NO_OP.

Referenced by ~HighParser().

652 {
653  NO_OP;
654 }
#define NO_OP
Definition: myassert.h:74
void HighParser::Eof ( void  )
protectedvirtual

Reimplemented in IncludeParser.

Definition at line 724 of file parser.cc.

References MBDYN_EXCEPT_ARGS.

Referenced by GetDescription().

725 {
727 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
void HighParser::ExpectArg ( void  )
virtual

Definition at line 798 of file parser.cc.

References ARG, and CurrToken.

Referenced by DriveHint::pCreateDrive(), TplDriveHint< T >::pCreateDrive(), and TplVecHint< T >::pCreateVec().

799 {
800  /* forces the next expected token to be an argument
801  * e.g. a keyword followed by a separator (deprecated) */
803 }
Token CurrToken
Definition: parser.h:435
void HighParser::ExpectDescription ( void  )
virtual

Definition at line 789 of file parser.cc.

References CurrToken, and DESCRIPTION.

Referenced by DataManager::ReadElems().

790 {
791  /* forces the next expected token to be a "description"
792  * e.g. a keyword followed by a colon (deprecated) */
794 }
Token CurrToken
Definition: parser.h:435
HighParser::Token HighParser::FirstToken ( void  )
protectedvirtual

Definition at line 767 of file parser.cc.

References ARG, LowParser::COLON, CurrLowToken, CurrToken, DESCRIPTION, LowParser::GetToken(), LowP, pIn, LowParser::SEMICOLON, and UNKNOWN.

Referenced by GotDescription(), and iGetDescription_int().

768 {
770 
771  switch (CurrLowToken) {
772  case LowParser::COLON:
774  break;
775 
778  break;
779 
780  default:
782  break;
783  }
784 
785  return CurrToken;
786 }
Token CurrToken
Definition: parser.h:435
LowParser LowP
Definition: parser.h:416
Token GetToken(InputStream &In)
Definition: parser.cc:189
LowParser::Token CurrLowToken
Definition: parser.h:434
InputStream * pIn
Definition: parser.h:419

Here is the call graph for this function:

bool HighParser::GetBool ( bool  bDefval = false)
virtual

Definition at line 1010 of file parser.cc.

References TypedValue::GetBool(), and GetValue().

Referenced by DataManager::fReadOutput(), GetYesNoOrBool(), LinearBiStopCLR< T, Tder >::Read(), and ReadBiStopBase().

1011 {
1012  TypedValue v(bDefVal);
1013  v = GetValue(v);
1014  return v.GetBool();
1015 }
virtual TypedValue GetValue(const TypedValue &v)
Definition: parser.cc:1004

Here is the call graph for this function:

int HighParser::GetDescription ( void  )

Definition at line 730 of file parser.cc.

References CurrLowToken, InputStream::eof(), Eof(), GetLineData(), LowParser::GetToken(), iGetDescription_int(), IsDescription(), LowP, MBDYN_EXCEPT_ARGS, pIn, ReadDescription(), LowParser::sGetWord(), and LowParser::WORD.

Referenced by DataManager::DataManager(), DataManager::ReadControl(), InverseSolver::ReadData(), Solver::ReadData(), DataManager::ReadDrivers(), DataManager::ReadElems(), DataManager::ReadNodes(), and RunMBDyn().

731 {
732  /* Checks if current token is a description */
733  if (!IsDescription()) {
734  silent_cerr("Parser error in HighParser::GetDescription, "
735  "invalid call to GetDescription at line "
736  << GetLineData() << std::endl);
738  }
739 
740 restart_parsing:;
741 
743  if (CurrLowToken != LowParser::WORD) {
744  if (pIn->eof()) {
745  Eof();
746  goto restart_parsing;
747  }
748 
749  silent_cerr("Parser error in HighParser::GetDescription, "
750  << "keyword expected at line "
751  << GetLineData() << std::endl);
753  }
754 
755  /* Description corrente */
756  char* s = LowP.sGetWord();
757 
758  if (ReadDescription(*this, s)) {
759  goto restart_parsing;
760  }
761 
762  return iGetDescription_int(s);
763 }
char * sGetWord(void)
Definition: parser.cc:244
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
bool IsDescription(void) const
Definition: parser.cc:692
bool ReadDescription(HighParser &HP, const std::string &desc)
Definition: parser.cc:310
virtual HighParser::ErrOut GetLineData(void) const
Definition: parser.cc:681
virtual void Eof(void)
Definition: parser.cc:724
LowParser LowP
Definition: parser.h:416
Token GetToken(InputStream &In)
Definition: parser.cc:189
LowParser::Token CurrLowToken
Definition: parser.h:434
InputStream * pIn
Definition: parser.h:419
int iGetDescription_int(const char *const s)
Definition: parser.cc:704
bool eof(void) const
Definition: input.h:139

Here is the call graph for this function:

integer HighParser::GetInt ( integer  iDefval = 0)
virtual

Definition at line 1050 of file parser.cc.

Referenced by AeroDynModule::AeroDynModule(), MBDynParser::C81Data_int(), MBDynParser::ConstitutiveLaw_int(), MBDynParser::DriveCaller_int(), MBDynParser::GetConstLaw1D(), MBDynParser::GetConstLaw3D(), MBDynParser::GetConstLaw6D(), GetDofOrder(), MBDynParser::GetDriveCaller(), MBDynParser::GetHydraulicFluid(), MBDynParser::GetMatR2vec(), MBDynParser::GetRef(), SocketStreamOutputElemCreator::getSocketStreamOutParam(), MBDynParser::GetTplDriveCaller(), MBDynParser::GetVecAbs(), MBDynParser::GetVecRel(), MBDynParser::HydraulicFluid_int(), HydrodynamicPlainBearing::HydrodynamicPlainBearing(), ModuleNonsmoothNode::ModuleNonsmoothNode(), VariableStepDR::Read(), FixedStepDR::Read(), MultiStepDriveDCR::Read(), SwitchDriveDCR::Read(), MinMaxDriveDCR::Read(), CLArray1DR::Read(), ValuesContentTypeReader::Read(), CLArray3DR::Read(), CLArray6DR::Read(), DummyCLR< T, Tder >::Read(), FactorTSR::Read(), JoystickDR::Read(), ArrayTDCR< T >::Read(), SineCosineDCR::Read(), FourierSeriesDCR::Read(), RandomDCR::Read(), MeterDCR::Read(), PiecewiseLinearDCR::Read(), SimulationEntityDCR::Read(), ElementDCR::Read(), NodeDCR::Read(), ArrayDCR::Read(), FileDCR::Read(), PostponedDCR::Read(), ReadAeroData(), ReadAerodynamicBeam(), ReadAerodynamicBeam2(), ReadAerodynamicModal(), ReadBeam(), ReadBeam2(), ReadBody(), ReadBufferStreamDrive(), ReadBufferStreamElem(), ReadC81MultipleAeroData(), DataManager::ReadControl(), InverseSolver::ReadData(), Solver::ReadData(), DataManager::ReadDrivers(), ReadElectric(), DataManager::ReadElem(), DataManager::ReadElems(), ReadExtFileParams(), ReadExtForce(), ReadExtSocketHandler(), ReadFF(), ReadGenel(), ReadHBeam(), ReadInducedVelocity(), ReadLinSol(), ReadModal(), ReadModalForce(), ReadModalMappingExtForce(), DataManager::ReadNode(), DataManager::ReadNodes(), ReadOneBufCast(), DataManager::ReadOneElem(), ReadResSet(), ReadResSets(), ReadRotor(), ReadRTMBDynInDrive(), ReadRTParams(), ReadScalarDof(), ReadShape(), ReadStreamContentModifier(), ReadStreamDriveEcho(), ReadStreamDriveModifier(), ReadStreamOutEcho(), ReadStructExtForce(), ReadStructMappingExtForce(), ReadUnsteadyFlag(), MBDynParser::Reference_int(), MBDynParser::TplDriveCaller_int(), and Wheel4::Wheel4().

1051 {
1052  return GetInt<range_any<integer> >(iDefVal, range_any<integer>());
1053 }
template<class Range >
integer HighParser::GetInt ( integer  iDefval,
Range  r 
)
template<class Range >
integer HighParser::GetInt ( int  iDefVal,
Range  range 
)

Definition at line 555 of file parser.h.

References TypedValue::GetInt(), GetValue(), and MBDYN_EXCEPT_ARGS.

556 {
557  TypedValue v(iDefVal);
558  v = GetValue(v);
559  integer val = v.GetInt();
560  if (!range.check(val)) {
561  throw ErrValueOutOfRange<integer>(MBDYN_EXCEPT_ARGS, val);
562  }
563  return val;
564 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual TypedValue GetValue(const TypedValue &v)
Definition: parser.cc:1004
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

HighParser::ErrOut HighParser::GetLineData ( void  ) const
virtual

Reimplemented in IncludeParser.

Definition at line 681 of file parser.cc.

References GetLineNumber(), HighParser::ErrOut::iLineNumber, HighParser::ErrOut::sFileName, and HighParser::ErrOut::sPathName.

Referenced by GetDescription(), GetString(), GetStringWithDelims(), GetValue(), GetWord(), iGetDescription_int(), NextToken(), ChDirDR::Read(), NameSpaceDR::Read(), RemarkDR::Read(), PrintSymbolTableDR::Read(), SetDR::Read(), SetEnvDR::Read(), ExitDR::Read(), ReadDescription(), ReadLinSol(), ReadOneBufCast(), and skip_remarks().

682 {
683  ErrOut LineData;
684  LineData.iLineNumber = GetLineNumber();
685  LineData.sFileName = NULL;
686  LineData.sPathName = NULL;
687  return LineData;
688 }
virtual int GetLineNumber(void) const
Definition: parser.cc:674

Here is the call graph for this function:

int HighParser::GetLineNumber ( void  ) const
virtual

Definition at line 674 of file parser.cc.

References pIn.

Referenced by IncludeParser::GetLineData(), GetLineData(), and ReadGenel().

675 {
676  return const_cast<InputStream *>(pIn)->GetLineNumber();
677 }
InputStream * pIn
Definition: parser.h:419
virtual int GetLineNumber(void) const
Definition: parser.cc:674
MathParser & HighParser::GetMathParser ( void  )
virtual

Definition at line 668 of file parser.cc.

References MathP.

Referenced by DataManager::DataManager(), module_init(), InverseSolver::Prepare(), Solver::Prepare(), NameSpaceDR::Read(), PrintSymbolTableDR::Read(), and StringDCR::Read().

669 {
670  return MathP;
671 }
MathParser & MathP
Definition: parser.h:428
doublereal HighParser::GetReal ( const doublereal dDefval = 0.0)
virtual

Definition at line 1056 of file parser.cc.

Referenced by AeroDynModule::AeroDynModule(), asynchronous_machine::asynchronous_machine(), MBDynParser::C81Data_int(), DataManager::dReadScale(), MBDynParser::Get(), MBDynParser::GetMat3x3(), MBDynParser::GetMat3x3Sym(), MBDynParser::GetMat6x6(), MBDynParser::GetMat6xN(), MBDynParser::GetMatR2vec(), MBDynParser::GetVec3(), MBDynParser::GetVec6(), HydrodynamicPlainBearing::HydrodynamicPlainBearing(), InlineFriction::InlineFriction(), LoadIncNorm::LoadIncNorm(), ModuleFMU::ModuleFMU(), ModuleMDS::ModuleMDS(), ModuleNonsmoothNode::ModuleNonsmoothNode(), ParseFriction(), ParseShapeCoefficient(), DummySFR::Read(), FixedStepDR::Read(), MultiStepDriveDCR::Read(), HydraulicDamperCLR::Read(), PowerLawGR::Read(), DummyDCR::Read(), Gust1DGR::Read(), LogarithmicGR::Read(), HuntCrossleyCLR::Read(), ConstSFR::Read(), TDCLWR< T, Tder >::Read(), LinearSFR::Read(), ContContactCLR::Read(), PowSFR::Read(), MusclePennestriCLR::Read(), DummyCLR< T, Tder >::Read(), FactorTSR::Read(), LinearElasticCLR< T, Tder >::Read(), NLSFViscoElasticCLR< T, Tder, Typ >::Read(), NLPViscoElasticCLR< T, Tder, Typ >::Read(), LogSFR::Read(), LinearElasticGenericAxialTorsionCouplingCLR< T, Tder >::Read(), JoystickDR::Read(), LinearViscoElasticGenericAxialTorsionCouplingCLR< T, Tder >::Read(), InverseSquareElasticCLR::Read(), GRAALLDamperCLR::Read(), ExpSFR::Read(), LogElasticCLR< T, Tder >::Read(), DoubleLinearElasticCLR< T, Tder >::Read(), IsotropicHardeningCLR< T, Tder >::Read(), CubicSplineSFR::Read(), ContContact3DCLR::Read(), ContactElasticCLR< T, Tder >::Read(), MultiLinearSFR::Read(), InvAngularCLR::Read(), ChebychevSFR::Read(), LinearViscousCLR< T, Tder >::Read(), LinearViscoElasticCLR< T, Tder >::Read(), LinearViscoElasticGenericCLR< T, Tder >::Read(), LTVViscoElasticGenericCLR< T, Tder >::Read(), DoubleLinearViscoElasticCLR< T, Tder >::Read(), TurbulentViscoElasticCLR< T, Tder >::Read(), LinearBiStopCLR< T, Tder >::Read(), ConstDCR::Read(), LinearDCR::Read(), ParabolicDCR::Read(), CubicDCR::Read(), StepDCR::Read(), DoubleStepDCR::Read(), RampDCR::Read(), DoubleRampDCR::Read(), SineCosineDCR::Read(), TanhDCR::Read(), FourierSeriesDCR::Read(), FrequencySweepDCR::Read(), ExponentialDCR::Read(), RandomDCR::Read(), MeterDCR::Read(), ClosestNextDCR::Read(), PiecewiseLinearDCR::Read(), SHDCR::Read(), FileDCR::Read(), PeriodicDCR::Read(), ReadAerodynamicBody(), ReadAerodynamicModal(), ReadAirProperties(), ReadBody(), ReadBufferStreamDrive(), ReadC81MultipleAeroData(), DataManager::ReadControl(), InverseSolver::ReadData(), Solver::ReadData(), ReadElectric(), ReadFF(), ReadGenel(), ReadGenericAerodynamicForce(), ReadGravity(), ReadHydraulicElem(), ReadHydraulicFluid(), PlaneHingeJoint::ReadInitialState(), PlanePinJoint::ReadInitialState(), ReadJointRegularization(), ReadLinSol(), ReadMembrane4EAS(), ReadMembraneConstLaw(), ReadModal(), ReadModalForce(), DataManager::ReadNodes(), ReadRotor(), ReadRTMBDynInDrive(), DataManager::ReadScalarAlgebraicNode(), DataManager::ReadScalarDifferentialNode(), ReadShape(), ReadShell4EAS(), ReadShell4EASANS(), ReadShellConstLaw(), ReadSparseMappingMatrix(), ReadStreamDriveEcho(), ReadStreamOutEcho(), ReadStructMappingExtForce(), ReadStructNode(), ReadThermal(), ReadUniform(), MBDynParser::Reference_int(), ShockAbsorberConstitutiveLaw< doublereal, doublereal >::ShockAbsorberConstitutiveLaw(), Wheel2::Wheel2(), and Wheel4::Wheel4().

1057 {
1058  return GetReal<range_any<doublereal> >(dDefVal, range_any<doublereal>());
1059 }
template<class Range >
doublereal HighParser::GetReal ( const doublereal dDefval,
Range  r 
)

Definition at line 569 of file parser.h.

References TypedValue::GetReal(), GetValue(), and MBDYN_EXCEPT_ARGS.

570 {
571  TypedValue v(dDefVal);
572  v = GetValue(v);
573  doublereal val = v.GetReal();
574  if (!range.check(val)) {
575  throw ErrValueOutOfRange<doublereal>(MBDYN_EXCEPT_ARGS, val);
576  }
577  return val;
578 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual TypedValue GetValue(const TypedValue &v)
Definition: parser.cc:1004
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

std::string HighParser::GetString ( const std::string &  sDefVal)
virtual

Definition at line 1074 of file parser.cc.

References TypedValue::GetString(), and GetValue().

Referenced by module_init(), ModuleFMU::ModuleFMU(), NameSpaceDR::Read(), PrintSymbolTableDR::Read(), ElementDCR::Read(), NodeDCR::Read(), ReadAeroData(), and ReadModal().

1075 {
1076  TypedValue v(sDefVal);
1077  v = GetValue(v);
1078  return v.GetString();
1079 }
virtual TypedValue GetValue(const TypedValue &v)
Definition: parser.cc:1004

Here is the call graph for this function:

const char * HighParser::GetString ( unsigned  flags = HighParser::NONE)
virtual

Definition at line 1113 of file parser.cc.

References ARG, CurrToken, EATSPACES, ENDOFFILE, InputStream::eof(), InputStream::get(), GetLineData(), iDefaultBufSize, LOWER, MBDYN_EXCEPT_ARGS, NextToken(), NO_OP, pIn, InputStream::putback(), sStringBuf, and UPPER.

1114 {
1115  const char sFuncName[] = "HighParser::GetString()";
1116 
1117  pedantic_cout("use of deprecated method \"GetString\" at line"
1118  << GetLineData() << std::endl);
1119 
1120  if (CurrToken != HighParser::ARG) {
1121  silent_cerr("Parser error in "
1122  << sFuncName << ", string arg expected at line "
1123  << GetLineData() << std::endl);
1125  }
1126 
1127  char* s = sStringBuf;
1128  char* sTmp = s;
1129 
1130  char cIn = '\0';
1131 
1132  while (isspace(cIn = pIn->get())) {
1133  NO_OP;
1134  }
1135 
1136  if (pIn->eof()) {
1138  return NULL;
1139  }
1140 
1141  pIn->putback(cIn);
1142  for (cIn = pIn->get(); cIn != ',' && cIn != ';'; cIn = pIn->get()) {
1143  /* Attenzione! cosi' la legge tutta,
1144  * ma ne tiene solo iBufSize-1 caratteri */
1145  if (pIn->eof()) {
1147  *sTmp = '\0';
1148  return s;
1149 
1150  } else if (sTmp < s + iDefaultBufSize - 1) {
1151  if (!(flags & HighParser::EATSPACES) || !isspace(cIn)) {
1152  if (flags & HighParser::LOWER) {
1153  cIn = tolower(cIn);
1154 
1155  } else if (flags & HighParser::UPPER) {
1156  cIn = toupper(cIn);
1157  }
1158 
1159  *sTmp++ = cIn;
1160  }
1161  }
1162  }
1163 
1164  pIn->putback(cIn);
1165  *sTmp = '\0';
1166 
1167  NextToken(sFuncName);
1168 
1169  return s;
1170 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual HighParser::ErrOut GetLineData(void) const
Definition: parser.cc:681
Token CurrToken
Definition: parser.h:435
#define NO_OP
Definition: myassert.h:74
char get(void)
Definition: input.h:99
InputStream & putback(char ch)
Definition: input.h:121
const unsigned int iDefaultBufSize
Definition: parser.h:133
virtual void NextToken(const char *sFuncName)
Definition: parser.cc:822
InputStream * pIn
Definition: parser.h:419
char sStringBuf[iDefaultBufSize]
Definition: parser.h:423
bool eof(void) const
Definition: input.h:139

Here is the call graph for this function:

const char * HighParser::GetStringWithDelims ( enum Delims  Del = DEFAULTDELIM,
bool  escape = true 
)
virtual

Definition at line 1228 of file parser.cc.

References ARG, c, CurrToken, InputStream::eof(), ESCAPE_CHAR, InputStream::get(), GetLineData(), iDefaultBufSize, MBDYN_EXCEPT_ARGS, NextToken(), pIn, InputStream::putback(), SetDelims(), skip_remarks(), and sStringBuf.

Referenced by AeroDynModule::AeroDynModule(), MBDynParser::C81Data_int(), MBDynParser::ConstitutiveLaw_int(), MBDynParser::DriveCaller_int(), LoadableElem::GetCalls(), IncludeParser::GetFileName(), MBDynParser::GetScalarFunction(), SocketStreamOutputElemCreator::getSocketStreamOutParam(), MBDynParser::HydraulicFluid_int(), ModuleFMU::ModuleFMU(), ParseScalarFunction(), GiNaCDCR::Read(), LoadableElemRead::Read(), SetEnvDR::Read(), SymbolicCLR< T, Tder >::Read(), StringDCR::Read(), SimulationEntityDCR::Read(), ReadAuthMethod(), DataManager::ReadControl(), Solver::ReadData(), DataManager::ReadElems(), ReadExtSocketHandler(), ReadModal(), DataManager::ReadNodes(), ReadRTMBDynInDrive(), MBDynParser::Reference_int(), and MBDynParser::TplDriveCaller_int().

1229 {
1230  const char sFuncName[] = "HighParser::GetStringWithDelims()";
1231 
1232  if (CurrToken != HighParser::ARG) {
1233  silent_cerr("Parser error in "
1234  << sFuncName << ", string arg expected at line "
1235  << GetLineData() << std::endl);
1237  }
1238 
1239  char* s = sStringBuf;
1240  char* sTmp = s;
1241 
1242  char cLdelim, cRdelim;
1243  SetDelims(Del, cLdelim, cRdelim);
1244 
1245  char cIn;
1246  if (skip_remarks(*this, *pIn, cIn)) {
1247  return NULL;
1248  }
1249 
1250  /* Se trova il delimitatore sinistro, legge la stringa */
1251  if (cIn == cLdelim) {
1252  for (cIn = pIn->get(); cIn != cRdelim; cIn = pIn->get()) {
1253  /* Attenzione! cosi' la legge tutta,
1254  * ma ne tiene solo iBufSize-1 caratteri */
1255  if (pIn->eof()) {
1256  /* FIXME: this should be an error ... */
1257  sTmp[0] = '\0';
1258  return s;
1259 
1260  } else if (sTmp < s + iDefaultBufSize - 1) {
1261  if (cIn == ESCAPE_CHAR) {
1262  cIn = pIn->get();
1263  if (cIn == '\n') {
1264 
1265  /*
1266  * eat the newline as well, so that
1267 
1268  "first line\
1269  second line"
1270 
1271  * actually results in "first linesecond line"
1272  */
1273 
1274  cIn = pIn->get();
1275 
1276  } else if (cIn == '\r') {
1277  cIn = pIn->get();
1278  if (cIn != '\n') {
1279  pIn->putback(cIn);
1280  goto escaped_generic;
1281  }
1282  cIn = pIn->get();
1283 
1284  } else if ((cIn == ESCAPE_CHAR) || (cIn == cRdelim)) {
1285  if (!escape) {
1286  sTmp[0] = ESCAPE_CHAR;
1287  ++sTmp;
1288  }
1289 
1290  } else {
1291 escaped_generic:;
1292  if (escape) {
1293  int i, c = 0;
1294  char hex[3];
1295 
1296  /*
1297  * allow non-printable chars in the form "<hexpair>",
1298  * so that "\78" is equivalent to "x";
1299  * "<non-hexpair>" is treated as an error.
1300  */
1301 
1302  hex[0] = cIn;
1303  hex[1] = pIn->get();
1304  hex[2] = '\0';
1305 
1306  for (i = 0; i < 2; i++) {
1307  int shift = 4*(1 - i), h = 0;
1308 
1309  /* NOTE: this conversion relies
1310  * on 0-9, a-f, A-F being consecutive,
1311  * which is true for ASCII, but might
1312  * not be for other encodings;
1313  * bah, not critical right now */
1314  if (hex[i] >= '0' && hex[i] <= '9') {
1315  h = hex[i] - '0';
1316  } else if (hex[i] >= 'a' && hex[i] <= 'f') {
1317  h = hex[i] - 'a';
1318  } else if (hex[i] >= 'A' && hex[i] <= 'F') {
1319  h = hex[i] - 'A';
1320  } else {
1321  silent_cerr("invalid escape sequence "
1322  "\"\\" << hex << "\" "
1323  "at line " << GetLineData()
1324  << std::endl);
1326  }
1327 
1328  c += (h << shift);
1329  }
1330  cIn = c;
1331 
1332  } else {
1333  sTmp[0] = ESCAPE_CHAR;
1334  ++sTmp;
1335  }
1336  }
1337  }
1338  sTmp[0] = cIn;
1339  ++sTmp;
1340  }
1341  }
1342 
1343  /* Se trova una virgola o un punto e virgola, le rimette nello stream
1344  * e passa oltre, restituendo un puntatore nullo. Il chiamante deve
1345  * occuparsi della gestione del valore di default */
1346  } else if (cIn == ',' || cIn == ';') {
1347  pIn->putback(cIn);
1348  goto nullstring;
1349 
1350  /* Altrimenti c'e' qualcosa senza delimitatore. Adesso da' errore,
1351  * forse e' piu' corretto fargli ritornare lo stream intatto */
1352  } else {
1353  silent_cerr("Parser error in "
1354  << sFuncName << std::endl
1355  << "first non-blank char at line "
1356  << GetLineData() << " isn't a valid left-delimiter"
1357  << std::endl);
1359  }
1360 
1361  /* Mette zero al termine della stringa */
1362  *sTmp = '\0';
1363 
1364 nullstring:;
1365  NextToken(sFuncName);
1366  return s;
1367 }
const char ESCAPE_CHAR
Definition: parser.h:300
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual HighParser::ErrOut GetLineData(void) const
Definition: parser.cc:681
Token CurrToken
Definition: parser.h:435
char get(void)
Definition: input.h:99
InputStream & putback(char ch)
Definition: input.h:121
const unsigned int iDefaultBufSize
Definition: parser.h:133
static int skip_remarks(HighParser &HP, InputStream &In, char &cIn)
Definition: parser.cc:49
static std::stack< cleanup * > c
Definition: cleanup.cc:59
virtual void NextToken(const char *sFuncName)
Definition: parser.cc:822
InputStream * pIn
Definition: parser.h:419
virtual void SetDelims(enum Delims Del, char &cLdelim, char &cRdelim) const
Definition: parser.cc:1173
char sStringBuf[iDefaultBufSize]
Definition: parser.h:423
bool eof(void) const
Definition: input.h:139

Here is the call graph for this function:

mbsleep_t HighParser::GetTimeout ( const mbsleep_t DefVal)
virtual

Definition at line 1062 of file parser.cc.

References TypedValue::GetReal(), GetValue(), mbsleep_real2sleep(), and mbsleep_sleep2real().

Referenced by ReadExtFileParams().

1063 {
1064  doublereal d;
1065  mbsleep_sleep2real(&DefVal, &d);
1066  TypedValue v(d);
1067  v = GetValue(v);
1068  mbsleep_t newval;
1069  mbsleep_real2sleep(v.GetReal(), &newval);
1070  return newval;
1071 }
unsigned long mbsleep_t
Definition: mbsleep.h:51
int mbsleep_sleep2real(const mbsleep_t *t, doublereal *d)
Definition: mbsleep.c:74
virtual TypedValue GetValue(const TypedValue &v)
Definition: parser.cc:1004
int mbsleep_real2sleep(doublereal d, mbsleep_t *t)
Definition: mbsleep.c:49
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

TypedValue HighParser::GetValue ( const TypedValue v)
virtual

Definition at line 1004 of file parser.cc.

Referenced by GetBool(), GetInt(), GetReal(), GetString(), GetTimeout(), RemarkDR::Read(), and SetDR::Read().

1005 {
1006  return GetValue<range_any<TypedValue> >(vDefVal, range_any<TypedValue>());
1007 }
template<class Range >
TypedValue HighParser::GetValue ( const TypedValue v,
Range  r 
)

Definition at line 582 of file parser.h.

References ARG, CurrToken, MathParser::Get(), GetLineData(), MathP, MBDYN_EXCEPT_ARGS, NextToken(), pIn, and MBDynErrBase::what().

583 {
584  const char sFuncName[] = "HighParser::GetValue()";
585 
586  if (CurrToken != HighParser::ARG) {
587  silent_cerr("Parser error in " << sFuncName << ", arg expected at line "
588  << GetLineData() << std::endl);
590  }
591 
592  TypedValue v(vDefVal);
593 
594  try {
595  v = MathP.Get(*pIn, v);
596  }
597  catch (TypedValue::ErrWrongType& e) {
598  silent_cerr(sFuncName << ": " << e.what() << " at line "
599  << GetLineData() << std::endl);
600  throw e;
601  }
602  catch (MathParser::ErrGeneric& e) {
603  silent_cerr(sFuncName << ": error return from MathParser at line "
604  << GetLineData() << std::endl);
605  throw e;
606  }
607  catch (...) {
608  throw;
609  }
610 
611  NextToken(sFuncName);
612 
613  if (!range.check(v)) {
614  throw ErrValueOutOfRange<TypedValue>(MBDYN_EXCEPT_ARGS, v);
615  }
616 
617  return v;
618 }
Real Get(Real d=0.)
Definition: mathp.cc:4496
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
const char * what(void) const
Definition: except.cc:54
virtual HighParser::ErrOut GetLineData(void) const
Definition: parser.cc:681
Token CurrToken
Definition: parser.h:435
MathParser & MathP
Definition: parser.h:428
virtual void NextToken(const char *sFuncName)
Definition: parser.cc:822
InputStream * pIn
Definition: parser.h:419

Here is the call graph for this function:

int HighParser::GetWord ( void  )
virtual

Definition at line 1083 of file parser.cc.

References ARG, CurrLowToken, CurrToken, KeyTable::Find(), GetLineData(), LowParser::GetToken(), KeyT, LowP, MBDYN_EXCEPT_ARGS, NextToken(), pIn, LowParser::sGetWord(), and LowParser::WORD.

Referenced by DataManager::DataManager(), ReadAuthMethod(), ReadBulk(), DataManager::ReadControl(), InverseSolver::ReadData(), Solver::ReadData(), DataManager::ReadDrivers(), ReadElectric(), DataManager::ReadElems(), ReadForce(), ReadGenel(), ReadHydraulicElem(), ReadLinSol(), DataManager::ReadNodes(), ReadRotor(), ReadScalarDof(), ReadStructNode(), ReadThermal(), and RunMBDyn().

1084 {
1085  const char sFuncName[] = "HighParser::GetWord()";
1086 
1087  if (CurrToken != HighParser::ARG) {
1088  silent_cerr("Parser error in "
1089  << sFuncName << ", keyword arg expected at line "
1090  << GetLineData() << std::endl);
1092  }
1093 
1095  if (CurrLowToken != LowParser::WORD) {
1096  silent_cerr("Parser error in "
1097  << sFuncName << ", keyword expected at line "
1098  << GetLineData() << std::endl);
1100  }
1101 
1102  int i = -1;
1103  if (KeyT) {
1104  i = KeyT->Find(LowP.sGetWord());
1105  }
1106 
1107  NextToken(sFuncName);
1108 
1109  return i;
1110 }
char * sGetWord(void)
Definition: parser.cc:244
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual HighParser::ErrOut GetLineData(void) const
Definition: parser.cc:681
Token CurrToken
Definition: parser.h:435
LowParser LowP
Definition: parser.h:416
int Find(const char *sToFind) const
Definition: parser.cc:271
Token GetToken(InputStream &In)
Definition: parser.cc:189
LowParser::Token CurrLowToken
Definition: parser.h:434
const KeyTable * KeyT
Definition: parser.h:431
virtual void NextToken(const char *sFuncName)
Definition: parser.cc:822
InputStream * pIn
Definition: parser.h:419

Here is the call graph for this function:

bool HighParser::GetYesNo ( bool bRet)
virtual

Definition at line 1022 of file parser.cc.

References IsKeyWord().

Referenced by SocketStreamOutputElemCreator::getSocketStreamOutParam(), GetYesNoOrBool(), VariableStepDR::Read(), FixedStepDR::Read(), DataManager::ReadControl(), ReadExtForce(), ReadExtSocketHandler(), ReadGenel(), ReadGenericAerodynamicForce(), ReadModalMappingExtForce(), ReadRTMBDynInDrive(), ReadStructExtForce(), and ReadStructMappingExtForce().

1023 {
1024  if (IsKeyWord("yes")) {
1025  bRet = true;
1026 
1027  } else if (IsKeyWord("no")) {
1028  bRet = false;
1029 
1030  } else {
1031  return false;
1032  }
1033 
1034  return true;
1035 }
virtual int IsKeyWord(void)
Definition: parser.cc:940

Here is the call graph for this function:

bool HighParser::GetYesNoOrBool ( bool  bDefval = false)
virtual
HighParser::Token HighParser::GotDescription ( void  )

Definition at line 698 of file parser.cc.

References FirstToken().

Referenced by ReadDescription().

699 {
700  return FirstToken();
701 }
virtual HighParser::Token FirstToken(void)
Definition: parser.cc:767

Here is the call graph for this function:

int HighParser::iGetDescription_int ( const char *const  s)
protected

Definition at line 704 of file parser.cc.

References KeyTable::Find(), FirstToken(), GetLineData(), KeyT, MBDYN_EXCEPT_ARGS, and UNKNOWN.

Referenced by GetDescription().

705 {
706  int i = -1;
707 
708  if (KeyT) {
709  i = KeyT->Find(s);
710  }
711 
712  if (FirstToken() == HighParser::UNKNOWN) {
713  silent_cerr("Parser error in HighParser::iGetDescription_int(), "
714  "semicolon expected at line "
715  << GetLineData() << std::endl);
717  }
718 
719  return i;
720 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual HighParser::ErrOut GetLineData(void) const
Definition: parser.cc:681
int Find(const char *sToFind) const
Definition: parser.cc:271
const KeyTable * KeyT
Definition: parser.h:431
virtual HighParser::Token FirstToken(void)
Definition: parser.cc:767

Here is the call graph for this function:

bool HighParser::IsArg ( void  )
virtual

Definition at line 807 of file parser.cc.

References ARG, and CurrToken.

Referenced by asynchronous_machine::asynchronous_machine(), MBDynParser::C81Data_int(), MBDynParser::ConstitutiveLaw_int(), SocketStreamOutputElemCreator::createSocketStreamOutElem(), CyclocopterNoInflow::CyclocopterNoInflow(), CyclocopterPolimi::CyclocopterPolimi(), CyclocopterUniform1D::CyclocopterUniform1D(), CyclocopterUniform2D::CyclocopterUniform2D(), MBDynParser::DriveCaller_int(), SocketStreamOutputElemCreator::getSocketStreamOutParam(), MBDynParser::HydraulicFluid_int(), HydrodynamicPlainBearing::HydrodynamicPlainBearing(), IncludeParser::Include_int(), InlineFriction::InlineFriction(), LoadIncForce::LoadIncForce(), LoadIncNorm::LoadIncNorm(), module_init(), ModuleFMU::ModuleFMU(), ModuleIMU::ModuleIMU(), ModuleIMUConstraint::ModuleIMUConstraint(), MBDynParser::ModuleLoad_int(), ModuleMDS::ModuleMDS(), ModuleNonsmoothNode::ModuleNonsmoothNode(), ModuleTemplate::ModuleTemplate(), ChDirDR::Read(), ScalarFuncGR::Read(), NameSpaceDR::Read(), HydraulicDamperCLR::Read(), PowerLawGR::Read(), LogarithmicGR::Read(), HuntCrossleyCLR::Read(), MotionContentTypeReader::Read(), ContContactCLR::Read(), MusclePennestriCLR::Read(), FactorTSR::Read(), RemarkDR::Read(), JoystickDR::Read(), PrintSymbolTableDR::Read(), SetDR::Read(), SetEnvDR::Read(), CubicSplineSFR::Read(), ContContact3DCLR::Read(), MultiLinearSFR::Read(), ChebychevSFR::Read(), TurbulentViscoElasticCLR< T, Tder >::Read(), FileDCR::Read(), ReadAeroData(), ReadAerodynamicBeam(), ReadAerodynamicBeam2(), ReadAerodynamicBody(), ReadAerodynamicCustomOutput(), ReadAerodynamicModal(), ReadBeam(), ReadBeam2(), ReadBeamCustomOutput(), ReadBody(), ReadBufferStreamElem(), ReadBulk(), DataManager::ReadControl(), InverseSolver::ReadData(), Solver::ReadData(), ReadDescription(), DataManager::ReadDrivers(), ReadElectric(), DataManager::ReadElems(), ReadExtSocketHandler(), ReadForce(), ReadGenel(), ReadHBeam(), ReadHydraulicElem(), ReadJoint(), ReadJointRegularization(), ReadMembraneConstLaw(), ReadModalExtForce(), ReadModalMappingExtForce(), DataManager::ReadNodes(), DataManager::ReadOneElem(), ReadRotor(), ReadRTMBDynInDrive(), DataManager::ReadScalarAlgebraicNode(), ReadShellConstLaw(), ReadStructExtForce(), ReadStructMappingExtForce(), ReadStructNode(), ReadThermal(), ReadUnsteadyFlag(), ReadVariableBody(), MBDynParser::Reference_int(), MBDynParser::ScalarFunction_int(), ShockAbsorberConstitutiveLaw< doublereal, doublereal >::ShockAbsorberConstitutiveLaw(), TimeStep::TimeStep(), MBDynParser::TplDriveCaller_int(), Wheel2::Wheel2(), and Wheel4::Wheel4().

808 {
809  return (CurrToken == ARG);
810 }
Token CurrToken
Definition: parser.h:435
bool HighParser::IsDescription ( void  ) const

Definition at line 692 of file parser.cc.

References CurrToken, and DESCRIPTION.

Referenced by GetDescription(), ExitDR::Read(), and ReadDescription().

693 {
695 }
Token CurrToken
Definition: parser.h:435
bool HighParser::IsKeyWord ( const char *  sKeyWord)
virtual

Definition at line 910 of file parser.cc.

References ARG, CurrToken, ENDOFFILE, NextToken(), ParseWord(), PutbackWord(), and sStringBuf.

Referenced by AeroDynModule::AeroDynModule(), asynchronous_machine::asynchronous_machine(), CyclocopterNoInflow::CyclocopterNoInflow(), CyclocopterPolimi::CyclocopterPolimi(), CyclocopterUniform1D::CyclocopterUniform1D(), CyclocopterUniform2D::CyclocopterUniform2D(), DataManager::dReadScale(), DataManager::fReadOutput(), LoadableElem::GetCalls(), GetDofOrder(), GetPreStrain(), GetPreStress(), SocketStreamOutputElemCreator::getSocketStreamOutParam(), HydrodynamicPlainBearing::HydrodynamicPlainBearing(), InlineFriction::InlineFriction(), LoadIncForce::LoadIncForce(), LoadIncNorm::LoadIncNorm(), ModuleFMU::ModuleFMU(), ModuleIMU::ModuleIMU(), ModuleIMUConstraint::ModuleIMUConstraint(), ModuleMDS::ModuleMDS(), ModuleNonsmoothNode::ModuleNonsmoothNode(), ModuleTemplate::ModuleTemplate(), ParseFriction(), ParseShapeCoefficient(), FlightGearStreamOutputReader::Read(), read(), FlightGearFileDriveReader::Read(), VariableStepDR::Read(), FixedStepDR::Read(), ScalarFuncGR::Read(), SwitchDriveDCR::Read(), GiNaCDCR::Read(), NodeDistDCR::Read(), HydraulicDamperCLR::Read(), PowerLawGR::Read(), Eu2PhiDCR::Read(), LogarithmicGR::Read(), HuntCrossleyCLR::Read(), TDCLWR< T, Tder >::Read(), MotionContentTypeReader::Read(), ValuesContentTypeReader::Read(), ContContactCLR::Read(), MusclePennestriCLR::Read(), NLSFViscoElasticCLR< T, Tder, Typ >::Read(), LoadableElemRead::Read(), NLPViscoElasticCLR< T, Tder, Typ >::Read(), LogSFR::Read(), AnnElasticCLR< T, Tder >::Read(), JoystickDR::Read(), PrintSymbolTableDR::Read(), LinearViscoElasticGenericAxialTorsionCouplingCLR< T, Tder >::Read(), AnnViscoElasticCLR< T, Tder >::Read(), CompTDCR< T >::Read(), ExpSFR::Read(), SetEnvDR::Read(), IsotropicHardeningCLR< T, Tder >::Read(), CubicSplineSFR::Read(), ContContact3DCLR::Read(), SymbolicCLR< T, Tder >::Read(), MultiLinearSFR::Read(), ChebychevSFR::Read(), LinearViscoElasticCLR< T, Tder >::Read(), LinearViscoElasticGenericCLR< T, Tder >::Read(), LTVViscoElasticGenericCLR< T, Tder >::Read(), DoubleLinearViscoElasticCLR< T, Tder >::Read(), LinearBiStopCLR< T, Tder >::Read(), ScalarFunctionOrthotropicCLR< T, Tder >::Read(), RampDCR::Read(), DoubleRampDCR::Read(), SineCosineDCR::Read(), FourierSeriesDCR::Read(), FrequencySweepDCR::Read(), RandomDCR::Read(), MeterDCR::Read(), ClosestNextDCR::Read(), SimulationEntityDCR::Read(), ElementDCR::Read(), NodeDCR::Read(), SHDCR::Read(), FileDCR::Read(), ReadAeroData(), ReadAerodynamicBeam(), ReadAerodynamicBeam2(), ReadAerodynamicBody(), ReadAerodynamicCustomOutput(), ReadAerodynamicModal(), ReadAircraftInstruments(), ReadAirProperties(), ReadAirstreamData(), ReadAuthMethod(), ReadBeam(), ReadBeam2(), ReadBeamCustomOutput(), ReadBiStopBase(), ReadBody(), ReadBufCast(), ReadBufferStreamDrive(), ReadBufferStreamElem(), ReadC81MultipleAeroData(), DataManager::ReadControl(), InverseSolver::ReadData(), Solver::ReadData(), ReadElectric(), DataManager::ReadElems(), ReadExtFileHandler(), ReadExtFileParams(), ReadExtForce(), ReadExtSocketHandler(), ReadFF(), ReadForce(), ReadGenel(), ReadGenericAerodynamicForce(), ReadGravity(), ReadHBeam(), ReadHydraulicElem(), ReadHydraulicFluid(), ReadInducedVelocity(), ReadJoint(), ReadJointRegularization(), ReadLinSol(), ReadMembraneConstLaw(), ReadModal(), ReadModalExtForce(), ReadModalForce(), ReadModalMappingExtForce(), DataManager::ReadNodes(), ReadOneBufCast(), DataManager::ReadOneElem(), ReadOptionalAerodynamicCustomOutput(), ReadOptionalBeamCustomOutput(), ReadOptionalOrientationDescription(), ReadOrientationDescription(), DriveCallerRead::ReadOutput(), ReadOutputElem(), ReadPX(), ReadResSet(), ReadResSets(), ReadRotor(), ReadRotorData(), ReadRTAISolver(), ReadRTMBDynInDrive(), ReadRTParams(), ReadRTPOSIXSolver(), ReadRTSolver(), DataManager::ReadScalarAlgebraicNode(), DataManager::ReadScalarDifferentialNode(), ReadScalarValue(), ReadShape(), ReadShell4EAS(), ReadShell4EASANS(), ReadShellConstLaw(), ReadSparseMappingMatrix(), ReadStreamContentModifier(), ReadStreamDriveEcho(), ReadStreamDriveModifier(), ReadStreamOutEcho(), ReadStructExtForce(), ReadStructMappingExtForce(), ReadStructNode(), ReadStructuralForce(), ReadUniform(), ReadUnsteadyFlag(), ShockAbsorberConstitutiveLaw< doublereal, doublereal >::ShockAbsorberConstitutiveLaw(), TimeStep::TimeStep(), Wheel2::Wheel2(), and Wheel4::Wheel4().

911 {
912  const char sFuncName[] = "HighParser::IsKeyWord()";
913 
914  if (CurrToken != HighParser::ARG) {
915  return false;
916  }
917 
918  switch (ParseWord()) {
919  case 0:
920  break;
921 
923  return true;
924 
925  default:
926  return false;
927  }
928 
929  if (!strcasecmp(sStringBuf, sKeyWord)) {
930  NextToken(sFuncName);
931  return true;
932  }
933 
934  PutbackWord();
935 
936  return false;
937 }
void PutbackWord(void)
Definition: parser.cc:899
Token CurrToken
Definition: parser.h:435
virtual void NextToken(const char *sFuncName)
Definition: parser.cc:822
char sStringBuf[iDefaultBufSize]
Definition: parser.h:423
int ParseWord(unsigned flags=HighParser::NONE)
Definition: parser.cc:843

Here is the call graph for this function:

int HighParser::IsKeyWord ( void  )
virtual

Definition at line 940 of file parser.cc.

References ARG, CurrToken, ENDOFFILE, KeyTable::Find(), KeyT, NextToken(), ParseWord(), PutbackWord(), and sStringBuf.

Referenced by MBDynParser::C81Data_int(), MBDynParser::ConstitutiveLaw_int(), MBDynParser::DriveCaller_int(), MBDynParser::GetConstLaw1D(), MBDynParser::GetConstLaw3D(), MBDynParser::GetConstLaw6D(), MBDynParser::GetDriveCaller(), MBDynParser::GetHydraulicFluid(), MBDynParser::GetMat3x3(), MBDynParser::GetMat3x3Sym(), MBDynParser::GetMat6x6(), MBDynParser::GetMat6xN(), MBDynParser::GetMatR2vec(), MBDynParser::GetRef(), MBDynParser::GetScalarFunction(), MBDynParser::GetTplDriveCaller(), MBDynParser::GetVec3(), MBDynParser::GetVec6(), MBDynParser::GetVecAbs(), MBDynParser::GetVecRel(), GetYesNo(), MBDynParser::HydraulicFluid_int(), MBDynParser::Reference_int(), and MBDynParser::TplDriveCaller_int().

941 {
942  const char sFuncName[] = "HighParser::IsKeyWord()";
943 
944  if (CurrToken != HighParser::ARG) {
945  return -1;
946  }
947 
948  switch (ParseWord()) {
949  case 0:
950  break;
951 
953  return HighParser::ENDOFFILE;
954 
955  default:
956  return -1;
957  }
958 
959  int iKW = -1;
960 
961  if (KeyT) {
962  iKW = KeyT->Find(sStringBuf);
963  }
964 
965  if (iKW >= 0) {
966  NextToken(sFuncName);
967  return iKW;
968  }
969 
970  PutbackWord();
971 
972  return -1;
973 }
void PutbackWord(void)
Definition: parser.cc:899
Token CurrToken
Definition: parser.h:435
int Find(const char *sToFind) const
Definition: parser.cc:271
const KeyTable * KeyT
Definition: parser.h:431
virtual void NextToken(const char *sFuncName)
Definition: parser.cc:822
char sStringBuf[iDefaultBufSize]
Definition: parser.h:423
int ParseWord(unsigned flags=HighParser::NONE)
Definition: parser.cc:843

Here is the call graph for this function:

bool HighParser::IsStringWithDelims ( enum Delims  Del = DEFAULTDELIM)
virtual

Definition at line 1210 of file parser.cc.

References pIn, InputStream::putback(), SetDelims(), and skip_remarks().

Referenced by ModuleFMU::ModuleFMU(), ReadModal(), and MBDynParser::TplDriveCaller_int().

1211 {
1212  char cLdelim, cRdelim;
1213  SetDelims(Del, cLdelim, cRdelim);
1214 
1215  char cIn;
1216  if (skip_remarks(*this, *pIn, cIn)) {
1217  return false;
1218  }
1219 
1220  /* put back the first non-remark char */
1221  pIn->putback(cIn);
1222 
1223  /* if the left delimiter is found, true */
1224  return (cIn == cLdelim);
1225 }
InputStream & putback(char ch)
Definition: input.h:121
static int skip_remarks(HighParser &HP, InputStream &In, char &cIn)
Definition: parser.cc:49
InputStream * pIn
Definition: parser.h:419
virtual void SetDelims(enum Delims Del, char &cLdelim, char &cRdelim) const
Definition: parser.cc:1173

Here is the call graph for this function:

const char * HighParser::IsWord ( const HighParser::WordSet ws)
virtual

Definition at line 977 of file parser.cc.

References ARG, CurrToken, HighParser::WordSet::IsWord(), NextToken(), ParseWord(), PutbackWord(), and sStringBuf.

Referenced by ParseScalarFunction(), ParseUserDefinedElem(), FlightGearFileDriveCallerTypeReader::Read(), FileDCR::Read(), ReadBufCast(), ReadCL1D(), ReadCL3D(), ReadCL6D(), ReadDC1D(), ReadDC3D(), ReadDC3x3D(), ReadDC6D(), ReadDC6x6D(), ReadDriveCallerData(), ReadDriveData(), FlightGearStreamOutputReader::ReadFlightGearScalarValues(), ReadGustData(), ReadStreamContent(), and ReadTimeStepData().

978 {
979  const char sFuncName[] = "HighParser::IsWord()";
980 
981  if (CurrToken != HighParser::ARG) {
982  return 0;
983  }
984 
985  switch (ParseWord()) {
986  case 0:
987  break;
988 
989  default:
990  return 0;
991  }
992 
993  if (ws.IsWord(std::string(sStringBuf))) {
994  NextToken(sFuncName);
995  return sStringBuf;
996  }
997 
998  PutbackWord();
999 
1000  return 0;
1001 }
void PutbackWord(void)
Definition: parser.cc:899
Token CurrToken
Definition: parser.h:435
virtual bool IsWord(const std::string &s) const =0
virtual void NextToken(const char *sFuncName)
Definition: parser.cc:822
char sStringBuf[iDefaultBufSize]
Definition: parser.h:423
int ParseWord(unsigned flags=HighParser::NONE)
Definition: parser.cc:843

Here is the call graph for this function:

void HighParser::NextToken ( const char *  sFuncName)
protectedvirtual

Definition at line 822 of file parser.cc.

References ARG, LowParser::COMMA, CurrLowToken, CurrToken, DESCRIPTION, GetLineData(), LowParser::GetToken(), LowP, MBDYN_EXCEPT_ARGS, pIn, and LowParser::SEMICOLON.

Referenced by GetString(), GetStringWithDelims(), GetValue(), GetWord(), IsKeyWord(), and IsWord().

823 {
825  switch (CurrLowToken) {
826  case LowParser::COMMA:
828  break;
829 
832  break;
833 
834  default:
835  silent_cerr("Parser error in "
836  << sFuncName << ", missing separator at line "
837  << GetLineData() << std::endl);
839  }
840 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual HighParser::ErrOut GetLineData(void) const
Definition: parser.cc:681
Token CurrToken
Definition: parser.h:435
LowParser LowP
Definition: parser.h:416
Token GetToken(InputStream &In)
Definition: parser.cc:189
LowParser::Token CurrLowToken
Definition: parser.h:434
InputStream * pIn
Definition: parser.h:419

Here is the call graph for this function:

int HighParser::ParseWord ( unsigned  flags = HighParser::NONE)
protected

Definition at line 843 of file parser.cc.

References CurrToken, ENDOFFILE, InputStream::get(), iDefaultBufSize, LOWER, pIn, InputStream::putback(), skip_remarks(), sStringBuf, sStringBufWithSpaces, and UPPER.

Referenced by IsKeyWord(), and IsWord().

844 {
845  char* sBuf = sStringBuf;
846  char* sBufWithSpaces = sStringBufWithSpaces;
847 
848  char cIn;
849  if (skip_remarks(*this, *pIn, cIn)) {
851  }
852 
853  if (!isalpha(cIn) && cIn != '_') {
854  pIn->putback(cIn);
855  return -1;
856  }
857 
858  *sBufWithSpaces++ = cIn;
859 
860  if (flags & LOWER) {
861  *sBuf++ = tolower(cIn);
862 
863  } else if (flags & UPPER) {
864  *sBuf++ = toupper(cIn);
865 
866  } else {
867  *sBuf++ = cIn;
868  }
869 
870  for (cIn = pIn->get(); isalnum(cIn) || cIn == '_' || isspace(cIn); cIn = pIn->get()) {
871  *sBufWithSpaces++ = cIn;
872  if (sBufWithSpaces >= sStringBufWithSpaces + iDefaultBufSize - 1) {
873  break;
874  }
875 
876  if (isspace(cIn)) {
877  continue;
878  }
879 
880  if (flags & LOWER) {
881  *sBuf++ = tolower(cIn);
882 
883  } else if (flags & UPPER) {
884  *sBuf++ = toupper(cIn);
885 
886  } else {
887  *sBuf++ = cIn;
888  }
889  }
890  pIn->putback(cIn);
891 
892  *sBuf = '\0';
893  *sBufWithSpaces = '\0';
894 
895  return 0;
896 }
Token CurrToken
Definition: parser.h:435
char get(void)
Definition: input.h:99
char sStringBufWithSpaces[iDefaultBufSize]
Definition: parser.h:424
InputStream & putback(char ch)
Definition: input.h:121
const unsigned int iDefaultBufSize
Definition: parser.h:133
static int skip_remarks(HighParser &HP, InputStream &In, char &cIn)
Definition: parser.cc:49
InputStream * pIn
Definition: parser.h:419
char sStringBuf[iDefaultBufSize]
Definition: parser.h:423

Here is the call graph for this function:

void HighParser::PutBackSemicolon ( void  )
virtual

Definition at line 813 of file parser.cc.

References CurrLowToken, pIn, InputStream::putback(), and LowParser::SEMICOLON.

814 {
816  pIn->putback(';');
817  }
818 }
InputStream & putback(char ch)
Definition: input.h:121
LowParser::Token CurrLowToken
Definition: parser.h:434
InputStream * pIn
Definition: parser.h:419

Here is the call graph for this function:

void HighParser::PutbackWord ( void  )
protected

Definition at line 899 of file parser.cc.

References pIn, InputStream::putback(), and sStringBufWithSpaces.

Referenced by IsKeyWord(), and IsWord().

900 {
901  char* sBufWithSpaces = sStringBufWithSpaces + strlen(sStringBufWithSpaces);
902 
903 
904  while (sBufWithSpaces > sStringBufWithSpaces) {
905  pIn->putback(*--sBufWithSpaces);
906  }
907 }
char sStringBufWithSpaces[iDefaultBufSize]
Definition: parser.h:424
InputStream & putback(char ch)
Definition: input.h:121
InputStream * pIn
Definition: parser.h:419

Here is the call graph for this function:

const KeyTable * HighParser::PutKeyTable ( const KeyTable KT)
virtual

Definition at line 658 of file parser.cc.

References KeyT.

Referenced by KeyTable::KeyTable(), and KeyTable::~KeyTable().

659 {
660  const KeyTable* oldKey = KeyT;
661 
662  KeyT = &KT;
663 
664  return oldKey;
665 }
const KeyTable * KeyT
Definition: parser.h:431
void HighParser::SetDelims ( enum Delims  Del,
char &  cLdelim,
char &  cRdelim 
) const
protectedvirtual

Definition at line 1173 of file parser.cc.

References CURLYBRACKETS, DEFAULTDELIM, DOUBLEQUOTE, PLAINBRACKETS, SINGLEQUOTE, SQUAREBRACKETS, and UNKNOWNDELIM.

Referenced by GetStringWithDelims(), and IsStringWithDelims().

1174 {
1175  cLdelim = '\0';
1176  cRdelim = '\0';
1177 
1178  switch (Del) {
1179  case PLAINBRACKETS:
1180  cLdelim = '(';
1181  cRdelim = ')';
1182  break;
1183 
1184  case SQUAREBRACKETS:
1185  cLdelim = '[';
1186  cRdelim = ']';
1187  break;
1188 
1189  case CURLYBRACKETS:
1190  cLdelim = '{';
1191  cRdelim = '}';
1192  break;
1193 
1194  case SINGLEQUOTE:
1195  cLdelim = '`';
1196  cRdelim = '\'';
1197  break;
1198 
1199  default:
1200  case UNKNOWNDELIM:
1201  case DEFAULTDELIM:
1202  case DOUBLEQUOTE:
1203  cLdelim = '"';
1204  cRdelim = '"';
1205  break;
1206  }
1207 }

Member Data Documentation

LowParser::Token HighParser::CurrLowToken
protected

Definition at line 434 of file parser.h.

Referenced by FirstToken(), GetDescription(), GetWord(), NextToken(), and PutBackSemicolon().

const char HighParser::ESCAPE_CHAR

Definition at line 300 of file parser.h.

Referenced by GetStringWithDelims().

const KeyTable* HighParser::KeyT
protected

Definition at line 431 of file parser.h.

Referenced by GetWord(), iGetDescription_int(), IsKeyWord(), and PutKeyTable().

LowParser HighParser::LowP
protected

Definition at line 416 of file parser.h.

Referenced by FirstToken(), GetDescription(), GetWord(), and NextToken().

MathParser& HighParser::MathP
protected

Definition at line 428 of file parser.h.

Referenced by GetMathParser(), and GetValue().

std::ifstream* HighParser::pf
protected
char HighParser::sStringBuf[iDefaultBufSize]
protected
char HighParser::sStringBufWithSpaces[iDefaultBufSize]
protected

Definition at line 424 of file parser.h.

Referenced by ParseWord(), and PutbackWord().


The documentation for this class was generated from the following files: