SNAP Library 4.0, User Reference  2017-07-27 13:18:06
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TILx Class Reference

#include <lx.h>

Public Member Functions

 TILx (const PSIn &_SIn, const TFSet &OptSet=TFSet(), const TLxChDefTy &ChDefTy=lcdtUsAscii)
 
TILxoperator= (const TILx &)
 
void SetOpt (const int &Opt, const bool &Val)
 
TLxSym AddRw (const TStr &Str)
 
TLxSym GetRw (const TStr &Str)
 
PSIn GetSIn (const char &SepCh)
 
int GetLnN () const
 
bool IsBof () const
 
bool IsEof () const
 
TLxSym GetSym (const TFSet &Expect)
 
TLxSym GetSym ()
 
TLxSym GetSym (const TLxSym &Sym)
 
TLxSym GetSym (const TLxSym &Sym1, const TLxSym &Sym2)
 
TLxSym GetSym (const TLxSym &Sym1, const TLxSym &Sym2, const TLxSym &Sym3)
 
TLxSym GetSym (const TLxSym &Sym1, const TLxSym &Sym2, const TLxSym &Sym3, const TLxSym &Sym4)
 
bool GetBool ()
 
int GetInt ()
 
double GetFlt ()
 
TStr GetStr (const TStr &_Str=TStr())
 
TStr GetIdStr (const TStr &IdStr=TStr())
 
TStr GetQStr (const TStr &QStr=TStr())
 
void GetEoln ()
 
TStr GetStrToCh (const char &ToCh)
 
TStr GetStrToEolnOrCh (const char &ToCh)
 
TStr GetStrToEoln (const bool &DoTrunc=false)
 
TStr GetStrToEolnAndCh (const char &ToCh)
 
void SkipToEoln ()
 
void SkipToSym (const TLxSym &SkipToSym)
 
void PutSym (const TILxSymSt &SymSt)
 
void PutSym ()
 
TLxSym PeekSym ()
 
TLxSym PeekSym (const int &Syms)
 
TStr GetSymStr () const
 
TStr GetFPosStr () const
 
bool IsVar (const TStr &VarNm)
 
void GetVar (const TStr &VarNm, const bool &LBracket=false, const bool &NewLn=false)
 
void GetVarEnd (const bool &RBracket=false, const bool &NewLn=false)
 
bool PeekVarEnd (const bool &RBracket=false, const bool &NewLn=false)
 
bool GetVarBool (const TStr &VarNm, const bool &NewLn=true)
 
int GetVarInt (const TStr &VarNm, const bool &NewLn=true)
 
double GetVarFlt (const TStr &VarNm, const bool &NewLn=true)
 
TStr GetVarStr (const TStr &VarNm, const bool &NewLn=true)
 
TSecTm GetVarSecTm (const TStr &VarNm, const bool &NewLn=true)
 
void GetVarBoolV (const TStr &VarNm, TBoolV &BoolV, const bool &NewLn=true)
 
void GetVarIntV (const TStr &VarNm, TIntV &IntV, const bool &NewLn=true)
 
void GetVarFltV (const TStr &VarNm, TFltV &FltV, const bool &NewLn=true)
 
void GetVarStrV (const TStr &VarNm, TStrV &StrV, const bool &NewLn=true)
 
void GetVarStrPrV (const TStr &VarNm, TStrPrV &StrPrV, const bool &NewLn=true)
 
void GetVarStrVV (const TStr &VarNm, TVec< TStrV > &StrVV, const bool &NewLn=true)
 

Static Public Member Functions

static TStr GetQStr (const TStr &Str, const bool &QuoteP, const char &QuoteCh)
 
static void GetLnV (const TStr &FNm, TStrV &LnV)
 

Public Attributes

TLxSym Sym
 
TChA Str
 
TChA UcStr
 
TChA CmtStr
 
bool Bool
 
int Int
 
double Flt
 
int SymLnN
 
int SymLnChN
 
int SymChN
 
bool QuoteP
 
char QuoteCh
 

Private Member Functions

char GetCh ()
 
char GetChX ()
 

Private Attributes

PLxChDef ChDef
 
PSIn SIn
 
TSInRSIn
 
char PrevCh
 
char Ch
 
int LnN
 
int LnChN
 
int ChN
 
TSStack< TILxSymStPrevSymStStack
 
TStrIntH RwStrH
 
bool IsCmtAlw
 
bool IsRetEoln
 
bool IsSigNum
 
bool IsUniStr
 
bool IsCsSens
 
bool IsExcept
 
bool IsTabSep
 
bool IsList
 

Detailed Description

Definition at line 129 of file lx.h.

Constructor & Destructor Documentation

TILx::TILx ( const PSIn _SIn,
const TFSet OptSet = TFSet(),
const TLxChDefTy ChDefTy = lcdtUsAscii 
)

Definition at line 270 of file lx.cpp.

270  :
271  ChDef(TLxChDef::GetChDef(ChDefTy)),
272  SIn(_SIn), RSIn(*SIn),
273  PrevCh(' '), Ch(' '), LnN(0), LnChN(0-1), ChN(0-1),
274  PrevSymStStack(), RwStrH(50),
275  IsCmtAlw(false), IsRetEoln(false), IsSigNum(false),
276  IsUniStr(false), IsCsSens(false), IsExcept(false),
277  IsTabSep(false), IsList(false),
278  Sym(syUndef),
279  Str(), UcStr(), CmtStr(),
280  Bool(false), Int(0), Flt(0),
281  SymLnN(-1), SymLnChN(-1), SymChN(-1){
282  for (int Opt=0; Opt<iloMx; Opt++){
283  if (OptSet.In(Opt)){SetOpt(Opt, true);}}
284 }
char Ch
Definition: lx.h:134
bool IsCsSens
Definition: lx.h:138
int SymLnN
Definition: lx.h:152
TStrIntH RwStrH
Definition: lx.h:137
bool IsTabSep
Definition: lx.h:139
bool IsList
Definition: lx.h:139
int ChN
Definition: lx.h:135
bool IsRetEoln
Definition: lx.h:138
void SetOpt(const int &Opt, const bool &Val)
Definition: lx.cpp:286
TLxSym Sym
Definition: lx.h:149
TSIn & RSIn
Definition: lx.h:133
TChA UcStr
Definition: lx.h:150
int LnN
Definition: lx.h:135
bool IsSigNum
Definition: lx.h:138
Definition: lx.h:45
PSIn SIn
Definition: lx.h:132
char PrevCh
Definition: lx.h:134
bool IsUniStr
Definition: lx.h:138
bool IsExcept
Definition: lx.h:139
bool IsCmtAlw
Definition: lx.h:138
TChA Str
Definition: lx.h:150
TSStack< TILxSymSt > PrevSymStStack
Definition: lx.h:136
bool Bool
Definition: lx.h:151
int SymLnChN
Definition: lx.h:152
int LnChN
Definition: lx.h:135
PLxChDef ChDef
Definition: lx.h:131
int Int
Definition: lx.h:151
int SymChN
Definition: lx.h:152
static PLxChDef GetChDef(const TLxChDefTy &ChDefTy=lcdtUsAscii)
Definition: lx.cpp:79
TChA CmtStr
Definition: lx.h:150
double Flt
Definition: lx.h:151
Definition: lx.h:127
bool In(const int &FlagN) const
Definition: bits.h:156

