SNAP Library 6.0, Developer Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
Go to the documentation of this file.
1 #include "bd.h"
4 // Lexical-Char-Definition
9 private:
10  TIntV ChTyV;
11  TChV UcChV;
12  void SetUcCh(const TStr& Str);
13  void SetChTy(const TLxChTy& ChTy, const TStr& Str);
14 public:
15  TLxChDef(const TLxChDefTy& ChDefTy);
16  static PLxChDef New(const TLxChDefTy& ChDefTy=lcdtUsAscii){
17  return PLxChDef(new TLxChDef(ChDefTy));}
18  TLxChDef(TSIn& SIn): ChTyV(SIn), UcChV(SIn){}
19  static PLxChDef Load(TSIn& SIn){return new TLxChDef(SIn);}
20  void Save(TSOut& SOut){ChTyV.Save(SOut); UcChV.Save(SOut);}
22  TLxChDef& operator=(const TLxChDef& ChDef){
23  ChTyV=ChDef.ChTyV; UcChV=ChDef.UcChV; return *this;}
25  int GetChTy(const char& Ch) const {return ChTyV[Ch-TCh::Mn];}
26  bool IsTerm(const char& Ch) const {return ChTyV[Ch-TCh::Mn]==TInt(lctTerm);}
27  bool IsSpace(const char& Ch) const {return ChTyV[Ch-TCh::Mn]==TInt(lctSpace);}
28  bool IsAlpha(const char& Ch) const {return ChTyV[Ch-TCh::Mn]==TInt(lctAlpha);}
29  bool IsNum(const char& Ch) const {return ChTyV[Ch-TCh::Mn]==TInt(lctNum);}
30  bool IsAlNum(const char& Ch) const {
31  return (ChTyV[Ch-TCh::Mn]==TInt(lctAlpha))||(ChTyV[Ch-TCh::Mn]==TInt(lctNum));}
32  char GetUc(const char& Ch) const {return UcChV[Ch-TCh::Mn];}
34  bool IsNmStr(const TStr& Str) const;
35  TStr GetUcStr(const TStr& Str) const;
37  // standard entry points
38  static PLxChDef GetChDef(const TLxChDefTy& ChDefTy=lcdtUsAscii);
39 // static TLxChDef& GetChDefRef(const TLxChDefTy& ChDefTy=lcdtUsAscii);
40 };
43 // Lexical-Symbols
44 typedef enum {
54 } TLxSym;
56 class TLxSymStr{
57 public:
58  static const TStr UndefStr;
59  static const TStr LnStr;
60  static const TStr TabStr;
61  static const TStr BoolStr;
62  static const TStr IntStr;
63  static const TStr FltStr;
64  static const TStr StrStr;
65  static const TStr IdStrStr;
66  static const TStr QStrStr;
67  static const TStr PeriodStr;
68  static const TStr DPeriodStr;
69  static const TStr CommaStr;
70  static const TStr ColonStr;
71  static const TStr DColonStr;
72  static const TStr SemicolonStr;
73  static const TStr PlusStr;
74  static const TStr MinusStr;
75  static const TStr AsteriskStr;
76  static const TStr SlashStr;
77  static const TStr PercentStr;
78  static const TStr ExclamationStr;
79  static const TStr VBarStr;
80  static const TStr AmpersandStr;
81  static const TStr QuestionStr;
82  static const TStr HashStr;
83  static const TStr EqStr;
84  static const TStr NEqStr;
85  static const TStr LssStr;
86  static const TStr GtrStr;
87  static const TStr LEqStr;
88  static const TStr GEqStr;
89  static const TStr LParenStr;
90  static const TStr RParenStr;
91  static const TStr LBracketStr;
92  static const TStr RBracketStr;
93  static const TStr LBraceStr;
94  static const TStr RBraceStr;
95  static const TStr EolnStr;
96  static const TStr EofStr;
97  static TStr GetSymStr(const TLxSym& Sym);
98  static TLxSym GetSSym(const TStr& Str);
99 public:
100  static bool IsSep(const TLxSym& PrevSym, const TLxSym& Sym);
101 };
104 // Lexical-Input-Symbol-State
105 class TILx;
107 class TILxSymSt{
108 private:
111  bool Bool; int Int; double Flt;
113 public:
114  TILxSymSt();
115  TILxSymSt(const TILxSymSt& SymSt);
116  TILxSymSt(TILx& Lx);
118  void Save(TSOut&){Fail;}
120  void Restore(TILx& Lx);
121 };
124 // Lexical-Input
125 typedef enum {
129 class TILx{
130 private:
134  char PrevCh, Ch;
135  int LnN, LnChN, ChN;
140  char GetCh(){
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  }
147  char GetChX(){char Ch=GetChX(); printf("%c", Ch); return Ch;}
148 public: // symbol state
151  bool Bool; int Int; double Flt;
153  bool QuoteP;
154  char QuoteCh;
155 public:
156  TILx(const PSIn& _SIn, const TFSet& OptSet=TFSet(),
157  const TLxChDefTy& ChDefTy=lcdtUsAscii);
159  TILx& operator=(const TILx&){Fail; return *this;}
161  void SetOpt(const int& Opt, const bool& Val);
162  TLxSym AddRw(const TStr& Str);
163  TLxSym GetRw(const TStr& Str){
164  return TLxSym(int(RwStrH.GetDat(Str)));}
165  PSIn GetSIn(const char& SepCh);
166  int GetLnN() const {return LnN;}
167  bool IsBof() const {return ChN==-1;}
168  bool IsEof() const {return Ch==TCh::EofCh;}
170  TLxSym GetSym(const TFSet& Expect);
171  TLxSym GetSym(){return GetSym(TFSet());}
172  TLxSym GetSym(const TLxSym& Sym){return GetSym(TFSet()|Sym);}
173  TLxSym GetSym(const TLxSym& Sym1, const TLxSym& Sym2){
174  return GetSym(TFSet()|Sym1|Sym2);}
175  TLxSym GetSym(const TLxSym& Sym1, const TLxSym& Sym2, const TLxSym& Sym3){
176  return GetSym(TFSet()|Sym1|Sym2|Sym3);}
177  TLxSym GetSym(const TLxSym& Sym1, const TLxSym& Sym2, const TLxSym& Sym3,
178  const TLxSym& Sym4){
179  return GetSym(TFSet()|Sym1|Sym2|Sym3|Sym4);}
180  bool GetBool(){GetSym(TFSet()|syBool); return Bool;}
181  int GetInt(){GetSym(TFSet()|syInt); return Int;}
182  double GetFlt(){GetSym(TFSet()|syFlt); return Flt;}
183  TStr GetStr(const TStr& _Str=TStr()){
184  GetSym(TFSet()|syStr); IAssert(_Str.Empty()||(_Str==Str)); return Str;}
185  TStr GetIdStr(const TStr& IdStr=TStr()){
186  GetSym(TFSet()|syIdStr); IAssert(IdStr.Empty()||(IdStr==Str)); return Str;}
187  TStr GetQStr(const TStr& QStr=TStr()){
188  GetSym(TFSet()|syQStr); IAssert(QStr.Empty()||(Str==QStr)); return Str;}
190  TStr GetStrToCh(const char& ToCh);
191  TStr GetStrToEolnOrCh(const char& ToCh);
192  TStr GetStrToEoln(const bool& DoTrunc=false);
193  TStr GetStrToEolnAndCh(const char& ToCh);
194  void SkipToEoln();
195  void SkipToSym(const TLxSym& SkipToSym){
196  while (Sym!=SkipToSym){GetSym();}}
198  void PutSym(const TILxSymSt& SymSt){PrevSymStStack.Push(TILxSymSt(SymSt));}
199  void PutSym(){PrevSymStStack.Push(TILxSymSt(*this));}
200  TLxSym PeekSym(){TLxSym NextSym=GetSym(); PutSym(); return NextSym;}
201  TLxSym PeekSym(const int& Syms);
203  TStr GetSymStr() const;
204  TStr GetFPosStr() const;
205  static TStr GetQStr(const TStr& Str, const bool& QuoteP, const char& QuoteCh);
207  bool IsVar(const TStr& VarNm){
208  GetSym(); bool Var=((Sym==syIdStr)&&(Str==VarNm)); PutSym(); return Var;}
209  void GetVar(const TStr& VarNm,
210  const bool& LBracket=false, const bool& NewLn=false){
211  GetIdStr(VarNm); GetSym(syColon);
212  if (LBracket){GetSym(syLBracket);} if (NewLn){GetEoln();}}
213  void GetVarEnd(const bool& RBracket=false, const bool& NewLn=false){
214  if (RBracket){GetSym(syRBracket);}
215  if (NewLn){GetEoln();}}
216  bool PeekVarEnd(const bool& RBracket=false, const bool& NewLn=false){
217  if (RBracket){return PeekSym()==syRBracket;}
218  if (NewLn){return PeekSym()==syEoln;} Fail; return false;}
219  bool GetVarBool(const TStr& VarNm, const bool& NewLn=true){
220  GetIdStr(VarNm); GetSym(syColon); bool Bool=GetBool();
221  if (NewLn){GetEoln();} return Bool;}
222  int GetVarInt(const TStr& VarNm, const bool& NewLn=true){
223  GetIdStr(VarNm); GetSym(syColon); int Int=GetInt();
224  if (NewLn){GetEoln();} return Int;}
225  double GetVarFlt(const TStr& VarNm, const bool& NewLn=true){
226  GetIdStr(VarNm); GetSym(syColon); double Flt=GetFlt();
227  if (NewLn){GetEoln();} return Flt;}
228  TStr GetVarStr(const TStr& VarNm, const bool& NewLn=true){
229  GetIdStr(VarNm); GetSym(syColon); TStr Str=GetQStr();
230  if (NewLn){GetEoln();} return Str;}
231  TSecTm GetVarSecTm(const TStr& VarNm, const bool& NewLn=true){
232  GetIdStr(VarNm); GetSym(syColon); TSecTm SecTm=TSecTm::LoadTxt(*this);
233  if (NewLn){GetEoln();} return SecTm;}
234  void GetVarBoolV(const TStr& VarNm, TBoolV& BoolV, const bool& NewLn=true);
235  void GetVarIntV(const TStr& VarNm, TIntV& IntV, const bool& NewLn=true);
236  void GetVarFltV(const TStr& VarNm, TFltV& FltV, const bool& NewLn=true);
237  void GetVarStrV(const TStr& VarNm, TStrV& StrV, const bool& NewLn=true);
238  void GetVarStrPrV(const TStr& VarNm, TStrPrV& StrPrV, const bool& NewLn=true);
239  void GetVarStrVV(const TStr& VarNm, TVec<TStrV>& StrVV, const bool& NewLn=true);
241  // file-of-lines
242  static void GetLnV(const TStr& FNm, TStrV& LnV);
243 };
246 // Lexical-Output
247 typedef enum {
251 class TOLx{
252 private:
262  void PutSep(const TLxSym& Sym);
263 public:
264  TOLx(const PSOut& _SOut, const TFSet& OptSet,
265  const TLxChDefTy& ChDefTy=lcdtUsAscii);
267  TOLx& operator=(const TOLx&){Fail; return *this;}
269  void SetOpt(const int& Opt, const bool& Val);
270  TLxSym AddRw(const TStr& Str);
271  PSOut GetSOut(const char& SepCh){
272  RSOut.PutCh(SepCh); return SOut;}
274  void PutSym(const TLxSym& Sym);
275  void PutBool(const TBool& Bool){
276  PutSep(syIdStr); RSOut.PutStr(TBool::GetStr(Bool));}
277  void PutInt(const TInt& Int){
278  if (!IsSigNum){Assert(int(Int)>=0);}
279  PutSep(syInt); RSOut.PutStr(TInt::GetStr(Int));}
280  void PutFlt(const TFlt& Flt, const int& Width=-1, const int& Prec=-1){
281  if (!IsSigNum){Assert(Flt>=0);}
282  PutSep(syFlt); RSOut.PutStr(TFlt::GetStr(Flt, Width, Prec));}
283  void PutStr(const TStr& Str){
284  if ((IsUniStr)&&(ChDef->IsNmStr(Str))){PutSep(syIdStr); RSOut.PutStr(Str);}
285  else {PutSep(syStr); RSOut.PutCh('"'); RSOut.PutStr(Str); RSOut.PutCh('"');}}
286  void PutIdStr(const TStr& Str, const bool& CheckIdStr=true){
287  if (CheckIdStr){Assert(ChDef->IsNmStr(Str));}
288  PutSep(syIdStr); RSOut.PutStr(Str);}
289  void PutQStr(const TStr& Str){
290  PutSep(syQStr); RSOut.PutCh('"'); RSOut.PutStr(Str); RSOut.PutCh('"');}
291  void PutQStr(const TChA& ChA){
292  PutSep(syQStr); RSOut.PutCh('"'); RSOut.PutStr(ChA); RSOut.PutCh('"');}
293  void PutUQStr(const TStr& Str){
294  PutSep(syIdStr); RSOut.PutStr(Str);}
295  void PutLnCmt(const TStr& Str, const int& IndentLev=0){
296  Assert(IsCmtAlw); PutStr(" // "); PutStr(Str); PutLn(IndentLev);}
297  void PutParCmt(const TStr& Str){
298  Assert(IsCmtAlw); PutStr(" /* "); PutStr(Str); PutStr(" */ ");}
299  void PutIndent(const int& IndentLev){
300  RSOut.PutCh(' ', IndentLev*2);}
301  void PutTab() const {RSOut.PutCh(TCh::TabCh);}
302  void PutLn(const int& IndentLev=0){
303  Assert(IsFrcEoln);
304  PutSep(syEoln); RSOut.PutLn(); RSOut.PutCh(' ', IndentLev*2);}
305  void PutDosLn(const int& IndentLev=0){
306  Assert(IsFrcEoln);
307  PutSep(syEoln); RSOut.PutDosLn(); RSOut.PutCh(' ', IndentLev*2);}
309  void PutVar(const TStr& VarNm, const bool& LBracket=false,
310  const bool& NewLn=false, const bool& CheckIdStr=true){
311  if (IsVarIndent){PutIndent(VarIndentLev);}
312  PutIdStr(VarNm, CheckIdStr); PutSym(syColon);
313  if (LBracket){PutSym(syLBracket);}
314  if (NewLn){PutLn(); VarIndentLev++;}}
315  void PutVarEnd(const bool& RBracket=false, const bool& NewLn=false){
316  if (IsVarIndent){PutIndent(VarIndentLev-1);}
317  if (RBracket){PutSym(syRBracket);}
318  if (NewLn){PutLn(); VarIndentLev--;}}
319  void PutVarBool(const TStr& VarNm, const bool& Bool,
320  const bool& NewLn=true, const bool& CheckIdStr=true){
321  if (IsVarIndent){PutIndent(VarIndentLev);}
322  PutIdStr(VarNm, CheckIdStr); PutSym(syColon); PutBool(Bool);
323  if (NewLn){PutLn();}}
324  void PutVarInt(const TStr& VarNm, const int& Int,
325  const bool& NewLn=true, const bool& CheckIdStr=true){
326  if (IsVarIndent){PutIndent(VarIndentLev);}
327  PutIdStr(VarNm, CheckIdStr); PutSym(syColon); PutInt(Int);
328  if (NewLn){PutLn();}}
329  void PutVarFlt(const TStr& VarNm, const double& Flt,
330  const bool& NewLn=true, const bool& CheckIdStr=true){
331  if (IsVarIndent){PutIndent(VarIndentLev);}
332  PutIdStr(VarNm, CheckIdStr); PutSym(syColon); PutFlt(Flt);
333  if (NewLn){PutLn();}}
334  void PutVarStr(const TStr& VarNm, const TStr& Str,
335  const bool& NewLn=true, const bool& CheckIdStr=true){
336  if (IsVarIndent){PutIndent(VarIndentLev);}
337  PutIdStr(VarNm, CheckIdStr); PutSym(syColon); PutQStr(Str);
338  if (NewLn){PutLn();}}
339  void PutVarSecTm(const TStr& VarNm, const TSecTm& SecTm,
340  const bool& NewLn=true, const bool& CheckIdStr=true){
341  if (IsVarIndent){PutIndent(VarIndentLev);}
342  PutIdStr(VarNm, CheckIdStr); PutSym(syColon); SecTm.SaveTxt(*this);
343  if (NewLn){PutLn();}}
344  void PutVarBoolV(const TStr& VarNm, const TBoolV& BoolV,
345  const bool& NewLn=true, const bool& CheckIdStr=true);
346  void PutVarIntV(const TStr& VarNm, const TIntV& IntV,
347  const bool& NewLn=true, const bool& CheckIdStr=true);
348  void PutVarFltV(const TStr& VarNm, const TFltV& FltV,
349  const bool& NewLn=true, const bool& CheckIdStr=true);
350  void PutVarStrV(const TStr& VarNm, const TStrV& StrV,
351  const bool& NewLn=true, const bool& CheckIdStr=true);
352  void PutVarStrPrV(const TStr& VarNm, const TStrPrV& StrPrV,
353  const bool& NewLn=true, const bool& CheckIdStr=true);
354  void PutVarStrVV(const TStr& VarNm, const TVec<TStrV>& StrVV,
355  const bool& NewLn=true, const bool& CheckIdStr=true);
356 };
359 // Preprocessor
360 class TPreproc{
361 private:
364  char PrevCh, Ch;
366  char GetCh();
367  bool IsSubstId(const TStr& SubstId, TStr& SubstValStr) const;
369 public:
370  TPreproc(const TStr& InFNm, const TStr& OutFNm,
371  const TStr& SubstFNm, const TStrV& _SubstKeyIdV);
373  static void Execute(const TStr& InFNm, const TStr& OutFNm,
374  const TStr& InSubstFNm, const TStrV& SubstKeyIdV){
375  TPreproc Preproc(InFNm, OutFNm, InSubstFNm, SubstKeyIdV);}
376 };
378 /* Sample Subst-File
379 <SubstList>
381 <Subst Id="TId">
382  <Str Key="MSSQL">TId</Str>
383  <Str Key="Oracle">NUMBER(15) NOT NULL</Str>
384 </Subst>
386 <Subst Id="TStr2NN">
387  <Str Key="MSSQL">TStr2NN</Str>
388  <Str Key="Oracle">VARCHAR2(2) NOT NULL</Str>
389 </Subst>
391 </SubstList>
392 */
Definition: lx.h:53
#define IAssert(Cond)
Definition: bd.h:262
char Ch
Definition: lx.h:134
void PutLn(const int &IndentLev=0)
Definition: lx.h:302
double GetVarFlt(const TStr &VarNm, const bool &NewLn=true)
Definition: lx.h:225
Definition: lx.h:248
Definition: lx.h:49
Definition: lx.h:49
Definition: lx.h:127
Definition: lx.h:50
bool IsTabSep
Definition: lx.h:257
Definition: lx.h:6
bool IsCsSens
Definition: lx.h:138
int SymLnN
Definition: lx.h:152
void GetVarEnd(const bool &RBracket=false, const bool &NewLn=false)
Definition: lx.h:213
static const TStr QuestionStr
Definition: lx.h:81
TStr GetStr() const
Definition: dt.h:1200
int GetLnN() const
Definition: lx.h:166
TILx(const PSIn &_SIn, const TFSet &OptSet=TFSet(), const TLxChDefTy &ChDefTy=lcdtUsAscii)
Definition: lx.cpp:270
void PutParCmt(const TStr &Str)
Definition: lx.h:297
Definition: lx.h:53
bool IsAlNum(const char &Ch) const
Definition: lx.h:30
bool PeekVarEnd(const bool &RBracket=false, const bool &NewLn=false)
Definition: lx.h:216
bool IsSubstId(const TStr &SubstId, TStr &SubstValStr) const
Definition: lx.cpp:842
void GetVarIntV(const TStr &VarNm, TIntV &IntV, const bool &NewLn=true)
Definition: lx.cpp:640
void PutVarStrPrV(const TStr &VarNm, const TStrPrV &StrPrV, const bool &NewLn=true, const bool &CheckIdStr=true)
Definition: lx.cpp:805
Definition: lx.h:45
void PutDosLn(const int &IndentLev=0)
Definition: lx.h:305
char PrevCh
Definition: lx.h:364
Definition: lx.h:52
TStr GetStrToEoln(const bool &DoTrunc=false)
Definition: lx.cpp:553
Definition: lx.h:5
virtual int PutCh(const char &Ch)=0
void GetEoln()
Definition: lx.h:189
static const TStr CommaStr
Definition: lx.h:69
Definition: lx.h:52
void PutVar(const TStr &VarNm, const bool &LBracket=false, const bool &NewLn=false, const bool &CheckIdStr=true)
Definition: lx.h:309
Definition: lx.h:50
Definition: lx.h:5
void PutSym()
Definition: lx.h:199
Definition: lx.h:360
Definition: lx.h:49
Definition: lx.h:247
Definition: lx.h:45
TStr GetSymStr() const
Definition: lx.cpp:594
bool IsUniStr
Definition: lx.h:256
void PutBool(const TBool &Bool)
Definition: lx.h:275
TStrIntH RwStrH
Definition: lx.h:137
Definition: lx.h:48
static const TStr DPeriodStr
Definition: lx.h:68
Definition: lx.h:46
Definition: lx.h:53
void SkipToEoln()
Definition: lx.cpp:573
int Int
Definition: lx.h:111
bool IsTabSep
Definition: lx.h:139
#define Fail
Definition: bd.h:238
bool IsSpace(const char &Ch) const
Definition: lx.h:27
static const TStr EofStr
Definition: lx.h:96
static const TStr ColonStr
Definition: lx.h:70
TLxSym GetSym(const TLxSym &Sym)
Definition: lx.h:172
TStrV SubstKeyIdV
Definition: lx.h:363
bool IsList
Definition: lx.h:139
TStr GetVarStr(const TStr &VarNm, const bool &NewLn=true)
Definition: lx.h:228
Definition: lx.h:44
Definition: lx.h:45
TPt< TLxChDef > PLxChDef
Definition: lx.h:8
Definition: lx.h:52
bool IsAlpha(const char &Ch) const
Definition: lx.h:28
Definition: lx.h:48
Definition: bits.h:119
Definition: lx.h:47
Definition: lx.h:5
TLxSym GetSym(const TLxSym &Sym1, const TLxSym &Sym2, const TLxSym &Sym3)
Definition: lx.h:175
int VarIndentLev
Definition: lx.h:258
TStr GetStrToEolnOrCh(const char &ToCh)
Definition: lx.cpp:546
int GetChTy(const char &Ch) const
Definition: lx.h:25
void PutInt(const TInt &Int)
Definition: lx.h:277
void GetVarStrV(const TStr &VarNm, TStrV &StrV, const bool &NewLn=true)
Definition: lx.cpp:656
Definition: lx.h:51
void PutVarBoolV(const TStr &VarNm, const TBoolV &BoolV, const bool &NewLn=true, const bool &CheckIdStr=true)
Definition: lx.cpp:761
Definition: lx.h:45
TStr GetStr(const TStr &_Str=TStr())
Definition: lx.h:183
int ChN
Definition: lx.h:135
void GetVar(const TStr &VarNm, const bool &LBracket=false, const bool &NewLn=false)
Definition: lx.h:209
bool IsEof() const
Definition: lx.h:168
int GetInt()
Definition: lx.h:181
Definition: lx.h:52
void SaveTxt(TOLx &Lx) const
Definition: tm.cpp:954
Definition: lx.h:45
PLxChDef ChDef
Definition: lx.h:253
static const TStr BoolStr
Definition: lx.h:61
bool IsRetEoln
Definition: lx.h:138
void PutSep(const TLxSym &Sym)
Definition: lx.cpp:712
void PutVarFlt(const TStr &VarNm, const double &Flt, const bool &NewLn=true, const bool &CheckIdStr=true)
Definition: lx.h:329
void Restore(TILx &Lx)
Definition: lx.cpp:262
void GetVarFltV(const TStr &VarNm, TFltV &FltV, const bool &NewLn=true)
Definition: lx.cpp:648
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
void PutSym(const TLxSym &Sym)
Definition: lx.cpp:751
Definition: lx.h:5
TLxSym AddRw(const TStr &Str)
Definition: lx.cpp:741
void PutQStr(const TStr &Str)
Definition: lx.h:289
Definition: lx.h:47
bool QuoteP
Definition: lx.h:153
void SkipToSym(const TLxSym &SkipToSym)
Definition: lx.h:195
Definition: lx.h:126
double GetFlt()
Definition: lx.h:182
void SetOpt(const int &Opt, const bool &Val)
Definition: lx.cpp:286
int PutLn(const int &Lns=1)
Definition: fl.cpp:158
TILx & operator=(const TILx &)
Definition: lx.h:159
bool IsFrcEoln
Definition: lx.h:256
Definition: lx.h:49
TLxSym AddRw(const TStr &Str)
Definition: lx.cpp:300
static const TStr PercentStr
Definition: lx.h:77
int GetVarInt(const TStr &VarNm, const bool &NewLn=true)
Definition: lx.h:222
static const TStr PlusStr
Definition: lx.h:73
Definition: lx.h:6
bool IsVar(const TStr &VarNm)
Definition: lx.h:207
char GetUc(const char &Ch) const
Definition: lx.h:32
TLxSym Sym
Definition: lx.h:149
void PutIndent(const int &IndentLev)
Definition: lx.h:299
TStr Str
Definition: lx.h:110
TLxSym GetRw(const TStr &Str)
Definition: lx.h:163
TOLx(const PSOut &_SOut, const TFSet &OptSet, const TLxChDefTy &ChDefTy=lcdtUsAscii)
Definition: lx.cpp:718
char QuoteCh
Definition: lx.h:154
Definition: dt.h:1386
static bool IsSep(const TLxSym &PrevSym, const TLxSym &Sym)
Definition: lx.cpp:226
void PutVarSecTm(const TStr &VarNm, const TSecTm &SecTm, const bool &NewLn=true, const bool &CheckIdStr=true)
Definition: lx.h:339
Definition: fl.h:58
Definition: lx.h:126
TSOut & RSOut
Definition: lx.h:255
Definition: lx.h:126
TLxChDef & operator=(const TLxChDef &ChDef)
Definition: lx.h:22
Definition: lx.cpp:244
static const char EofCh
Definition: dt.h:1040
#define ClassTP(TNm, PNm)
Definition: bd.h:126
Definition: lx.h:107
bool GetVarBool(const TStr &VarNm, const bool &NewLn=true)
Definition: lx.h:219
static const TStr IntStr
Definition: lx.h:62
Definition: lx.h:133
void SetOpt(const int &Opt, const bool &Val)
Definition: lx.cpp:728
void PutVarStrVV(const TStr &VarNm, const TVec< TStrV > &StrVV, const bool &NewLn=true, const bool &CheckIdStr=true)
Definition: lx.cpp:818
Definition: lx.h:50
TChA UcStr
Definition: lx.h:150
double Flt
Definition: lx.h:111
static void GetLnV(const TStr &FNm, TStrV &LnV)
Definition: lx.cpp:687
PSIn GetSIn(const char &SepCh)
Definition: lx.cpp:309
static const TStr HashStr
Definition: lx.h:82
int LnN
Definition: lx.h:135
Definition: lx.h:126
static const TStr QStrStr
Definition: lx.h:66
bool IsSigNum
Definition: lx.h:138
static const TStr VBarStr
Definition: lx.h:79
Definition: lx.h:45
Definition: lx.h:6
TStr GetStrToCh(const char &ToCh)
Definition: lx.cpp:539
Definition: lx.h:53
TLxSym GetSym()
Definition: lx.h:171
static const TStr EqStr
Definition: lx.h:83
Definition: lx.h:132
void PutVarBool(const TStr &VarNm, const bool &Bool, const bool &NewLn=true, const bool &CheckIdStr=true)
Definition: lx.h:319
virtual bool Eof()=0
Definition: lx.h:5
void PutSym(const TILxSymSt &SymSt)
Definition: lx.h:198
bool IsVarIndent
Definition: lx.h:257
static const char TabCh
Definition: dt.h:1037
static const char Mn
Definition: dt.h:1032
Definition: lx.h:47
TPreproc(const TStr &InFNm, const TStr &OutFNm, const TStr &SubstFNm, const TStrV &_SubstKeyIdV)
Definition: lx.cpp:857
Definition: lx.h:49
Definition: lx.h:51
Definition: lx.h:129
static const TStr SlashStr
Definition: lx.h:76
char PrevCh
Definition: lx.h:134
Definition: lx.h:52
#define Assert(Cond)
Definition: bd.h:251
static const TStr LssStr
Definition: lx.h:85
bool IsUniStr
Definition: lx.h:138
static const TStr ExclamationStr
Definition: lx.h:78
Definition: lx.h:53
Definition: lx.h:251
void GetVarStrPrV(const TStr &VarNm, TStrPrV &StrPrV, const bool &NewLn=true)
Definition: lx.cpp:664
void PutLnCmt(const TStr &Str, const int &IndentLev=0)
Definition: lx.h:295
TSecTm GetVarSecTm(const TStr &VarNm, const bool &NewLn=true)
Definition: lx.h:231
static const TStr RBraceStr
Definition: lx.h:94
bool IsExcept
Definition: lx.h:139
Definition: lx.h:52
TLxSym GetSym(const TLxSym &Sym1, const TLxSym &Sym2, const TLxSym &Sym3, const TLxSym &Sym4)
Definition: lx.h:177
Definition: lx.h:10
TStr GetQStr(const TStr &QStr=TStr())
Definition: lx.h:187
TILxSymSt(TSIn &)
Definition: lx.h:117
bool IsSigNum
Definition: lx.h:256
static const TStr GtrStr
Definition: lx.h:86
TOLx & operator=(const TOLx &)
Definition: lx.h:267
static const TStr LBracketStr
Definition: lx.h:91
char GetCh()
Definition: lx.cpp:834
Definition: lx.h:50
static const TStr AsteriskStr
Definition: lx.h:75
bool IsNum(const char &Ch) const
Definition: lx.h:29
static const TStr FltStr
Definition: lx.h:63
bool IsCmtAlw
Definition: lx.h:138
void PutFlt(const TFlt &Flt, const int &Width=-1, const int &Prec=-1)
Definition: lx.h:280
Definition: lx.h:49
Definition: fl.h:128
Definition: lx.h:45
Definition: lx.h:53
TChA Str
Definition: lx.h:150
bool IsCmtAlw
Definition: lx.h:256
bool GetBool()
Definition: lx.h:180
static const TStr LBraceStr
Definition: lx.h:93
Definition: dt.h:1137
Definition: lx.h:249
PSOut SOut
Definition: lx.h:254
Definition: lx.h:248
Definition: lx.h:11
Definition: lx.h:8
TSStack< TILxSymSt > PrevSymStStack
Definition: lx.h:136
Definition: lx.h:127
bool Bool
Definition: lx.h:151
Definition: lx.h:47
Definition: dt.h:201
Definition: lx.h:53
int SymLnChN
Definition: lx.h:112
void Push()
Definition: ds.h:2597
Definition: lx.h:5
TStr GetIdStr(const TStr &IdStr=TStr())
Definition: lx.h:185
Definition: tm.h:81
void GetVarStrVV(const TStr &VarNm, TVec< TStrV > &StrVV, const bool &NewLn=true)
Definition: lx.cpp:675
int PutDosLn(const int &Lns=1)
Definition: fl.cpp:164
Definition: lx.h:48
TLxSym PeekSym()
Definition: lx.h:200
bool IsBof() const
Definition: lx.h:167
int SymLnChN
Definition: lx.h:152
void PutUQStr(const TStr &Str)
Definition: lx.h:293
char GetCh()
Definition: lx.h:140
static const TStr EolnStr
Definition: lx.h:95
TLxSym GetSym(const TLxSym &Sym1, const TLxSym &Sym2)
Definition: lx.h:173
Definition: lx.h:52
static TLxSym GetSSym(const TStr &Str)
Definition: lx.cpp:186
PSOut GetSOut(const char &SepCh)
Definition: lx.h:271
static TSecTm LoadTxt(TILx &Lx)
Definition: tm.cpp:950
void Save(TSOut &)
Definition: lx.h:118
Definition: lx.h:56
void PutTab() const
Definition: lx.h:301
static const TStr SemicolonStr
Definition: lx.h:72
Definition: lx.h:46
Definition: lx.h:50
int SymLnN
Definition: lx.h:112
static const TStr UndefStr
Definition: lx.h:58
Definition: dt.h:412
Definition: lx.h:52
static const TStr NEqStr
Definition: lx.h:84
static void Execute(const TStr &InFNm, const TStr &OutFNm, const TStr &InSubstFNm, const TStrV &SubstKeyIdV)
Definition: lx.h:373
static const TStr DColonStr
Definition: lx.h:71
int LnChN
Definition: lx.h:135
Definition: lx.h:249
int PutStr(const char *CStr)
Definition: fl.cpp:117
bool IsTerm(const char &Ch) const
Definition: lx.h:26
TLxSym PrevSym
Definition: lx.h:261
Definition: lx.h:362
Definition: lx.h:52
static const TStr LEqStr
Definition: lx.h:87
TIntStrH RwSymH
Definition: lx.h:260
static TStr GetSymStr(const TLxSym &Sym)
Definition: lx.cpp:142
Definition: lx.h:46
static const TStr LnStr
Definition: lx.h:59
PLxChDef ChDef
Definition: lx.h:131
void GetVarBoolV(const TStr &VarNm, TBoolV &BoolV, const bool &NewLn=true)
Definition: lx.cpp:632
static const TStr StrStr
Definition: lx.h:64
static TStr GetStr(const bool &Val)
Definition: dt.h:1011
static const TStr IdStrStr
Definition: lx.h:65
int Int
Definition: lx.h:151
void PutStr(const TStr &Str)
Definition: lx.h:283
void PutVarEnd(const bool &RBracket=false, const bool &NewLn=false)
Definition: lx.h:315
bool IsCsSens
Definition: lx.h:257
static PLxChDef Load(TSIn &SIn)
Definition: lx.h:19
TStr GetStrToEolnAndCh(const char &ToCh)
Definition: lx.cpp:561
Definition: lx.h:47
int SymChN
Definition: lx.h:152
bool Bool
Definition: lx.h:111
TStr UcStr
Definition: lx.h:110
Definition: lx.h:46
TStr GetStr() const
Definition: dt.h:1462
Definition: lx.h:5
Definition: lx.h:248
Definition: lx.h:45
char Ch
Definition: lx.h:364
Definition: lx.h:52
int SymChN
Definition: lx.h:112
static const TStr PeriodStr
Definition: lx.h:67
virtual char GetCh()=0
THash< TStr, TStrPrV > SubstIdToKeyIdValPrVH
Definition: lx.h:365
TStr GetFPosStr() const
Definition: lx.cpp:607
void PutVarInt(const TStr &VarNm, const int &Int, const bool &NewLn=true, const bool &CheckIdStr=true)
Definition: lx.h:324
Definition: lx.h:127
static const TStr MinusStr
Definition: lx.h:74
Definition: lx.h:248
static const TStr GEqStr
Definition: lx.h:88
void PutVarStr(const TStr &VarNm, const TStr &Str, const bool &NewLn=true, const bool &CheckIdStr=true)
Definition: lx.h:334
TLxSym Sym
Definition: lx.h:109
static const TStr RBracketStr
Definition: lx.h:92
void PutQStr(const TChA &ChA)
Definition: lx.h:291
Definition: lx.h:46
char GetChX()
Definition: lx.h:147
Definition: lx.h:45
TChA CmtStr
Definition: lx.h:150
Definition: dt.h:974
Definition: lx.h:249
bool IsNmStr(const TStr &Str) const
Definition: lx.cpp:63
static const TStr TabStr
Definition: lx.h:60
Definition: lx.h:125
Definition: lx.h:46
Definition: lx.h:48
Definition: lx.h:50
void PutVarIntV(const TStr &VarNm, const TIntV &IntV, const bool &NewLn=true, const bool &CheckIdStr=true)
Definition: lx.cpp:772
double Flt
Definition: lx.h:151
void PutVarStrV(const TStr &VarNm, const TStrV &StrV, const bool &NewLn=true, const bool &CheckIdStr=true)
Definition: lx.cpp:794
static const TStr LParenStr
Definition: lx.h:89
void Save(TSOut &SOut)
Definition: lx.h:20
static const TStr RParenStr
Definition: lx.h:90
TStr CmtStr
Definition: lx.h:110
void PutVarFltV(const TStr &VarNm, const TFltV &FltV, const bool &NewLn=true, const bool &CheckIdStr=true)
Definition: lx.cpp:783
Definition: lx.h:127
Definition: lx.h:53
Definition: lx.h:126
TLxChDef(TSIn &SIn)
Definition: lx.h:18
Definition: lx.h:53
static const TStr AmpersandStr
Definition: lx.h:80
void PutIdStr(const TStr &Str, const bool &CheckIdStr=true)
Definition: lx.h:286
TStrIntH RwStrH
Definition: lx.h:259