SNAP Library 2.2, Developer Reference  2014-03-11 19:15:55
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TILx Class Reference

#include <lx.h>

Collaboration diagram for TILx:

List of all members.

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.

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);}}
}

Here is the call graph for this function:


Member Function Documentation

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;
}

Here is the call graph for this function:

bool TILx::GetBool ( ) [inline]

Definition at line 180 of file lx.h.

References Bool, GetSym(), and syBool.

Referenced by GetVarBool(), and TPpVal::LoadTxt().

{GetSym(TFSet()|syBool); return Bool;}

Here is the call graph for this function:

Here is the caller graph for this function:

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;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

char TILx::GetChX ( ) [inline, private]

Definition at line 147 of file lx.h.

References Ch, and GetChX().

Referenced by GetChX().

{char Ch=GetChX(); printf("%c", Ch); return Ch;}

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

double TILx::GetFlt ( ) [inline]

Definition at line 182 of file lx.h.

References Flt, GetSym(), and syFlt.

Referenced by GetVarFlt(), and TPpVal::LoadTxt().

{GetSym(TFSet()|syFlt); return Flt;}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 607 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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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().

                                         {
    GetSym(TFSet()|syIdStr); IAssert(IdStr.Empty()||(IdStr==Str)); return Str;}

Here is the call graph for this function:

Here is the caller graph for this function:

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().

{GetSym(TFSet()|syInt); return Int;}

Here is the call graph for this function:

Here is the caller graph for this function:

int TILx::GetLnN ( ) const [inline]

Definition at line 166 of file lx.h.

References LnN.

{return LnN;}
void TILx::GetLnV ( const TStr FNm,
TStrV LnV 
) [static]

Definition at line 687 of file lx.cpp.

References TVec< TVal, TSizeTy >::Add(), Ch, TChA::Clr(), TVec< TVal, TSizeTy >::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);}
  }
}

Here is the call graph for this function:

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().

                                       {
    GetSym(TFSet()|syQStr); IAssert(QStr.Empty()||(Str==QStr)); return Str;}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TILx::GetQStr ( const TStr Str,
const bool &  QuoteP,
const char &  QuoteCh 
) [static]

Definition at line 615 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;
  }
}

Here is the call graph for this function:

TLxSym TILx::GetRw ( const TStr Str) [inline]

Definition at line 163 of file lx.h.

References THash< TKey, TDat, THashFunc >::GetDat(), and RwStrH.

                               {
    return TLxSym(int(RwStrH.GetDat(Str)));}

Here is the call graph for this function:

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;
}

Here is the call graph for this function:

TStr TILx::GetStr ( const TStr _Str = TStr()) [inline]

Definition at line 183 of file lx.h.

References GetSym(), IAssert, Str, and syStr.

Referenced by GetFPosStr().

                                      {
    GetSym(TFSet()|syStr); IAssert(_Str.Empty()||(_Str==Str)); return Str;}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TILx::GetStrToCh ( const char &  ToCh)

Definition at line 539 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;
}

Here is the call graph for this function:

TStr TILx::GetStrToEoln ( const bool &  DoTrunc = false)

Definition at line 553 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;
}

Here is the call graph for this function:

TStr TILx::GetStrToEolnAndCh ( const char &  ToCh)

Definition at line 561 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;
}

Here is the call graph for this function:

TStr TILx::GetStrToEolnOrCh ( const char &  ToCh)

Definition at line 546 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;
}

Here is the call graph for this function:

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(), EAssertR, TFSet::Empty(), THash< TKey, TDat, THashFunc >::Empty(), TSStack< TVal >::Empty(), TUnicode::EncodeUtf8(), TCh::EofCh, Fail, Flt, forever, GetCh(), GetFPosStr(), TCh::GetHex(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetSym(), GetSymStr(), TLxChDef::GetUc(), TBool::GetValFromStr(), IAssert, TFSet::In(), Int, TLxChDef::IsAlNum(), TLxChDef::IsAlpha(), IsBof(), IsCmtAlw, IsCsSens, IsExcept, TCh::IsHex(), 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::GetValFromSIn(), 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 '/': 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': {
              // unicode character, represented using 4 hexadecimal digits
              GetCh(); EAssertR(TCh::IsHex(Ch), "Invalid hexadecimal digit in unicode escape");
              int UChCd = TCh::GetHex(Ch);
              GetCh(); EAssertR(TCh::IsHex(Ch), "Invalid hexadecimal digit in unicode escape");
              UChCd = 16 * UChCd + TCh::GetHex(Ch);
              GetCh(); EAssertR(TCh::IsHex(Ch), "Invalid hexadecimal digit in unicode escape");
              UChCd = 16 * UChCd + TCh::GetHex(Ch);
              GetCh(); EAssertR(TCh::IsHex(Ch), "Invalid hexadecimal digit in unicode escape");
              UChCd = 16 * UChCd + TCh::GetHex(Ch);
              // get as UTF8 encoded characters
              TUnicode::EncodeUtf8(UChCd, Str);
                          TUnicode::EncodeUtf8(UChCd, UcStr); }
              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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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().

