示例#1
0
void CParser::ParseNumber() {
    double num = 0.0;
    char curSymb = src[pos];

    // integer
    while(pos<sz) {
        const char curSymb = src[pos];
        if (!IsDigit(curSymb)) {
            break;
        }
        num = num*10.0 + (double)CharToNumber(curSymb);
        ++pos;
    }

    // fraction
    if (pos < sz && src[pos] == '.') {
        ++pos;
        double factor = 1.0;
        double fraction = 0.0;
        while (pos < sz) {
            const char curSymb = src[pos];
            if (!IsDigit(curSymb)) {
                break;
            }
            fraction = fraction*10.0 + (double)CharToNumber(curSymb);
            factor *= 10.0;  
            ++pos;
        }
        num += fraction/factor;
    }
    

    AST::LiteralExpr* pLit = new AST::LiteralExpr((float)num);
    st.push_back(pLit);
}
示例#2
0
char STRBLK::GetTinyValue(int n)
  {
  bool      m;
  ulonglong val = CharToNumber(Strp[n], strlen(Strp[n]), INT_MAX8, 
                                                         false, &m); 
    
  return (m && val < INT_MAX8) ? (char)(-(signed)val) : (char)val;
  } // end of GetTinyValue
示例#3
0
int STRBLK::GetIntValue(int n)
  {
  bool      m;
  ulonglong val = CharToNumber(Strp[n], strlen(Strp[n]), INT_MAX32,
                                                         false, &m); 
    
  return (m && val < INT_MAX32) ? (int)(-(signed)val) : (int)val;
  } // end of GetIntValue
示例#4
0
longlong CHRBLK::GetBigintValue(int n)
  {
  bool      m;
  ulonglong val = CharToNumber((char*)GetValPtr(n), Long, INT_MAX64,
                                                    false, &m); 
    
  return (m && val < INT_MAX64) ? (longlong)(-(signed)val) : (longlong)val;
  } // end of GetBigintValue
示例#5
0
int CHRBLK::GetIntValue(int n)
  {
  bool      m;
  ulonglong val = CharToNumber((char*)GetValPtr(n), Long, INT_MAX32,
                                                    false, &m); 
    
  return (m && val < INT_MAX32) ? (int)(-(signed)val) : (int)val;
  } // end of GetIntValue
示例#6
0
char CHRBLK::GetTinyValue(int n)
  {
  bool      m;
  ulonglong val = CharToNumber((char*)GetValPtr(n), Long, INT_MAX8,
                                                    false, &m); 
    
  return (m && val < INT_MAX8) ? (char)(-(signed)val) : (char)val;
  } // end of GetTinyValue
示例#7
0
longlong STRBLK::GetBigintValue(int n)
  {
  bool      m;
  ulonglong val = CharToNumber(Strp[n], strlen(Strp[n]), INT_MAX64,
                                                         false, &m); 
    
  return (m && val < INT_MAX64) ? (-(signed)val) : (longlong)val;
  } // end of GetBigintValue
示例#8
0
void TYPBLK<TYPE>::SetValue(PSZ p, int n)
  {
  ChkIndx(n);

  if (Check) {
    PGLOBAL& g = Global;
    strcpy(g->Message, MSG(BAD_SET_STRING));
    longjmp(g->jumper[g->jump_level], Type);
    } // endif Check

  bool      minus;
  ulonglong maxval = MaxVal();
  ulonglong val = CharToNumber(p, strlen(p), maxval, Unsigned, &minus); 
    
  if (minus && val < maxval)
    Typp[n] = (TYPE)(-(signed)val);
  else
    Typp[n] = (TYPE)val;

  SetNull(n, false);
  } // end of SetValue
示例#9
0
ushort STRBLK::GetUShortValue(int n)
  {
  return (ushort)CharToNumber(Strp[n], strlen(Strp[n]), UINT_MAX16, true); 
  } // end of GetUshortValue
示例#10
0
uchar STRBLK::GetUTinyValue(int n)
  {
  return (uchar)CharToNumber(Strp[n], strlen(Strp[n]), UINT_MAX8, true); 
  } // end of GetUTinyValue
示例#11
0
ulonglong CHRBLK::GetUBigintValue(int n)
  {
  return CharToNumber((char*)GetValPtr(n), Long, ULONGLONG_MAX, true); 
  } // end of GetUBigintValue
示例#12
0
uint CHRBLK::GetUIntValue(int n)
  {
  return (uint)CharToNumber((char*)GetValPtr(n), Long, UINT_MAX32, true); 
  } // end of GetIntValue
示例#13
0
ushort CHRBLK::GetUShortValue(int n)
  {
  return (ushort)CharToNumber((char*)GetValPtr(n), Long, UINT_MAX16, true); 
  } // end of GetShortValue
示例#14
0
uchar CHRBLK::GetUTinyValue(int n)
  {
  return (uchar)CharToNumber((char*)GetValPtr(n), Long, UINT_MAX8, true); 
  } // end of GetTinyValue
示例#15
0
ulonglong STRBLK::GetUBigintValue(int n)
  {
  return CharToNumber(Strp[n], strlen(Strp[n]), ULONGLONG_MAX, true); 
  } // end of GetUBigintValue
示例#16
0
uint STRBLK::GetUIntValue(int n)
  {
  return (uint)CharToNumber(Strp[n], strlen(Strp[n]), UINT_MAX32, true); 
  } // end of GetUintValue