Member Function Documentation

TLxSym TILx::AddRw ( const TStr Str)

Definition at line 300 of file lx.cpp.

300  {
302  TStr UcStr=ChDef->GetUcStr(Str);
303  IAssert(!RwStrH.IsKey(UcStr));
304  TLxSym RwSym=TLxSym(syMnRw+RwStrH.Len());
305  RwStrH.AddDat(Str, TInt(int(RwSym)));
306  return RwSym;
307 }
#define IAssert(Cond)
Definition: bd.h:262
Definition: lx.h:53
TStrIntH RwStrH
Definition: lx.h:137
TLxSym
Definition: lx.h:44
Definition: lx.h:52
TChA UcStr
Definition: lx.h:150
Definition: dt.h:1134
Definition: dt.h:412
PLxChDef ChDef
Definition: lx.h:131
TStr GetUcStr(const TStr &Str) const
Definition: lx.cpp:71
bool IsKey(const TKey &Key) const
Definition: hash.h:258
int Len() const
Definition: hash.h:228
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
bool TILx::GetBool ( )
inline

Definition at line 180 of file lx.h.

180 {GetSym(TFSet()|syBool); return Bool;}
Definition: lx.h:45
Definition: bits.h:119
TLxSym GetSym()
Definition: lx.h:171
bool Bool
Definition: lx.h:151
char TILx::GetCh ( )
inlineprivate

Definition at line 140 of file lx.h.

140  {
141  Assert(Ch!=TCh::EofCh);
142  PrevCh=Ch; LnChN++; ChN++;
143  Ch=((RSIn.Eof()) ? TCh::EofCh : RSIn.GetCh());
144  if (IsList){putchar(Ch);}
145  return Ch;
146  }
char Ch
Definition: lx.h:134
bool IsList
Definition: lx.h:139
int ChN
Definition: lx.h:135
static const char EofCh
Definition: dt.h:1037
TSIn & RSIn
Definition: lx.h:133
virtual bool Eof()=0
char PrevCh
Definition: lx.h:134
#define Assert(Cond)
Definition: bd.h:251
int LnChN
Definition: lx.h:135
virtual char GetCh()=0
char TILx::GetChX ( )
inlineprivate

Definition at line 147 of file lx.h.

147 {char Ch=GetChX(); printf("%c", Ch); return Ch;}
char Ch
Definition: lx.h:134
char GetChX()
Definition: lx.h:147
void TILx::GetEoln ( )
inline

Definition at line 189 of file lx.h.

189 {GetSym(TFSet()|syEoln);}
Definition: bits.h:119
Definition: lx.h:51
TLxSym GetSym()
Definition: lx.h:171
double TILx::GetFlt ( )
inline

Definition at line 182 of file lx.h.

182 {GetSym(TFSet()|syFlt); return Flt;}
Definition: bits.h:119
TLxSym GetSym()
Definition: lx.h:171
Definition: lx.h:45
double Flt
Definition: lx.h:151
TStr TILx::GetFPosStr ( ) const

Definition at line 607 of file lx.cpp.

607  {
608  TChA ChA;
609  ChA+="File:"; ChA+=SIn->GetSNm();
610  ChA+=" Line:"; ChA+=TInt::GetStr(LnN+1);
611  ChA+=" Char:"; ChA+=TInt::GetStr(LnChN);
612  return ChA;
613 }
TStr GetStr() const
Definition: dt.h:1197
int LnN
Definition: lx.h:135
PSIn SIn
Definition: lx.h:132
Definition: dt.h:201
int LnChN
Definition: lx.h:135
virtual TStr GetSNm() const
Definition: fl.cpp:20
TStr TILx::GetIdStr ( const TStr IdStr = TStr())
inline

Definition at line 185 of file lx.h.

185  {
186  GetSym(TFSet()|syIdStr); IAssert(IdStr.Empty()||(IdStr==Str)); return Str;}
#define IAssert(Cond)
Definition: bd.h:262
Definition: bits.h:119
Definition: lx.h:45
TLxSym GetSym()
Definition: lx.h:171
TChA Str
Definition: lx.h:150
bool Empty() const
Definition: dt.h:488
int TILx::GetInt ( )
inline

Definition at line 181 of file lx.h.

181 {GetSym(TFSet()|syInt); return Int;}
Definition: lx.h:45
Definition: bits.h:119
TLxSym GetSym()
Definition: lx.h:171
int Int
Definition: lx.h:151
int TILx::GetLnN ( ) const
inline

Definition at line 166 of file lx.h.

166 {return LnN;}
int LnN
Definition: lx.h:135
void TILx::GetLnV ( const TStr FNm,
TStrV LnV 
)
static

Definition at line 687 of file lx.cpp.

687  {
688  TFIn SIn(FNm); LnV.Clr(); TChA Ln;
689  if (!SIn.Eof()){
690  char Ch=SIn.GetCh();
691  while (!SIn.Eof()){
692  if ((Ch==TCh::CrCh)||(Ch==TCh::LfCh)){
693  if (!SIn.Eof()){
694  char PrevCh=Ch; Ch=SIn.GetCh();
695  if (!SIn.Eof()){
696  if (PrevCh==TCh::CrCh){if (Ch==TCh::LfCh){Ch=SIn.GetCh();}} else
697  if (PrevCh==TCh::LfCh){if (Ch==TCh::CrCh){Ch=SIn.GetCh();}}
698  }
699  }
700  LnV.Add(Ln); Ln.Clr();
701  } else {
702  Ln+=Ch; Ch=SIn.GetCh();
703  }
704  }
705  if (!Ln.Empty()){
706  LnV.Add(Ln);}
707  }
708 }
char Ch
Definition: lx.h:134
bool Empty() const
Definition: dt.h:260
void Clr()
Definition: dt.h:258
Definition: fl.h:275
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
PSIn SIn
Definition: lx.h:132
char PrevCh
Definition: lx.h:134
static const char LfCh
Definition: dt.h:1035
Definition: dt.h:201
static const char CrCh
Definition: dt.h:1036
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TStr TILx::GetQStr ( const TStr QStr = TStr())
inline

Definition at line 187 of file lx.h.

187  {
188  GetSym(TFSet()|syQStr); IAssert(QStr.Empty()||(Str==QStr)); return Str;}
#define IAssert(Cond)
Definition: bd.h:262
Definition: bits.h:119
Definition: lx.h:45
TLxSym GetSym()
Definition: lx.h:171
TChA Str
Definition: lx.h:150
bool Empty() const
Definition: dt.h:488
TStr TILx::GetQStr ( const TStr Str,
const bool &  QuoteP,
const char &  QuoteCh 
)
static