{return GetSym(TFSet());}

Here is the call graph for this function:

Here is the caller graph for this function:

TLxSym TILx::GetSym ( const TLxSym Sym) [inline]

Definition at line 172 of file lx.h.

References GetSym().

Referenced by GetSym().

{return GetSym(TFSet()|Sym);}

Here is the call graph for this function:

Here is the caller graph for this function:

TLxSym TILx::GetSym ( const TLxSym Sym1,
const TLxSym Sym2 
) [inline]

Definition at line 173 of file lx.h.

References GetSym().

                                                       {
    return GetSym(TFSet()|Sym1|Sym2);}

Here is the call graph for this function:

TLxSym TILx::GetSym ( const TLxSym Sym1,
const TLxSym Sym2,
const TLxSym Sym3 
) [inline]

Definition at line 175 of file lx.h.

References GetSym().

                                                                           {
    return GetSym(TFSet()|Sym1|Sym2|Sym3);}

Here is the call graph for this function:

TLxSym TILx::GetSym ( const TLxSym Sym1,
const TLxSym Sym2,
const TLxSym Sym3,
const TLxSym Sym4 
) [inline]

Definition at line 177 of file lx.h.

References GetSym().

                      {
    return GetSym(TFSet()|Sym1|Sym2|Sym3|Sym4);}

Here is the call graph for this function:

TStr TILx::GetSymStr ( ) const

Definition at line 594 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);}
  }
}

Here is the caller graph for this function:

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().

                                                       {
    GetIdStr(VarNm); GetSym(syColon);
    if (LBracket){GetSym(syLBracket);} if (NewLn){GetEoln();}}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TILx::GetVarBool ( const TStr VarNm,
const bool &  NewLn = true 
) [inline]

Definition at line 219 of file lx.h.

References Bool, GetBool(), GetEoln(), GetIdStr(), GetSym(), and syColon.

                                                            {
    GetIdStr(VarNm); GetSym(syColon); bool Bool=GetBool();
    if (NewLn){GetEoln();} return Bool;}

Here is the call graph for this function:

void TILx::GetVarBoolV ( const TStr VarNm,
TBoolV BoolV,
const bool &  NewLn = true 
)

Definition at line 632 of file lx.cpp.

References TVec< TVal, TSizeTy >::Add(), Bool, TVec< TVal, TSizeTy >::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();}
}

Here is the call graph for this function:

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();}}

Here is the call graph for this function:

double TILx::GetVarFlt ( const TStr VarNm,
const bool &  NewLn = true 
) [inline]

Definition at line 225 of file lx.h.

References Flt, GetEoln(), GetFlt(), GetIdStr(), GetSym(), and syColon.

                                                             {
    GetIdStr(VarNm); GetSym(syColon); double Flt=GetFlt();
    if (NewLn){GetEoln();} return Flt;}

Here is the call graph for this function:

void TILx::GetVarFltV ( const TStr VarNm,
TFltV FltV,
const bool &  NewLn = true 
)

Definition at line 648 of file lx.cpp.

References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::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();}
}

Here is the call graph for this function:

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().

                                                          {
    GetIdStr(VarNm); GetSym(syColon); int Int=GetInt();
    if (NewLn){GetEoln();} return Int;}

Here is the call graph for this function:

Here is the caller graph for this function:

void TILx::GetVarIntV ( const TStr VarNm,
TIntV IntV,
const bool &  NewLn = true 
)

Definition at line 640 of file lx.cpp.

References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::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();}
}

Here is the call graph for this function:

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;}

Here is the call graph for this function:

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().

                                                           {
    GetIdStr(VarNm); GetSym(syColon); TStr Str=GetQStr();
    if (NewLn){GetEoln();} return Str;}

Here is the call graph for this function:

Here is the caller graph for this function:

void TILx::GetVarStrPrV ( const TStr VarNm,
TStrPrV StrPrV,
const bool &  NewLn = true 
)

Definition at line 664 of file lx.cpp.

References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::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();}
}

Here is the call graph for this function:

void TILx::GetVarStrV ( const TStr VarNm,
TStrV StrV,
const bool &  NewLn = true 
)

Definition at line 656 of file lx.cpp.

References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::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();}
}

Here is the call graph for this function:

void TILx::GetVarStrVV ( const TStr VarNm,
TVec< TStrV > &  StrVV,
const bool &  NewLn = true 
)

Definition at line 675 of file lx.cpp.

References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Clr(), GetEoln(), GetSym(), GetVar(), TVec< TVal, TSizeTy >::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();}
}

Here is the call graph for this function:

