SNAP Library , Developer Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <lx.h>
Public Member Functions | |
TILx (const PSIn &_SIn, const TFSet &OptSet=TFSet(), const TLxChDefTy &ChDefTy=lcdtUsAscii) | |
TILx & | operator= (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 |
TSIn & | RSIn |
char | PrevCh |
char | Ch |
int | LnN |
int | LnChN |
int | ChN |
TSStack< TILxSymSt > | PrevSymStStack |
TStrIntH | RwStrH |
bool | IsCmtAlw |
bool | IsRetEoln |
bool | IsSigNum |
bool | IsUniStr |
bool | IsCsSens |
bool | IsExcept |
bool | IsTabSep |
bool | IsList |
TILx::TILx | ( | const PSIn & | _SIn, |
const TFSet & | OptSet = TFSet() , |
||
const TLxChDefTy & | ChDefTy = lcdtUsAscii |
||
) |
Definition at line 270 of file lx.cpp.
References iloMx, TFSet::In(), and SetOpt().
: ChDef(TLxChDef::GetChDef(ChDefTy)), SIn(_SIn), RSIn(*SIn), PrevCh(' '), Ch(' '), LnN(0), LnChN(0-1), ChN(0-1), PrevSymStStack(), RwStrH(50), IsCmtAlw(false), IsRetEoln(false), IsSigNum(false), IsUniStr(false), IsCsSens(false), IsExcept(false), IsTabSep(false), IsList(false), Sym(syUndef), Str(), UcStr(), CmtStr(), Bool(false), Int(0), Flt(0), SymLnN(-1), SymLnChN(-1), SymChN(-1){ for (int Opt=0; Opt<iloMx; Opt++){ if (OptSet.In(Opt)){SetOpt(Opt, true);}} }
TLxSym TILx::AddRw | ( | const TStr & | Str | ) |
Definition at line 300 of file lx.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), ChDef, TLxChDef::GetUcStr(), IAssert, THash< TKey, TDat, THashFunc >::IsKey(), THash< TKey, TDat, THashFunc >::Len(), RwStrH, syMnRw, syMxRw, and UcStr.
{ IAssert(RwStrH.Len()<syMxRw-syMnRw+1); TStr UcStr=ChDef->GetUcStr(Str); IAssert(!RwStrH.IsKey(UcStr)); TLxSym RwSym=TLxSym(syMnRw+RwStrH.Len()); RwStrH.AddDat(Str, TInt(int(RwSym))); return RwSym; }
bool TILx::GetBool | ( | ) | [inline] |
char TILx::GetCh | ( | ) | [inline, private] |
Definition at line 140 of file lx.h.
References Assert, Ch, ChN, TSIn::Eof(), TCh::EofCh, TSIn::GetCh(), IsList, LnChN, PrevCh, and RSIn.
Referenced by GetSIn(), GetStrToCh(), GetStrToEoln(), GetStrToEolnAndCh(), GetStrToEolnOrCh(), GetSym(), and SkipToEoln().
{ Assert(Ch!=TCh::EofCh); PrevCh=Ch; LnChN++; ChN++; Ch=((RSIn.Eof()) ? TCh::EofCh : RSIn.GetCh()); if (IsList){putchar(Ch);} return Ch; }
char TILx::GetChX | ( | ) | [inline, private] |
void TILx::GetEoln | ( | ) | [inline] |
Definition at line 189 of file lx.h.
References GetSym(), and syEoln.
Referenced by GetVar(), GetVarBool(), GetVarBoolV(), GetVarEnd(), GetVarFlt(), GetVarFltV(), GetVarInt(), GetVarIntV(), GetVarSecTm(), GetVarStr(), GetVarStrPrV(), GetVarStrV(), and GetVarStrVV().
double TILx::GetFlt | ( | ) | [inline] |
TStr TILx::GetFPosStr | ( | ) | const |
Definition at line 595 of file lx.cpp.
References TSBase::GetSNm(), GetStr(), LnChN, LnN, and SIn.
Referenced by GetSym().
{ TChA ChA; ChA+="File:"; ChA+=SIn->GetSNm(); ChA+=" Line:"; ChA+=TInt::GetStr(LnN+1); ChA+=" Char:"; ChA+=TInt::GetStr(LnChN); return ChA; }
TStr TILx::GetIdStr | ( | const TStr & | IdStr = TStr() | ) | [inline] |
Definition at line 185 of file lx.h.
References GetSym(), IAssert, Str, and syIdStr.
Referenced by GetVar(), GetVarBool(), GetVarFlt(), GetVarInt(), GetVarSecTm(), GetVarStr(), TPpTag::LoadTxt(), and TPp::LoadTxt().
int TILx::GetInt | ( | ) | [inline] |
Definition at line 181 of file lx.h.
References GetSym(), Int, and syInt.
Referenced by GetVarInt(), TPpVal::LoadTxt(), TRnd::LoadTxt(), and TSecTm::LoadTxt().
int TILx::GetLnN | ( | ) | const [inline] |
void TILx::GetLnV | ( | const TStr & | FNm, |
TStrV & | LnV | ||
) | [static] |
Definition at line 675 of file lx.cpp.
References TVec< TVal >::Add(), Ch, TChA::Clr(), TVec< TVal >::Clr(), TCh::CrCh, TChA::Empty(), TFIn::Eof(), TFIn::GetCh(), TCh::LfCh, PrevCh, and SIn.
{ TFIn SIn(FNm); LnV.Clr(); TChA Ln; if (!SIn.Eof()){ char Ch=SIn.GetCh(); while (!SIn.Eof()){ if ((Ch==TCh::CrCh)||(Ch==TCh::LfCh)){ if (!SIn.Eof()){ char PrevCh=Ch; Ch=SIn.GetCh(); if (!SIn.Eof()){ if (PrevCh==TCh::CrCh){if (Ch==TCh::LfCh){Ch=SIn.GetCh();}} else if (PrevCh==TCh::LfCh){if (Ch==TCh::CrCh){Ch=SIn.GetCh();}} } } LnV.Add(Ln); Ln.Clr(); } else { Ln+=Ch; Ch=SIn.GetCh(); } } if (!Ln.Empty()){ LnV.Add(Ln);} } }
TStr TILx::GetQStr | ( | const TStr & | QStr = TStr() | ) | [inline] |
Definition at line 187 of file lx.h.
References GetSym(), IAssert, Str, and syQStr.
Referenced by GetVarStr(), GetVarStrPrV(), TPpVal::LoadTxt(), and TPp::LoadTxt().
TStr TILx::GetQStr | ( | const TStr & | Str, |
const bool & | QuoteP, | ||
const char & | QuoteCh | ||
) | [static] |
Definition at line 603 of file lx.cpp.
References Ch, ChN, TStr::CStr(), TStr::Len(), QuoteCh, and Str.
{ if (QuoteP){ TChA ChA; ChA+=QuoteCh; int StrLen=Str.Len(); for (int ChN=0; ChN<StrLen; ChN++){ char Ch=Str.CStr()[ChN]; if (Ch==QuoteCh){ChA+=QuoteCh; ChA+=QuoteCh;} else {ChA+=Ch;} } ChA+=QuoteCh; return ChA; } else { return Str; } }
TLxSym TILx::GetRw | ( | const TStr & | Str | ) | [inline] |
PSIn TILx::GetSIn | ( | const char & | SepCh | ) |
Definition at line 309 of file lx.cpp.
References Ch, TSStack< TVal >::Empty(), TCh::EofCh, GetCh(), IAssert, PrevSymStStack, and SIn.
{ IAssert(PrevSymStStack.Empty()); while ((Ch!=TCh::EofCh)&&(Ch!=SepCh)){GetCh();} return SIn; }
TStr TILx::GetStr | ( | const TStr & | _Str = TStr() | ) | [inline] |
TStr TILx::GetStrToCh | ( | const char & | ToCh | ) |
Definition at line 527 of file lx.cpp.
References TChA::AddCh(), Ch, ChDef, TChA::Clr(), TCh::EofCh, GetCh(), TLxChDef::GetUc(), Str, Sym, syStr, and UcStr.
{ Sym=syStr; Str.Clr(); UcStr.Clr(); while ((Ch!=ToCh)&&(Ch!=TCh::EofCh)){ Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();} return Str; }
TStr TILx::GetStrToEoln | ( | const bool & | DoTrunc = false | ) |
Definition at line 541 of file lx.cpp.
References TChA::AddCh(), Ch, ChDef, TChA::Clr(), TCh::CrCh, TCh::EofCh, GetCh(), TLxChDef::GetUc(), TCh::LfCh, Str, Sym, syStr, TChA::ToTrunc(), and UcStr.
{ Sym=syStr; Str.Clr(); UcStr.Clr(); while ((Ch!=TCh::CrCh)&&(Ch!=TCh::LfCh)&&(Ch!=TCh::EofCh)){ Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();} if (DoTrunc){Str.ToTrunc(); UcStr.ToTrunc();} return Str; }
TStr TILx::GetStrToEolnAndCh | ( | const char & | ToCh | ) |
Definition at line 549 of file lx.cpp.
References TChA::AddCh(), Ch, ChDef, ChN, TChA::Clr(), TCh::CrCh, TCh::EofCh, forever, GetCh(), TLxChDef::GetUc(), IsBof(), TCh::LfCh, PrevCh, Str, Sym, syStr, and UcStr.
{ Sym=syStr; Str.Clr(); UcStr.Clr(); if (IsBof()){GetCh();} forever { if (Ch==TCh::EofCh){break;} if (((ChN==0)||(PrevCh==TCh::CrCh)||(PrevCh==TCh::LfCh))&&(Ch==ToCh)){ GetCh(); break;} else {Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();} } return Str; }
TStr TILx::GetStrToEolnOrCh | ( | const char & | ToCh | ) |
Definition at line 534 of file lx.cpp.
References TChA::AddCh(), Ch, ChDef, TChA::Clr(), TCh::CrCh, TCh::EofCh, GetCh(), TLxChDef::GetUc(), TCh::LfCh, Str, Sym, syStr, and UcStr.
{ Sym=syStr; Str.Clr(); UcStr.Clr(); while ((Ch!=ToCh)&&(Ch!=TCh::CrCh)&&(Ch!=TCh::LfCh)&&(Ch!=TCh::EofCh)){ Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();} return Str; }
TLxSym TILx::GetSym | ( | const TFSet & | Expect | ) |
Definition at line 315 of file lx.cpp.
References TChA::AddCh(), Bool, Ch, ChDef, ChN, TChA::Clr(), CmtStr, TCh::CrCh, TChA::CStr(), TFSet::Empty(), THash< TKey, TDat, THashFunc >::Empty(), TSStack< TVal >::Empty(), TCh::EofCh, Fail, Flt, forever, GetCh(), GetFPosStr(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetSym(), GetSymStr(), TLxChDef::GetUc(), TBool::GetValFromStr(), IAssert, TFSet::In(), Int, TLxChDef::IsAlNum(), TLxChDef::IsAlpha(), IsBof(), IsCmtAlw, IsCsSens, IsExcept, TLxChDef::IsNum(), IsRetEoln, IsSigNum, TLxChDef::IsSpace(), IsTabSep, TLxChDef::IsTerm(), IsUniStr, TBool::IsValStr(), TCh::LfCh, LnChN, LnN, TChA::Pop(), TSStack< TVal >::Pop(), PrevSymStStack, QuoteCh, QuoteP, TILxSymSt::Restore(), RwStrH, Str, syAmpersand, syAsterisk, syBool, syColon, syComma, syDColon, syDPeriod, syEof, syEoln, syEq, syExclamation, syFlt, syGEq, syGtr, syHash, syIdStr, syInt, syLBrace, syLBracket, syLEq, syLn, syLParen, syLss, Sym, SymChN, syMinus, SymLnChN, SymLnN, syNEq, syPercent, syPeriod, syPlus, syQStr, syQuestion, syRBrace, syRBracket, syRParen, sySemicolon, sySlash, syStr, syTab, syUndef, syVBar, TCh::TabCh, TSStack< TVal >::Top(), TChA::Trunc(), and UcStr.
Referenced by TJsonVal::GetValFromLx(), TJsonVal::GetValFromStr(), TExp::LoadAndEvalExpL(), TLAMisc::LoadMatlabTFltVV(), TPpVal::LoadTxt(), TPp::LoadTxt(), TExp::LoadTxt(), TExp::LoadTxtAddExp(), TExp::LoadTxtExp(), TExp::LoadTxtFact(), TExp::LoadTxtMulExp(), and TExp::LoadTxtRelExp().
{ CmtStr.Clr(); if (!PrevSymStStack.Empty()){ // symbols already on the stack PrevSymStStack.Top().Restore(*this); PrevSymStStack.Pop(); } else if (Expect.In(syLn)){ // symbol is the whole line string if (Ch==TCh::EofCh){ Sym=syEof; } else { Str.Clr(); if (IsBof()){GetCh();} while (!ChDef->IsTerm(Ch)){Str.AddCh(Ch); GetCh();} bool _IsRetEoln=IsRetEoln; IsRetEoln=true; GetSym(TFSet()|syEoln|syEof); Sym=syLn; IsRetEoln=_IsRetEoln; } } else if (IsTabSep){ // symbol is between tab characters if (IsBof()){GetCh();} if (Ch==TCh::TabCh){ // tab character Sym=syTab; GetCh(); } else if (ChDef->IsTerm(Ch)){ // eoln & eof characters bool _IsRetEoln=IsRetEoln; IsRetEoln=true; IsTabSep=false; GetSym(TFSet()|syEoln|syEof); IsRetEoln=_IsRetEoln; IsTabSep=true; } else { Str.Clr(); while ((!ChDef->IsTerm(Ch))&&(Ch!=TCh::TabCh)){ Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();} Sym=syStr; QuoteP=false; } } else { // usual symbol while (ChDef->IsSpace(Ch)){GetCh();} SymLnN=LnN; SymLnChN=LnChN; SymChN=ChN; if (ChDef->IsAlpha(Ch)){ if (IsUniStr){Sym=syStr;} else {Sym=syIdStr;} Str.Clr(); UcStr.Clr(); QuoteP=false; do {Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch));} while (ChDef->IsAlNum(GetCh())); if (!RwStrH.Empty()){ TStr RwStr=Str; if (!IsCsSens){RwStr=UcStr;} int SymKeyId=RwStrH.GetKeyId(RwStr); if (SymKeyId!=-1){Sym=TLxSym(int(RwStrH[SymKeyId]));} } if (Expect.In(syBool)){ Sym=syBool; IAssert(TBool::IsValStr(Str)); Bool=TBool::GetValFromStr(Str); } } else if ((Ch=='"')||(Ch=='\'')){ if (IsUniStr){Sym=syStr;} else {Sym=syQStr;} Str.Clr(); UcStr.Clr(); QuoteP=true; QuoteCh=Ch; GetCh(); forever{ while ((Ch!=QuoteCh)&&(Ch!='\\')&&(Ch!=TCh::EofCh)){ Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh();} if (Ch==TCh::EofCh){ Sym=syUndef; break; } else if (Ch==QuoteCh){ GetCh(); break; } else { GetCh(); switch (Ch){ case '"': Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break; case '\'': Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break; case '/': Str.AddCh(Ch); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break; case 'b': Str.AddCh('\b'); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break; case 'f': Str.AddCh('\f'); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break; case 'n': Str.AddCh('\n'); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break; case 'r': Str.AddCh('\r'); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break; case 't': Str.AddCh('\t'); UcStr.AddCh(ChDef->GetUc(Ch)); GetCh(); break; case 'u': // needs unicode support to be JSON compatible - now it replaces the code with blank GetCh(); GetCh(); GetCh(); Str.AddCh(' '); UcStr.AddCh(ChDef->GetUc(' ')); GetCh(); break; default: Sym=syUndef; break; } if (Sym==syUndef){ throw PExcept(new TExcept("Invalid Escape Sequence in Quoted String"));} } } } else if ((ChDef->IsNum(Ch))||(IsSigNum&&((Ch=='+')||(Ch=='-')))){ Str.Clr(); bool IntP=true; do {Str.AddCh(Ch);} while (ChDef->IsNum(GetCh())); if (Expect.In(syFlt)){ if (Ch=='.'){ Str.AddCh(Ch); IntP=false; while (ChDef->IsNum(GetCh())){Str.AddCh(Ch);} } if ((Ch=='e')||(Ch=='E')){ Str.AddCh(Ch); GetCh(); IntP=false; if ((Ch=='+')||(Ch=='-')){Str.AddCh(Ch); GetCh();} while (ChDef->IsNum(Ch)){Str.AddCh(Ch); GetCh();} } } UcStr=Str; if (IntP&&(Expect.In(syInt))){ Sym=syInt; Int=atoi(Str.CStr()); } else { Sym=syFlt; Flt=atof(Str.CStr()); } } else if ((Ch==TCh::CrCh)||(Ch==TCh::LfCh)){ Sym=syEoln; if (Ch==TCh::CrCh){if (GetCh()==TCh::LfCh){GetCh();}} else if (Ch==TCh::LfCh){if (GetCh()==TCh::CrCh){GetCh();}} LnN++; LnChN=0; if (!IsRetEoln){GetSym(Expect);} } else if (Ch=='/'){ GetCh(); if ((IsCmtAlw)&&(Ch=='/')){ TChA _CmtStr; do {_CmtStr+=GetCh();} while (!ChDef->IsTerm(Ch)); _CmtStr.Pop(); _CmtStr.Trunc(); if (Ch==TCh::CrCh){ if (GetCh()==TCh::LfCh){GetCh();} } else if (Ch==TCh::LfCh){ if (GetCh()==TCh::CrCh){GetCh();} } if (IsRetEoln){Sym=syEoln;} else {GetSym(Expect);} CmtStr=_CmtStr; } else if (Ch=='*'){ TChA _CmtStr; do { while (GetCh()!='*'){_CmtStr+=Ch;} _CmtStr+=GetCh(); } while (Ch!='/'); _CmtStr.Pop(); _CmtStr.Pop(); _CmtStr.Trunc(); GetCh(); GetSym(Expect); CmtStr=_CmtStr; } else { Sym=sySlash; } } else if (Ch==TCh::EofCh){ Sym=syEof; } else { switch (Ch){ case '.': if (GetCh()=='.'){Sym=syDPeriod; GetCh();} else {Sym=syPeriod;} break; case ',': Sym=syComma; GetCh(); break; case ':': if (GetCh()==':'){Sym=syDColon; GetCh();} else {Sym=syColon;} break; case ';': Sym=sySemicolon; GetCh(); break; case '+': Sym=syPlus; GetCh(); break; case '-': Sym=syMinus; GetCh(); break; case '*': Sym=syAsterisk; GetCh(); break; case '/': Sym=sySlash; GetCh(); break; case '%': Sym=syPercent; GetCh(); break; case '!': Sym=syExclamation; GetCh(); break; case '|': Sym=syVBar; GetCh(); break; case '&': Sym=syAmpersand; GetCh(); break; case '=': Sym=syEq; GetCh(); break; case '<': GetCh(); if (Ch=='='){Sym=syLEq; GetCh();} else if (Ch=='>'){Sym=syNEq; GetCh();} else {Sym=syLss;} break; case '>': if (GetCh()=='='){Sym=syGEq; GetCh();} else {Sym=syGtr;} break; case '?': Sym=syQuestion; GetCh(); break; case '#': if (IsCmtAlw){ TChA _CmtStr; do {_CmtStr+=GetCh();} while (!ChDef->IsTerm(Ch)); _CmtStr.Pop(); _CmtStr.Trunc(); if (Ch==TCh::CrCh){ if (GetCh()==TCh::LfCh){GetCh();} } else if (Ch==TCh::LfCh){ if (GetCh()==TCh::CrCh){GetCh();} } if (IsRetEoln){Sym=syEoln;} else {GetSym(Expect);} CmtStr=_CmtStr; } else { Sym=syHash; GetCh(); } break; case '(': Sym=syLParen; GetCh(); break; case ')': Sym=syRParen; GetCh(); break; case '[': Sym=syLBracket; GetCh(); break; case ']': Sym=syRBracket; GetCh(); break; case '{': Sym=syLBrace; GetCh(); break; case '}': Sym=syRBrace; GetCh(); break; default: Sym=syUndef; GetCh(); break; } } } if ((!Expect.In(Sym))&&(!Expect.Empty())){ if (IsExcept){ TStr MsgStr= TStr("Unexpected symbol (")+GetSymStr()+") ["+GetFPosStr()+"]"; throw PExcept(new TExcept(MsgStr)); } else { Fail; } } return Sym; }
TLxSym TILx::GetSym | ( | ) | [inline] |
Definition at line 171 of file lx.h.
References GetSym().
Referenced by GetBool(), GetEoln(), GetFlt(), GetIdStr(), GetInt(), GetQStr(), GetStr(), GetSym(), GetVar(), GetVarBool(), GetVarBoolV(), GetVarEnd(), GetVarFlt(), GetVarFltV(), GetVarInt(), GetVarIntV(), GetVarSecTm(), GetVarStr(), GetVarStrPrV(), GetVarStrV(), GetVarStrVV(), IsVar(), PeekSym(), and SkipToSym().
TLxSym TILx::GetSym | ( | const TLxSym & | Sym | ) | [inline] |
TLxSym TILx::GetSym | ( | const TLxSym & | Sym1, |
const TLxSym & | Sym2 | ||
) | [inline] |
TLxSym TILx::GetSym | ( | const TLxSym & | Sym1, |
const TLxSym & | Sym2, | ||
const TLxSym & | Sym3 | ||
) | [inline] |
TStr TILx::GetSymStr | ( | ) | const |
Definition at line 582 of file lx.cpp.
References Str, syFlt, syIdStr, syInt, Sym, syMnRw, syMxRw, syQStr, and syStr.
Referenced by GetSym().
{ switch (Sym){ case syInt: return Str; case syFlt: return Str; case syStr: return Str; case syIdStr: return Str; case syQStr: return Str; default: if ((syMnRw<=Sym)&&(Sym<=syMxRw)){return Str;} else {return TLxSymStr::GetSymStr(Sym);} } }
void TILx::GetVar | ( | const TStr & | VarNm, |
const bool & | LBracket = false , |
||
const bool & | NewLn = false |
||
) | [inline] |
Definition at line 209 of file lx.h.
References GetEoln(), GetIdStr(), GetSym(), syColon, and syLBracket.
Referenced by GetVarBoolV(), GetVarFltV(), GetVarIntV(), GetVarStrPrV(), GetVarStrV(), GetVarStrVV(), and TPp::LoadTxt().
bool TILx::GetVarBool | ( | const TStr & | VarNm, |
const bool & | NewLn = true |
||
) | [inline] |
void TILx::GetVarBoolV | ( | const TStr & | VarNm, |
TBoolV & | BoolV, | ||
const bool & | NewLn = true |
||
) |
Definition at line 620 of file lx.cpp.
References TVec< TVal >::Add(), Bool, TVec< TVal >::Clr(), GetEoln(), GetSym(), GetVar(), syBool, syQStr, and syRBracket.
{ BoolV.Clr(); GetVar(VarNm, true, NewLn); while (GetSym(syRBracket, syBool)==syQStr){ BoolV.Add(Bool); if (NewLn){GetEoln();}} if (NewLn){GetEoln();} }
void TILx::GetVarEnd | ( | const bool & | RBracket = false , |
const bool & | NewLn = false |
||
) | [inline] |
Definition at line 213 of file lx.h.
References GetEoln(), GetSym(), and syRBracket.
{ if (RBracket){GetSym(syRBracket);} if (NewLn){GetEoln();}}
double TILx::GetVarFlt | ( | const TStr & | VarNm, |
const bool & | NewLn = true |
||
) | [inline] |
void TILx::GetVarFltV | ( | const TStr & | VarNm, |
TFltV & | FltV, | ||
const bool & | NewLn = true |
||
) |
Definition at line 636 of file lx.cpp.
References TVec< TVal >::Add(), TVec< TVal >::Clr(), Flt, GetEoln(), GetSym(), GetVar(), syFlt, and syRBracket.
{ FltV.Clr(); GetVar(VarNm, true, NewLn); while (GetSym(syRBracket, syFlt)==syFlt){ FltV.Add(Flt); if (NewLn){GetEoln();}} if (NewLn){GetEoln();} }
int TILx::GetVarInt | ( | const TStr & | VarNm, |
const bool & | NewLn = true |
||
) | [inline] |
Definition at line 222 of file lx.h.
References GetEoln(), GetIdStr(), GetInt(), GetSym(), Int, and syColon.
Referenced by TMBlobBs::LoadMain().
void TILx::GetVarIntV | ( | const TStr & | VarNm, |
TIntV & | IntV, | ||
const bool & | NewLn = true |
||
) |
Definition at line 628 of file lx.cpp.
References TVec< TVal >::Add(), TVec< TVal >::Clr(), GetEoln(), GetSym(), GetVar(), Int, syInt, and syRBracket.
{ IntV.Clr(); GetVar(VarNm, true, NewLn); while (GetSym(syRBracket, syInt)==syInt){ IntV.Add(Int); if (NewLn){GetEoln();}} if (NewLn){GetEoln();} }
TSecTm TILx::GetVarSecTm | ( | const TStr & | VarNm, |
const bool & | NewLn = true |
||
) | [inline] |
Definition at line 231 of file lx.h.
References GetEoln(), GetIdStr(), GetSym(), TSecTm::LoadTxt(), and syColon.
{ GetIdStr(VarNm); GetSym(syColon); TSecTm SecTm=TSecTm::LoadTxt(*this); if (NewLn){GetEoln();} return SecTm;}
TStr TILx::GetVarStr | ( | const TStr & | VarNm, |
const bool & | NewLn = true |
||
) | [inline] |
Definition at line 228 of file lx.h.
References GetEoln(), GetIdStr(), GetQStr(), GetSym(), Str, and syColon.
Referenced by TMBlobBs::LoadMain().
void TILx::GetVarStrPrV | ( | const TStr & | VarNm, |
TStrPrV & | StrPrV, | ||
const bool & | NewLn = true |
||
) |
Definition at line 652 of file lx.cpp.
References TVec< TVal >::Add(), TVec< TVal >::Clr(), GetEoln(), GetQStr(), GetSym(), GetVar(), syLBracket, and syRBracket.
{ StrPrV.Clr(); GetVar(VarNm, true, NewLn); while (GetSym(syRBracket, syLBracket)==syLBracket){ TStr Str1=GetQStr(); TStr Str2=GetQStr(); GetSym(syRBracket); StrPrV.Add(TStrPr(Str1, Str2)); if (NewLn){GetEoln();} } if (NewLn){GetEoln();} }
void TILx::GetVarStrV | ( | const TStr & | VarNm, |
TStrV & | StrV, | ||
const bool & | NewLn = true |
||
) |
Definition at line 644 of file lx.cpp.
References TVec< TVal >::Add(), TVec< TVal >::Clr(), GetEoln(), GetSym(), GetVar(), Str, syQStr, and syRBracket.
{ StrV.Clr(); GetVar(VarNm, true, NewLn); while (GetSym(syRBracket, syQStr)==syQStr){ StrV.Add(Str); if (NewLn){GetEoln();}} if (NewLn){GetEoln();} }
void TILx::GetVarStrVV | ( | const TStr & | VarNm, |
TVec< TStrV > & | StrVV, | ||
const bool & | NewLn = true |
||
) |
Definition at line 663 of file lx.cpp.
References TVec< TVal >::Add(), TVec< TVal >::Clr(), GetEoln(), GetSym(), GetVar(), TVec< TVal >::Last(), Str, syLBracket, syQStr, and syRBracket.
{ StrVV.Clr(); GetVar(VarNm, true, NewLn); while (GetSym(syRBracket, syLBracket)==syLBracket){ StrVV.Add(); while (GetSym(syQStr, syRBracket)==syQStr){ StrVV.Last().Add(Str);} if (NewLn){GetEoln();} } if (NewLn){GetEoln();} }
bool TILx::IsBof | ( | ) | const [inline] |
bool TILx::IsEof | ( | ) | const [inline] |
bool TILx::IsVar | ( | const TStr & | VarNm | ) | [inline] |
TLxSym TILx::PeekSym | ( | ) | [inline] |
Definition at line 200 of file lx.h.
References GetSym(), and PutSym().
Referenced by TPpVal::LoadTxt(), TPp::LoadTxt(), and PeekVarEnd().
TLxSym TILx::PeekSym | ( | const int & | Syms | ) |
Definition at line 568 of file lx.cpp.
References TSStack< TVal >::Empty(), GetSym(), TSStack< TVal >::Pop(), TSStack< TVal >::Push(), PutSym(), TILxSymSt::Restore(), Sym, and TSStack< TVal >::Top().
{ TILxSymSt CurSymSt(*this); TSStack<TILxSymSt> SymStStack; for (int SymN=0; SymN<Syms; SymN++){ GetSym(); SymStStack.Push(TILxSymSt(*this));} TLxSym PeekedSym=Sym; while (!SymStStack.Empty()){ SymStStack.Top().Restore(*this); SymStStack.Pop(); PutSym(); } CurSymSt.Restore(*this); return PeekedSym; }
bool TILx::PeekVarEnd | ( | const bool & | RBracket = false , |
const bool & | NewLn = false |
||
) | [inline] |
void TILx::PutSym | ( | const TILxSymSt & | SymSt | ) | [inline] |
Definition at line 198 of file lx.h.
References PrevSymStStack, and TSStack< TVal >::Push().
{PrevSymStStack.Push(TILxSymSt(SymSt));}
void TILx::PutSym | ( | ) | [inline] |
Definition at line 199 of file lx.h.
References PrevSymStStack, and TSStack< TVal >::Push().
Referenced by IsVar(), and PeekSym().
{PrevSymStStack.Push(TILxSymSt(*this));}
void TILx::SetOpt | ( | const int & | Opt, |
const bool & | Val | ||
) |
Definition at line 286 of file lx.cpp.
References Fail, iloCmtAlw, iloCsSens, iloExcept, iloList, iloRetEoln, iloSigNum, iloTabSep, iloUniStr, IsCmtAlw, IsCsSens, IsExcept, IsList, IsRetEoln, IsSigNum, IsTabSep, and IsUniStr.
Referenced by TILx().
{ switch (Opt){ case iloCmtAlw: IsCmtAlw=Val; break; case iloRetEoln: IsRetEoln=Val; break; case iloSigNum: IsSigNum=Val; break; case iloUniStr: IsUniStr=Val; break; case iloCsSens: IsCsSens=Val; break; case iloExcept: IsExcept=Val; break; case iloTabSep: IsTabSep=Val; break; case iloList: IsList=Val; break; default: Fail; } }
void TILx::SkipToEoln | ( | ) |
Definition at line 561 of file lx.cpp.
References Ch, TCh::CrCh, TCh::EofCh, GetCh(), and TCh::LfCh.
{ while ((Ch!=TCh::CrCh)&&(Ch!=TCh::LfCh)&&(Ch!=TCh::EofCh)){ GetCh();} if (Ch==TCh::CrCh){if (GetCh()==TCh::LfCh){GetCh();}} else if (Ch==TCh::LfCh){if (GetCh()==TCh::CrCh){GetCh();}} }
void TILx::SkipToSym | ( | const TLxSym & | SkipToSym | ) | [inline] |
bool TILx::Bool |
Definition at line 151 of file lx.h.
Referenced by GetBool(), GetSym(), GetVarBool(), GetVarBoolV(), and TILxSymSt::Restore().
char TILx::Ch [private] |
Definition at line 134 of file lx.h.
Referenced by GetCh(), GetChX(), GetLnV(), GetQStr(), GetSIn(), GetStrToCh(), GetStrToEoln(), GetStrToEolnAndCh(), GetStrToEolnOrCh(), GetSym(), IsEof(), and SkipToEoln().
PLxChDef TILx::ChDef [private] |
Definition at line 131 of file lx.h.
Referenced by AddRw(), GetStrToCh(), GetStrToEoln(), GetStrToEolnAndCh(), GetStrToEolnOrCh(), and GetSym().
int TILx::ChN [private] |
Definition at line 150 of file lx.h.
Referenced by GetSym(), and TILxSymSt::Restore().
double TILx::Flt |
Definition at line 151 of file lx.h.
Referenced by GetFlt(), GetSym(), TJsonVal::GetValFromLx(), GetVarFlt(), GetVarFltV(), TLAMisc::LoadMatlabTFltVV(), TExp::LoadTxtFact(), and TILxSymSt::Restore().
int TILx::Int |
Definition at line 151 of file lx.h.
Referenced by GetInt(), GetSym(), GetVarInt(), GetVarIntV(), and TILxSymSt::Restore().
bool TILx::IsCmtAlw [private] |
bool TILx::IsCsSens [private] |
bool TILx::IsExcept [private] |
bool TILx::IsList [private] |
bool TILx::IsRetEoln [private] |
bool TILx::IsSigNum [private] |
bool TILx::IsTabSep [private] |
bool TILx::IsUniStr [private] |
int TILx::LnChN [private] |
Definition at line 135 of file lx.h.
Referenced by GetCh(), GetFPosStr(), and GetSym().
int TILx::LnN [private] |
Definition at line 135 of file lx.h.
Referenced by GetFPosStr(), GetLnN(), and GetSym().
char TILx::PrevCh [private] |
Definition at line 134 of file lx.h.
Referenced by GetCh(), GetLnV(), and GetStrToEolnAndCh().
TSStack<TILxSymSt> TILx::PrevSymStStack [private] |
char TILx::QuoteCh |
bool TILx::QuoteP |
TSIn& TILx::RSIn [private] |
TStrIntH TILx::RwStrH [private] |
Definition at line 132 of file lx.h.
Referenced by GetFPosStr(), GetLnV(), and GetSIn().
Definition at line 150 of file lx.h.
Referenced by GetIdStr(), GetQStr(), GetStr(), GetStrToCh(), GetStrToEoln(), GetStrToEolnAndCh(), GetStrToEolnOrCh(), GetSym(), GetSymStr(), TJsonVal::GetValFromLx(), GetVarStr(), GetVarStrV(), GetVarStrVV(), IsVar(), TExp::LoadTxtFact(), and TILxSymSt::Restore().
Definition at line 149 of file lx.h.
Referenced by GetStrToCh(), GetStrToEoln(), GetStrToEolnAndCh(), GetStrToEolnOrCh(), GetSym(), GetSymStr(), TJsonVal::GetValFromLx(), IsVar(), TExp::LoadAndEvalExpL(), TLAMisc::LoadMatlabTFltVV(), TExp::LoadTxtAddExp(), TExp::LoadTxtExp(), TExp::LoadTxtFact(), TExp::LoadTxtMulExp(), TExp::LoadTxtRelExp(), PeekSym(), TILxSymSt::Restore(), and SkipToSym().
int TILx::SymChN |
Definition at line 152 of file lx.h.
Referenced by GetSym(), and TILxSymSt::Restore().
int TILx::SymLnChN |
Definition at line 152 of file lx.h.
Referenced by GetSym(), and TILxSymSt::Restore().
int TILx::SymLnN |
Definition at line 152 of file lx.h.
Referenced by GetSym(), and TILxSymSt::Restore().
Definition at line 150 of file lx.h.
Referenced by AddRw(), GetStrToCh(), GetStrToEoln(), GetStrToEolnAndCh(), GetStrToEolnOrCh(), GetSym(), and TILxSymSt::Restore().