Definition at line 615 of file lx.cpp.

615  {
616  if (QuoteP){
617  TChA ChA;
618  ChA+=QuoteCh;
619  int StrLen=Str.Len();
620  for (int ChN=0; ChN<StrLen; ChN++){
621  char Ch=Str.CStr()[ChN];
622  if (Ch==QuoteCh){ChA+=QuoteCh; ChA+=QuoteCh;}
623  else {ChA+=Ch;}
624  }
625  ChA+=QuoteCh;
626  return ChA;
627  } else {
628  return Str;
629  }
630 }
char Ch
Definition: lx.h:134
int Len() const
Definition: dt.h:487
int ChN
Definition: lx.h:135
bool QuoteP
Definition: lx.h:153
char QuoteCh
Definition: lx.h:154
TChA Str
Definition: lx.h:150
Definition: dt.h:201
char * CStr()
Definition: dt.h:476
TLxSym TILx::GetRw ( const TStr Str)
inline

Definition at line 163 of file lx.h.

163  {
164  return TLxSym(int(RwStrH.GetDat(Str)));}
TStrIntH RwStrH
Definition: lx.h:137
TLxSym
Definition: lx.h:44
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
PSIn TILx::GetSIn ( const char &  SepCh)

Definition at line 309 of file lx.cpp.

309  {
311  while ((Ch!=TCh::EofCh)&&(Ch!=SepCh)){GetCh();}
312  return SIn;
313 }
#define IAssert(Cond)
Definition: bd.h:262
char Ch
Definition: lx.h:134
bool Empty()
Definition: ds.h:2590
static const char EofCh
Definition: dt.h:1037
PSIn SIn
Definition: lx.h:132
TSStack< TILxSymSt > PrevSymStStack
Definition: lx.h:136
char GetCh()
Definition: lx.h:140
TStr TILx::GetStr ( const TStr _Str = TStr())
inline

Definition at line 183 of file lx.h.

183  {
184  GetSym(TFSet()|syStr); IAssert(_Str.Empty()||(_Str==Str)); return Str;}
#define IAssert(Cond)
Definition: bd.h:262
Definition: bits.h:119
TLxSym GetSym()
Definition: lx.h:171
TChA Str
Definition: lx.h:150
bool Empty() const
Definition: dt.h:488
Definition: lx.h:45
TStr TILx::GetStrToCh ( const char &  ToCh)

Definition at line 539 of file lx.cpp.

539  {
540  Sym=syStr; Str.Clr(); UcStr.Clr();
541  while ((Ch!=ToCh)&&(Ch!=TCh::EofCh)){
542  Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();}
543  return Str;
544 }
char Ch
Definition: lx.h:134
void Clr()
Definition: dt.h:258
void AddCh(const char &Ch, const int &MxLen=-1)
Definition: dt.h:271
char GetUc(const char &Ch) const
Definition: lx.h:32
TLxSym Sym
Definition: lx.h:149
static const char EofCh
Definition: dt.h:1037
TChA UcStr
Definition: lx.h:150
TChA Str
Definition: lx.h:150
char GetCh()
Definition: lx.h:140
PLxChDef ChDef
Definition: lx.h:131
Definition: lx.h:45
TStr TILx::GetStrToEoln ( const bool &  DoTrunc = false)

Definition at line 553 of file lx.cpp.

553  {
554  Sym=syStr; Str.Clr(); UcStr.Clr();
555  while ((Ch!=TCh::CrCh)&&(Ch!=TCh::LfCh)&&(Ch!=TCh::EofCh)){
556  Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();}
557  if (DoTrunc){Str.ToTrunc(); UcStr.ToTrunc();}
558  return Str;
559 }
char Ch
Definition: lx.h:134
void Clr()
Definition: dt.h:258
void AddCh(const char &Ch, const int &MxLen=-1)
Definition: dt.h:271
char GetUc(const char &Ch) const
Definition: lx.h:32
TLxSym Sym
Definition: lx.h:149
static const char EofCh
Definition: dt.h:1037
TChA UcStr
Definition: lx.h:150
TChA Str
Definition: lx.h:150
static const char LfCh
Definition: dt.h:1035
char GetCh()
Definition: lx.h:140
static const char CrCh
Definition: dt.h:1036
PLxChDef ChDef
Definition: lx.h:131
TChA & ToTrunc()
Definition: dt.cpp:568
Definition: lx.h:45
TStr TILx::GetStrToEolnAndCh ( const char &  ToCh)

Definition at line 561 of file lx.cpp.

561  {
562  Sym=syStr; Str.Clr(); UcStr.Clr();
563  if (IsBof()){GetCh();}
564  forever {
565  if (Ch==TCh::EofCh){break;}
566  if (((ChN==0)||(PrevCh==TCh::CrCh)||(PrevCh==TCh::LfCh))&&(Ch==ToCh)){
567  GetCh(); break;}
568  else {Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();}
569  }
570  return Str;
571 }
char Ch
Definition: lx.h:134
#define forever
Definition: bd.h:6
void Clr()
Definition: dt.h:258
void AddCh(const char &Ch, const int &MxLen=-1)
Definition: dt.h:271
int ChN
Definition: lx.h:135
char GetUc(const char &Ch) const
Definition: lx.h:32
TLxSym Sym
Definition: lx.h:149
static const char EofCh
Definition: dt.h:1037
TChA UcStr
Definition: lx.h:150
char PrevCh
Definition: lx.h:134
TChA Str
Definition: lx.h:150
static const char LfCh
Definition: dt.h:1035
bool IsBof() const
Definition: lx.h:167
char GetCh()
Definition: lx.h:140
static const char CrCh
Definition: dt.h:1036
PLxChDef ChDef
Definition: lx.h:131
Definition: lx.h:45
TStr TILx::GetStrToEolnOrCh ( const char &  ToCh)

Definition at line 546 of file lx.cpp.

546  {
547  Sym=syStr; Str.Clr(); UcStr.Clr();
548  while ((Ch!=ToCh)&&(Ch!=TCh::CrCh)&&(Ch!=TCh::LfCh)&&(Ch!=TCh::EofCh)){
549  Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();}
550  return Str;
551 }
char Ch
Definition: lx.h:134
void Clr()
Definition: dt.h:258
void AddCh(const char &Ch, const int &MxLen=-1)
Definition: dt.h:271
char GetUc(const char &Ch) const
Definition: lx.h:32
TLxSym Sym
Definition: lx.h:149
static const char EofCh
Definition: dt.h:1037
TChA UcStr
Definition: lx.h:150
TChA Str
Definition: lx.h:150
static const char LfCh
Definition: dt.h:1035
char GetCh()
Definition: lx.h:140
static const char CrCh
Definition: dt.h:1036
PLxChDef ChDef
Definition: lx.h:131
Definition: lx.h:45
TLxSym TILx::GetSym ( const TFSet Expect)