bool TILx::IsBof ( ) const [inline]

Definition at line 167 of file lx.h.

References ChN.

Referenced by GetStrToEolnAndCh(), and GetSym().

{return ChN==-1;}

Here is the caller graph for this function:

bool TILx::IsEof ( ) const [inline]

Definition at line 168 of file lx.h.

References Ch, and TCh::EofCh.

{return Ch==TCh::EofCh;}
bool TILx::IsVar ( const TStr VarNm) [inline]

Definition at line 207 of file lx.h.

References GetSym(), PutSym(), Str, syIdStr, and Sym.

Referenced by TPp::LoadTxt().

                               {
    GetSym(); bool Var=((Sym==syIdStr)&&(Str==VarNm)); PutSym(); return Var;}

Here is the call graph for this function:

Here is the caller graph for this function:

TILx& TILx::operator= ( const TILx ) [inline]

Definition at line 159 of file lx.h.

References Fail.

{Fail; return *this;}
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 NextSym=GetSym(); PutSym(); return NextSym;}

Here is the call graph for this function:

Here is the caller graph for this function:

TLxSym TILx::PeekSym ( const int &  Syms)

Definition at line 580 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;
}

Here is the call graph for this function:

bool TILx::PeekVarEnd ( const bool &  RBracket = false,
const bool &  NewLn = false 
) [inline]

Definition at line 216 of file lx.h.

References Fail, PeekSym(), syEoln, and syRBracket.

                                                                      {
    if (RBracket){return PeekSym()==syRBracket;}
    if (NewLn){return PeekSym()==syEoln;} Fail; return false;}

Here is the call graph for this function:

void TILx::PutSym ( const TILxSymSt SymSt) [inline]

Definition at line 198 of file lx.h.

References PrevSymStStack, and TSStack< TVal >::Push().

Here is the call graph for this function:

void TILx::PutSym ( ) [inline]

Definition at line 199 of file lx.h.

References PrevSymStStack, and TSStack< TVal >::Push().

Referenced by IsVar(), and PeekSym().

Here is the call graph for this function:

Here is the caller graph for this function:

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;
  }
}

Here is the caller graph for this function:

void TILx::SkipToEoln ( )

Definition at line 573 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();}}
}

Here is the call graph for this function:

void TILx::SkipToSym ( const TLxSym SkipToSym) [inline]

Definition at line 195 of file lx.h.

References GetSym(), and Sym.

                                         {
    while (Sym!=SkipToSym){GetSym();}}

Here is the call graph for this function:


Member Data Documentation

bool TILx::Bool

Definition at line 151 of file lx.h.

Referenced by GetBool(), GetSym(), GetVarBool(), GetVarBoolV(), and TILxSymSt::Restore().

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 135 of file lx.h.

Referenced by GetCh(), GetQStr(), GetStrToEolnAndCh(), GetSym(), and IsBof().

Definition at line 150 of file lx.h.

Referenced by GetSym(), 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]

Definition at line 138 of file lx.h.

Referenced by GetSym(), and SetOpt().

bool TILx::IsCsSens [private]

Definition at line 138 of file lx.h.

Referenced by GetSym(), and SetOpt().

bool TILx::IsExcept [private]

Definition at line 139 of file lx.h.

Referenced by GetSym(), and SetOpt().

bool TILx::IsList [private]

Definition at line 139 of file lx.h.

Referenced by GetCh(), and SetOpt().

bool TILx::IsRetEoln [private]

Definition at line 138 of file lx.h.

Referenced by GetSym(), and SetOpt().

bool TILx::IsSigNum [private]

Definition at line 138 of file lx.h.

Referenced by GetSym(), and SetOpt().

bool TILx::IsTabSep [private]

Definition at line 139 of file lx.h.

Referenced by GetSym(), and SetOpt().

bool TILx::IsUniStr [private]

Definition at line 138 of file lx.h.

Referenced by GetSym(), and SetOpt().

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().

Definition at line 136 of file lx.h.

Referenced by GetSIn(), GetSym(), and PutSym().

Definition at line 154 of file lx.h.

Referenced by GetQStr(), and GetSym().

Definition at line 153 of file lx.h.

Referenced by GetSym().

TSIn& TILx::RSIn [private]

Definition at line 133 of file lx.h.

Referenced by GetCh().

Definition at line 137 of file lx.h.

Referenced by AddRw(), GetRw(), and GetSym().

PSIn TILx::SIn [private]

Definition at line 132 of file lx.h.

Referenced by GetFPosStr(), GetLnV(), and GetSIn().

Definition at line 152 of file lx.h.

Referenced by GetSym(), and TILxSymSt::Restore().

Definition at line 152 of file lx.h.

Referenced by GetSym(), and TILxSymSt::Restore().

Definition at line 152 of file lx.h.

Referenced by GetSym(), and TILxSymSt::Restore().


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