Definition at line 315 of file lx.cpp.

315  {
316  CmtStr.Clr();
317  if (!PrevSymStStack.Empty()){
318  // symbols already on the stack
320  } else
321  if (Expect.In(syLn)){
322  // symbol is the whole line string
323  if (Ch==TCh::EofCh){
324  Sym=syEof;
325  } else {
326  Str.Clr();
327  if (IsBof()){GetCh();}
328  while (!ChDef->IsTerm(Ch)){Str.AddCh(Ch); GetCh();}
329  bool _IsRetEoln=IsRetEoln; IsRetEoln=true;
331  IsRetEoln=_IsRetEoln;
332  }
333  } else
334  if (IsTabSep){
335  // symbol is between tab characters
336  if (IsBof()){GetCh();}
337  if (Ch==TCh::TabCh){ // tab character
338  Sym=syTab; GetCh();
339  } else
340  if (ChDef->IsTerm(Ch)){ // eoln & eof characters
341  bool _IsRetEoln=IsRetEoln; IsRetEoln=true; IsTabSep=false;
343  IsRetEoln=_IsRetEoln; IsTabSep=true;
344  } else {
345  Str.Clr();
346  while ((!ChDef->IsTerm(Ch))&&(Ch!=TCh::TabCh)){
347  Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();}
348  Sym=syStr; QuoteP=false;
349  }
350  } else {
351  // usual symbol
352  while (ChDef->IsSpace(Ch)){GetCh();}
354 
355  if (ChDef->IsAlpha(Ch)){
356  if (IsUniStr){Sym=syStr;} else {Sym=syIdStr;}
357  Str.Clr(); UcStr.Clr(); QuoteP=false;
358  do {Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch));}
359  while (ChDef->IsAlNum(GetCh()));
360  if (!RwStrH.Empty()){
361  TStr RwStr=Str; if (!IsCsSens){RwStr=UcStr;}
362  int SymKeyId=RwStrH.GetKeyId(RwStr);
363  if (SymKeyId!=-1){Sym=TLxSym(int(RwStrH[SymKeyId]));}
364  }
365  if (Expect.In(syBool)){
368  }
369  } else
370  if ((Ch=='"')||(Ch=='\'')){
371  if (IsUniStr){Sym=syStr;} else {Sym=syQStr;}
372  Str.Clr(); UcStr.Clr(); QuoteP=true; QuoteCh=Ch;
373  GetCh();
374  forever{
375  while ((Ch!=QuoteCh)&&(Ch!='\\')&&(Ch!=TCh::EofCh)){
376  Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();}
377  if (Ch==TCh::EofCh){
378  Sym=syUndef; break;
379  } else if (Ch==QuoteCh){
380  GetCh(); break;
381  } else {
382  GetCh();
383  switch (Ch){
384  case '"': Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break;
385  case '\\': Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break;
386  case '\'': Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break;
387  case '/': Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break;
388  case 'b': Str.AddCh('\b'); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break;
389  case 'f': Str.AddCh('\f'); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break;
390  case 'n': Str.AddCh('\n'); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break;
391  case 'r': Str.AddCh('\r'); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break;
392  case 't': Str.AddCh('\t'); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break;
393  case 'u': {
394  // unicode character, represented using 4 hexadecimal digits
395  GetCh(); EAssertR(TCh::IsHex(Ch), "Invalid hexadecimal digit in unicode escape");
396  int UChCd = TCh::GetHex(Ch);
397  GetCh(); EAssertR(TCh::IsHex(Ch), "Invalid hexadecimal digit in unicode escape");
398  UChCd = 16 * UChCd + TCh::GetHex(Ch);
399  GetCh(); EAssertR(TCh::IsHex(Ch), "Invalid hexadecimal digit in unicode escape");
400  UChCd = 16 * UChCd + TCh::GetHex(Ch);
401  GetCh(); EAssertR(TCh::IsHex(Ch), "Invalid hexadecimal digit in unicode escape");
402  UChCd = 16 * UChCd + TCh::GetHex(Ch);
403  // get as UTF8 encoded characters
404  TUnicode::EncodeUtf8(UChCd, Str);
405  TUnicode::EncodeUtf8(UChCd, UcStr); }
406  GetCh(); break;
407  default: Sym=syUndef; break;
408  }
409  if (Sym==syUndef){
410  throw PExcept(new TExcept("Invalid Escape Sequence in Quoted String"));}
411  }
412  }
413  } else
414  if ((ChDef->IsNum(Ch))||(IsSigNum&&((Ch=='+')||(Ch=='-')))){
415  Str.Clr(); bool IntP=true;
416  do {Str.AddCh(Ch);} while (ChDef->IsNum(GetCh()));
417  if (Expect.In(syFlt)){
418  if (Ch=='.'){
419  Str.AddCh(Ch); IntP=false;
420  while (ChDef->IsNum(GetCh())){Str.AddCh(Ch);}
421  }
422  if ((Ch=='e')||(Ch=='E')){
423  Str.AddCh(Ch); GetCh(); IntP=false;
424  if ((Ch=='+')||(Ch=='-')){Str.AddCh(Ch); GetCh();}
425  while (ChDef->IsNum(Ch)){Str.AddCh(Ch); GetCh();}
426  }
427  }
428  UcStr=Str;
429  if (IntP&&(Expect.In(syInt))){
430  Sym=syInt; Int=atoi(Str.CStr());
431  } else {
432  Sym=syFlt; Flt=atof(Str.CStr());
433  }
434  } else
435  if ((Ch==TCh::CrCh)||(Ch==TCh::LfCh)){
436  Sym=syEoln;
437  if (Ch==TCh::CrCh){if (GetCh()==TCh::LfCh){GetCh();}} else
438  if (Ch==TCh::LfCh){if (GetCh()==TCh::CrCh){GetCh();}}
439  LnN++; LnChN=0; if (!IsRetEoln){GetSym(Expect);}
440  } else
441  if (Ch=='/'){
442  GetCh();
443  if ((IsCmtAlw)&&(Ch=='/')){
444  TChA _CmtStr;
445  do {_CmtStr+=GetCh();} while (!ChDef->IsTerm(Ch));
446  _CmtStr.Pop(); _CmtStr.Trunc();
447  if (Ch==TCh::CrCh){
448  if (GetCh()==TCh::LfCh){GetCh();}
449  } else
450  if (Ch==TCh::LfCh){
451  if (GetCh()==TCh::CrCh){GetCh();}
452  }
453  if (IsRetEoln){Sym=syEoln;} else {GetSym(Expect);}
454  CmtStr=_CmtStr;
455  } else
456  if (Ch=='*'){
457  TChA _CmtStr;
458  do {
459  while (GetCh()!='*'){_CmtStr+=Ch;}
460  _CmtStr+=GetCh();
461  } while (Ch!='/');
462  _CmtStr.Pop(); _CmtStr.Pop(); _CmtStr.Trunc();
463  GetCh(); GetSym(Expect);
464  CmtStr=_CmtStr;
465  } else {
466  Sym=sySlash;
467  }
468  } else
469  if (Ch==TCh::EofCh){
470  Sym=syEof;
471  } else {
472  switch (Ch){
473  case '.':
474  if (GetCh()=='.'){Sym=syDPeriod; GetCh();}
475  else {Sym=syPeriod;} break;
476  case ',': Sym=syComma; GetCh(); break;
477  case ':':
478  if (GetCh()==':'){Sym=syDColon; GetCh();}
479  else {Sym=syColon;} break;
480  case ';': Sym=sySemicolon; GetCh(); break;
481  case '+': Sym=syPlus; GetCh(); break;
482  case '-': Sym=syMinus; GetCh(); break;
483  case '*': Sym=syAsterisk; GetCh(); break;
484  case '/': Sym=sySlash; GetCh(); break;
485  case '%': Sym=syPercent; GetCh(); break;
486  case '!': Sym=syExclamation; GetCh(); break;
487  case '|': Sym=syVBar; GetCh(); break;
488  case '&': Sym=syAmpersand; GetCh(); break;
489  case '=': Sym=syEq; GetCh(); break;
490  case '<':
491  GetCh();
492  if (Ch=='='){Sym=syLEq; GetCh();}
493  else if (Ch=='>'){Sym=syNEq; GetCh();}
494  else {Sym=syLss;} break;
495  case '>':
496  if (GetCh()=='='){Sym=syGEq; GetCh();}
497  else {Sym=syGtr;} break;
498  case '?': Sym=syQuestion; GetCh(); break;
499  case '#':
500  if (IsCmtAlw){
501  TChA _CmtStr;
502  do {_CmtStr+=GetCh();} while (!ChDef->IsTerm(Ch));
503  _CmtStr.Pop(); _CmtStr.Trunc();
504  if (Ch==TCh::CrCh){
505  if (GetCh()==TCh::LfCh){GetCh();}
506  } else
507  if (Ch==TCh::LfCh){
508  if (GetCh()==TCh::CrCh){GetCh();}
509  }
510  if (IsRetEoln){Sym=syEoln;} else {GetSym(Expect);}
511  CmtStr=_CmtStr;
512  } else {
513  Sym=syHash; GetCh();
514  }
515  break;
516  case '(': Sym=syLParen; GetCh(); break;
517  case ')': Sym=syRParen; GetCh(); break;
518  case '[': Sym=syLBracket; GetCh(); break;
519  case ']': Sym=syRBracket; GetCh(); break;
520  case '{': Sym=syLBrace; GetCh(); break;
521  case '}': Sym=syRBrace; GetCh(); break;
522  default: Sym=syUndef; GetCh(); break;
523  }
524  }
525  }
526 
527  if ((!Expect.In(Sym))&&(!Expect.Empty())){
528  if (IsExcept){
529  TStr MsgStr=
530  TStr("Unexpected symbol (")+GetSymStr()+") ["+GetFPosStr()+"]";
531  throw PExcept(new TExcept(MsgStr));
532  } else {
533  Fail;
534  }
535  }
536  return Sym;
537 }
#define IAssert(Cond)
Definition: bd.h:262
static bool IsHex(const char &Ch)
Definition: dt.h:1067
char Ch
Definition: lx.h:134
Definition: lx.h:49
Definition: lx.h:49
Definition: lx.h:50
bool Empty()
Definition: ds.h:2590
bool IsCsSens
Definition: lx.h:138
int SymLnN
Definition: lx.h:152
bool IsAlNum(const char &Ch) const
Definition: lx.h:30
Definition: lx.h:45
TPt< TExcept > PExcept
Definition: bd.h:198
Definition: lx.h:50
Definition: lx.h:49
Definition: lx.h:45
TStr GetSymStr() const
Definition: lx.cpp:594
bool Empty() const
Definition: bits.h:145
#define forever
Definition: bd.h:6
TStrIntH RwStrH
Definition: lx.h:137
Definition: lx.h:48
Definition: lx.h:46
TVal & Top()
Definition: ds.h:2594
bool IsTabSep
Definition: lx.h:139
#define Fail
Definition: bd.h:238
bool IsSpace(const char &Ch) const
Definition: lx.h:27
TLxSym
Definition: lx.h:44
void Clr()
Definition: dt.h:258
Definition: lx.h:45
void AddCh(const char &Ch, const int &MxLen=-1)
Definition: dt.h:271
bool IsAlpha(const char &Ch) const
Definition: lx.h:28
Definition: lx.h:48
Definition: bits.h:119
Definition: lx.h:47
bool Empty() const
Definition: hash.h:227
Definition: lx.h:51
static int GetHex(const char &Ch)
Definition: dt.h:1069
Definition: lx.h:45
int ChN
Definition: lx.h:135
Definition: lx.h:45
bool IsRetEoln
Definition: lx.h:138
void Restore(TILx &Lx)
Definition: lx.cpp:262
Definition: lx.h:47
bool QuoteP
Definition: lx.h:153
Definition: lx.h:49
char GetUc(const char &Ch) const
Definition: lx.h:32
TLxSym Sym
Definition: lx.h:149
static bool GetValFromStr(const TStr &Str)
Definition: dt.cpp:1850
char QuoteCh
Definition: lx.h:154
static const char EofCh
Definition: dt.h:1037
Definition: lx.h:50
TChA UcStr
Definition: lx.h:150
int LnN
Definition: lx.h:135
bool IsSigNum
Definition: lx.h:138
Definition: lx.h:45
TLxSym GetSym()
Definition: lx.h:171
char * CStr()
Definition: dt.h:255
static const char TabCh
Definition: dt.h:1034
Definition: lx.h:47
Definition: lx.h:49
Definition: lx.h:51
bool IsUniStr
Definition: lx.h:138
bool IsExcept
Definition: lx.h:139
Definition: lx.h:50
bool IsNum(const char &Ch) const
Definition: lx.h:29
bool IsCmtAlw
Definition: lx.h:138
void Trunc()
Definition: dt.cpp:420
Definition: lx.h:49
Definition: lx.h:45
TChA Str
Definition: lx.h:150
static const char LfCh
Definition: dt.h:1035
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TSStack< TILxSymSt > PrevSymStStack
Definition: lx.h:136
bool Bool
Definition: lx.h:151
Definition: lx.h:47
Definition: dt.h:201
Definition: ut.h:161
Definition: lx.h:48
bool IsBof() const
Definition: lx.h:167
int SymLnChN
Definition: lx.h:152
char GetCh()
Definition: lx.h:140
static bool IsValStr(const TStr &Str)
Definition: dt.cpp:1842
Definition: lx.h:46
Definition: lx.h:50
void Pop()
Definition: ds.h:2598
Definition: dt.h:412
int LnChN
Definition: lx.h:135
bool IsTerm(const char &Ch) const
Definition: lx.h:26
static const char CrCh
Definition: dt.h:1036
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
Definition: lx.h:46
PLxChDef ChDef
Definition: lx.h:131
int Int
Definition: lx.h:151
Definition: lx.h:47
int SymChN
Definition: lx.h:152
Definition: lx.h:46
Definition: lx.h:45
int EncodeUtf8(const TIntV &src, TIntV &dest) const
Definition: unicode.h:1792
TStr GetFPosStr() const
Definition: lx.cpp:607
char Pop()
Definition: dt.h:265
Definition: lx.h:46
Definition: lx.h:45
TChA CmtStr
Definition: lx.h:150
Definition: lx.h:46
Definition: lx.h:48
Definition: lx.h:50
double Flt
Definition: lx.h:151
bool In(const int &FlagN) const
Definition: bits.h:156
TLxSym TILx::GetSym ( )
inline

Definition at line 171 of file lx.h.

171 {return GetSym(TFSet());}
Definition: bits.h:119
TLxSym GetSym()
Definition: lx.h:171
TLxSym TILx::GetSym ( const TLxSym Sym)
inline

Definition at line 172 of file lx.h.

172 {return GetSym(TFSet()|Sym);}
Definition: bits.h:119
TLxSym Sym
Definition: lx.h:149
TLxSym GetSym()
Definition: lx.h:171
TLxSym TILx::GetSym ( const TLxSym Sym1,
const TLxSym Sym2 
)
inline

Definition at line 173 of file lx.h.

173  {
174  return GetSym(TFSet()|Sym1|Sym2);}
Definition: bits.h:119
TLxSym GetSym()
Definition: lx.h:171
TLxSym TILx::GetSym ( const TLxSym Sym1,
const TLxSym Sym2,
const TLxSym Sym3 
)
inline

Definition at line 175 of file lx.h.

175  {
176  return GetSym(TFSet()|Sym1|Sym2|Sym3);}
Definition: bits.h:119
TLxSym GetSym()
Definition: lx.h:171
TLxSym TILx::GetSym ( const TLxSym Sym1,
const TLxSym Sym2,
const TLxSym Sym3,
const TLxSym Sym4 
)
inline

Definition at line 177 of file lx.h.

178  {
179  return GetSym(TFSet()|Sym1|Sym2|Sym3|Sym4);}
Definition: bits.h:119
TLxSym GetSym()
Definition: lx.h:171
TStr TILx::GetSymStr ( ) const

Definition at line 594 of file lx.cpp.

594  {
595  switch (Sym){
596  case syInt: return Str;
597  case syFlt: return Str;
598  case syStr: return Str;
599  case syIdStr: return Str;
600  case syQStr: return Str;
601  default:
602  if ((syMnRw<=Sym)&&(Sym<=syMxRw)){return Str;}
603  else {return TLxSymStr::GetSymStr(Sym);}
604  }
605 }
Definition: lx.h:53
Definition: lx.h:45
Definition: lx.h:45
Definition: lx.h:52
Definition: lx.h:45
TLxSym Sym
Definition: lx.h:149
Definition: lx.h:45
TChA Str
Definition: lx.h:150
static TStr GetSymStr(const TLxSym &Sym)
Definition: lx.cpp:142
Definition: lx.h:45
void TILx::GetVar ( const TStr VarNm,
const bool &  LBracket = false,
const bool &  NewLn = false 
)
inline

Definition at line 209 of file lx.h.

210  {
211  GetIdStr(VarNm); GetSym(syColon);
212  if (LBracket){GetSym(syLBracket);} if (NewLn){GetEoln();}}
void GetEoln()
Definition: lx.h:189
TLxSym GetSym()
Definition: lx.h:171
Definition: lx.h:50
TStr GetIdStr(const TStr &IdStr=TStr())
Definition: lx.h:185
Definition: lx.h:46
bool TILx::GetVarBool ( const TStr VarNm,
const bool &  NewLn = true 
)
inline

Definition at line 219 of file lx.h.

219  {
220  GetIdStr(VarNm); GetSym(syColon); bool Bool=GetBool();
221  if (NewLn){GetEoln();} return Bool;}
void GetEoln()
Definition: lx.h:189
TLxSym GetSym()
Definition: lx.h:171
bool GetBool()
Definition: lx.h:180
bool Bool
Definition: lx.h:151
TStr GetIdStr(const TStr &IdStr=TStr())
Definition: lx.h:185
Definition: lx.h:46
void TILx::GetVarBoolV ( const TStr VarNm,
TBoolV BoolV,
const bool &  NewLn = true 
)

Definition at line 632 of file lx.cpp.

632  {
633  BoolV.Clr();
634  GetVar(VarNm, true, NewLn);
635  while (GetSym(syRBracket, syBool)==syQStr){
636  BoolV.Add(Bool); if (NewLn){GetEoln();}}
637  if (NewLn){GetEoln();}
638 }
Definition: lx.h:45
void GetEoln()
Definition: lx.h:189
Definition: lx.h:45
void GetVar(const TStr &VarNm, const bool &LBracket=false, const bool &NewLn=false)
Definition: lx.h:209
Definition: lx.h:50
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
TLxSym GetSym()
Definition: lx.h:171
bool Bool
Definition: lx.h:151
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TILx::GetVarEnd ( const bool &  RBracket = false,
const bool &  NewLn = false 
)
inline

Definition at line 213 of file lx.h.

213  {
214  if (RBracket){GetSym(syRBracket);}
215  if (NewLn){GetEoln();}}
void GetEoln()
Definition: lx.h:189
Definition: lx.h:50
TLxSym GetSym()
Definition: lx.h:171
double TILx::GetVarFlt ( const TStr VarNm,
const bool &  NewLn = true 
)
inline

Definition at line 225 of file lx.h.

225  {
226  GetIdStr(VarNm); GetSym(syColon); double Flt=GetFlt();
227  if (NewLn){GetEoln();} return Flt;}
void GetEoln()
Definition: lx.h:189
double GetFlt()
Definition: lx.h:182
TLxSym GetSym()
Definition: lx.h:171
TStr GetIdStr(const TStr &IdStr=TStr())
Definition: lx.h:185
Definition: lx.h:46
double Flt
Definition: lx.h:151
void TILx::GetVarFltV ( const TStr VarNm,
TFltV FltV,
const bool &  NewLn = true 
)

Definition at line 648 of file lx.cpp.

648  {
649  FltV.Clr();
650  GetVar(VarNm, true, NewLn);
651  while (GetSym(syRBracket, syFlt)==syFlt){
652  FltV.Add(Flt); if (NewLn){GetEoln();}}
653  if (NewLn){GetEoln();}
654 }
void GetEoln()
Definition: lx.h:189
void GetVar(const TStr &VarNm, const bool &LBracket=false, const bool &NewLn=false)
Definition: lx.h:209
Definition: lx.h:50
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
TLxSym GetSym()
Definition: lx.h:171
Definition: lx.h:45
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
double Flt
Definition: lx.h:151
int TILx::GetVarInt ( const TStr VarNm,
const bool &  NewLn = true 
)
inline

Definition at line 222 of file lx.h.

222  {
223  GetIdStr(VarNm); GetSym(syColon); int Int=GetInt();
224  if (NewLn){GetEoln();} return Int;}
void GetEoln()
Definition: lx.h:189
int GetInt()
Definition: lx.h:181
TLxSym GetSym()
Definition: lx.h:171
TStr GetIdStr(const TStr &IdStr=TStr())
Definition: lx.h:185
int Int
Definition: lx.h:151
Definition: lx.h:46
void TILx::GetVarIntV ( const TStr VarNm,
TIntV IntV,
const bool &  NewLn = true 
)

Definition at line 640 of file lx.cpp.

640  {
641  IntV.Clr();
642  GetVar(VarNm, true, NewLn);
643  while (GetSym(syRBracket, syInt)==syInt){
644  IntV.Add(Int); if (NewLn){GetEoln();}}
645  if (NewLn){GetEoln();}
646 }
void GetEoln()
Definition: lx.h:189
Definition: lx.h:45
void GetVar(const TStr &VarNm, const bool &LBracket=false, const bool &NewLn=false)
Definition: lx.h:209
Definition: lx.h:50
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
TLxSym GetSym()
Definition: lx.h:171
int Int
Definition: lx.h:151
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TSecTm TILx::GetVarSecTm ( const TStr VarNm,
const bool &  NewLn = true 
)
inline

Definition at line 231 of file lx.h.

231  {
232  GetIdStr(VarNm); GetSym(syColon); TSecTm SecTm=TSecTm::LoadTxt(*this);
233  if (NewLn){GetEoln();} return SecTm;}
void GetEoln()
Definition: lx.h:189
TLxSym GetSym()
Definition: lx.h:171
TStr GetIdStr(const TStr &IdStr=TStr())
Definition: lx.h:185
Definition: tm.h:81
static TSecTm LoadTxt(TILx &Lx)
Definition: tm.cpp:950
Definition: lx.h:46
TStr TILx::GetVarStr ( const TStr VarNm,
const bool &  NewLn = true 
)
inline

Definition at line 228 of file lx.h.

228  {
229  GetIdStr(VarNm); GetSym(syColon); TStr Str=GetQStr();
230  if (NewLn){GetEoln();} return Str;}
void GetEoln()
Definition: lx.h:189
TLxSym GetSym()
Definition: lx.h:171
TStr GetQStr(const TStr &QStr=TStr())
Definition: lx.h:187
TChA Str
Definition: lx.h:150
TStr GetIdStr(const TStr &IdStr=TStr())
Definition: lx.h:185
Definition: dt.h:412
Definition: lx.h:46
void TILx::GetVarStrPrV ( const TStr VarNm,
TStrPrV StrPrV,
const bool &  NewLn = true 
)

Definition at line 664 of file lx.cpp.

664  {
665  StrPrV.Clr();
666  GetVar(VarNm, true, NewLn);
668  TStr Str1=GetQStr(); TStr Str2=GetQStr();
670  StrPrV.Add(TStrPr(Str1, Str2)); if (NewLn){GetEoln();}
671  }
672  if (NewLn){GetEoln();}
673 }
TPair< TStr, TStr > TStrPr
Definition: ds.h:107
void GetEoln()
Definition: lx.h:189
void GetVar(const TStr &VarNm, const bool &LBracket=false, const bool &NewLn=false)
Definition: lx.h:209
Definition: lx.h:50
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
TLxSym GetSym()
Definition: lx.h:171
TStr GetQStr(const TStr &QStr=TStr())
Definition: lx.h:187
Definition: lx.h:50
Definition: dt.h:412
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TILx::GetVarStrV ( const TStr VarNm,
TStrV StrV,
const bool &  NewLn = true 
)

Definition at line 656 of file lx.cpp.

656  {
657  StrV.Clr();
658  GetVar(VarNm, true, NewLn);
659  while (GetSym(syRBracket, syQStr)==syQStr){
660  StrV.Add(Str); if (NewLn){GetEoln();}}
661  if (NewLn){GetEoln();}
662 }
void GetEoln()
Definition: lx.h:189
Definition: lx.h:45
void GetVar(const TStr &VarNm, const bool &LBracket=false, const bool &NewLn=false)
Definition: lx.h:209
Definition: lx.h:50
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
TLxSym GetSym()
Definition: lx.h:171
TChA Str
Definition: lx.h:150
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TILx::GetVarStrVV ( const TStr VarNm,
TVec< TStrV > &  StrVV,
const bool &  NewLn = true 
)

Definition at line 675 of file lx.cpp.

675  {
676  StrVV.Clr();
677  GetVar(VarNm, true, NewLn);
679  StrVV.Add();
680  while (GetSym(syQStr, syRBracket)==syQStr){
681  StrVV.Last().Add(Str);}
682  if (NewLn){GetEoln();}
683  }
684  if (NewLn){GetEoln();}
685 }
void GetEoln()
Definition: lx.h:189
Definition: lx.h:45
void GetVar(const TStr &VarNm, const bool &LBracket=false, const bool &NewLn=false)
Definition: lx.h:209
Definition: lx.h:50
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
TLxSym GetSym()
Definition: lx.h:171
const TVal & Last() const
Returns a reference to the last element of the vector.
Definition: ds.h:579
Definition: lx.h:50
TChA Str
Definition: lx.h:150
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
bool TILx::IsBof ( ) const
inline

Definition at line 167 of file lx.h.

167 {return ChN==-1;}
int ChN
Definition: lx.h:135
bool TILx::IsEof ( ) const
inline

Definition at line 168 of file lx.h.

168 {return Ch==TCh::EofCh;}
char Ch
Definition: lx.h:134
static const char EofCh
Definition: dt.h:1037
bool TILx::IsVar ( const TStr VarNm)
inline

Definition at line 207 of file lx.h.

207  {
208  GetSym(); bool Var=((Sym==syIdStr)&&(Str==VarNm)); PutSym(); return Var;}
void PutSym()
Definition: lx.h:199
Definition: lx.h:45
TLxSym Sym
Definition: lx.h:149
TLxSym GetSym()
Definition: lx.h:171
TChA Str
Definition: lx.h:150
TILx& TILx::operator= ( const TILx )
inline

Definition at line 159 of file lx.h.

159 {Fail; return *this;}
#define Fail
Definition: bd.h:238
TLxSym TILx::PeekSym ( )
inline

Definition at line 200 of file lx.h.

200 {TLxSym NextSym=GetSym(); PutSym(); return NextSym;}
void PutSym()
Definition: lx.h:199
TLxSym
Definition: lx.h:44
TLxSym GetSym()
Definition: lx.h:171
TLxSym TILx::PeekSym ( const int &  Syms)

Definition at line 580 of file lx.cpp.

580  {
581  TILxSymSt CurSymSt(*this);
582  TSStack<TILxSymSt> SymStStack;
583  for (int SymN=0; SymN<Syms; SymN++){
584  GetSym(); SymStStack.Push(TILxSymSt(*this));}
585  TLxSym PeekedSym=Sym;
586  while (!SymStStack.Empty()){
587  SymStStack.Top().Restore(*this); SymStStack.Pop();
588  PutSym();
589  }
590  CurSymSt.Restore(*this);
591  return PeekedSym;
592 }
bool Empty()
Definition: ds.h:2590
void PutSym()
Definition: lx.h:199
TVal & Top()
Definition: ds.h:2594
TLxSym
Definition: lx.h:44
void Restore(TILx &Lx)
Definition: lx.cpp:262
TLxSym Sym
Definition: lx.h:149
Definition: lx.h:107
TLxSym GetSym()
Definition: lx.h:171
void Push()
Definition: ds.h:2596
void Pop()
Definition: ds.h:2598
bool TILx::PeekVarEnd ( const bool &  RBracket = false,
const bool &  NewLn = false 
)
inline

Definition at line 216 of file lx.h.

216  {
217  if (RBracket){return PeekSym()==syRBracket;}
218  if (NewLn){return PeekSym()==syEoln;} Fail; return false;}
#define Fail
Definition: bd.h:238
Definition: lx.h:51
Definition: lx.h:50
TLxSym PeekSym()
Definition: lx.h:200
void TILx::PutSym ( const TILxSymSt SymSt)
inline

Definition at line 198 of file lx.h.

198 {PrevSymStStack.Push(TILxSymSt(SymSt));}
Definition: lx.h:107
TSStack< TILxSymSt > PrevSymStStack
Definition: lx.h:136
void Push()
Definition: ds.h:2596
void TILx::PutSym ( )
inline

Definition at line 199 of file lx.h.

199 {PrevSymStStack.Push(TILxSymSt(*this));}
Definition: lx.h:107
TSStack< TILxSymSt > PrevSymStStack
Definition: lx.h:136
void Push()
Definition: ds.h:2596
void TILx::SetOpt ( const int &  Opt,
const bool &  Val 
)

Definition at line 286 of file lx.cpp.

286  {
287  switch (Opt){
288  case iloCmtAlw: IsCmtAlw=Val; break;
289  case iloRetEoln: IsRetEoln=Val; break;
290  case iloSigNum: IsSigNum=Val; break;
291  case iloUniStr: IsUniStr=Val; break;
292  case iloCsSens: IsCsSens=Val; break;
293  case iloExcept: IsExcept=Val; break;
294  case iloTabSep: IsTabSep=Val; break;
295  case iloList: IsList=Val; break;
296  default: Fail;
297  }
298 }
Definition: lx.h:127
bool IsCsSens
Definition: lx.h:138
bool IsTabSep
Definition: lx.h:139
#define Fail
Definition: bd.h:238
bool IsList
Definition: lx.h:139
bool IsRetEoln
Definition: lx.h:138
Definition: lx.h:126
Definition: lx.h:126
Definition: lx.h:126
Definition: lx.h:126
bool IsSigNum
Definition: lx.h:138
bool IsUniStr
Definition: lx.h:138
bool IsExcept
Definition: lx.h:139
bool IsCmtAlw
Definition: lx.h:138
Definition: lx.h:127
Definition: lx.h:127
Definition: lx.h:126
void TILx::SkipToEoln ( )

Definition at line 573 of file lx.cpp.

573  {
574  while ((Ch!=TCh::CrCh)&&(Ch!=TCh::LfCh)&&(Ch!=TCh::EofCh)){
575  GetCh();}
576  if (Ch==TCh::CrCh){if (GetCh()==TCh::LfCh){GetCh();}} else
577  if (Ch==TCh::LfCh){if (GetCh()==TCh::CrCh){GetCh();}}
578 }
char Ch
Definition: lx.h:134
static const char EofCh
Definition: dt.h:1037
static const char LfCh
Definition: dt.h:1035
char GetCh()
Definition: lx.h:140
static const char CrCh
Definition: dt.h:1036
void TILx::SkipToSym ( const TLxSym SkipToSym)
inline

Definition at line 195 of file lx.h.

195  {
196  while (Sym!=SkipToSym){GetSym();}}
void SkipToSym(const TLxSym &SkipToSym)
Definition: lx.h:195
TLxSym Sym
Definition: lx.h:149
TLxSym GetSym()
Definition: lx.h:171

Member Data Documentation

bool TILx::Bool

Definition at line 151 of file lx.h.

char TILx::Ch
private

Definition at line 134 of file lx.h.

PLxChDef TILx::ChDef
private

Definition at line 131 of file lx.h.

int TILx::ChN
private

Definition at line 135 of file lx.h.

TChA TILx::CmtStr

Definition at line 150 of file lx.h.

double TILx::Flt

Definition at line 151 of file lx.h.

int TILx::Int

Definition at line 151 of file lx.h.

bool TILx::IsCmtAlw
private

Definition at line 138 of file lx.h.

bool TILx::IsCsSens
private

Definition at line 138 of file lx.h.

bool TILx::IsExcept
private

Definition at line 139 of file lx.h.

bool TILx::IsList
private

Definition at line 139 of file lx.h.

bool TILx::IsRetEoln
private

Definition at line 138 of file lx.h.

bool TILx::IsSigNum
private

Definition at line 138 of file lx.h.

bool TILx::IsTabSep
private

Definition at line 139 of file lx.h.

bool TILx::IsUniStr
private

Definition at line 138 of file lx.h.

int TILx::LnChN
private

Definition at line 135 of file lx.h.

int TILx::LnN
private

Definition at line 135 of file lx.h.

char TILx::PrevCh
private

Definition at line 134 of file lx.h.

TSStack<TILxSymSt> TILx::PrevSymStStack
private

Definition at line 136 of file lx.h.

char TILx::QuoteCh

Definition at line 154 of file lx.h.

bool TILx::QuoteP

Definition at line 153 of file lx.h.

TSIn& TILx::RSIn
private

Definition at line 133 of file lx.h.

TStrIntH TILx::RwStrH
private

Definition at line 137 of file lx.h.

PSIn TILx::SIn
private

Definition at line 132 of file lx.h.

TChA TILx::Str

Definition at line 150 of file lx.h.

TLxSym TILx::Sym

Definition at line 149 of file lx.h.

int TILx::SymChN

Definition at line 152 of file lx.h.

int TILx::SymLnChN

Definition at line 152 of file lx.h.

int TILx::SymLnN

Definition at line 152 of file lx.h.

TChA TILx::UcStr

Definition at line 150 of file lx.h.


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