Example #1
0
 bool TokenStream::tryInt(Token& token, const ParseLocation& loc) {
   std::string str;
   if (decDigits(str)) {
     token = Token(atoi(str.c_str()),loc);
     return true;
   }
   return false;
 }
Example #2
0
int ENumeric::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QFrame::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 8)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 8;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = intDigits(); break;
        case 1: *reinterpret_cast< int*>(_v) = decDigits(); break;
        case 2: *reinterpret_cast< double*>(_v) = value(); break;
        case 3: *reinterpret_cast< double*>(_v) = maximum(); break;
        case 4: *reinterpret_cast< double*>(_v) = minimum(); break;
        case 5: *reinterpret_cast< bool*>(_v) = digitsFontScaleEnabled(); break;
        }
        _id -= 6;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setIntDigits(*reinterpret_cast< int*>(_v)); break;
        case 1: setDecDigits(*reinterpret_cast< int*>(_v)); break;
        case 2: setValue(*reinterpret_cast< double*>(_v)); break;
        case 3: setMaximum(*reinterpret_cast< double*>(_v)); break;
        case 4: setMinimum(*reinterpret_cast< double*>(_v)); break;
        case 5: setDigitsFontScaleEnabled(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 6;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 6;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 6;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 6;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 6;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 6;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 6;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #3
0
 bool TokenStream::tryFloat(Token& token, const ParseLocation& loc)
 {
   bool ok = false;
   std::string str;
   if (decDigits(str))
   {
     if (cin->peek() == '.') {
       str += (char)cin->get();
       decDigits(str);
       if (cin->peek() == 'e' || cin->peek() == 'E') {
         str += (char)cin->get();
         if (decDigits(str)) ok = true; // 1.[2]E2
       }
       else ok = true; // 1.[2]
     }
     else if (cin->peek() == 'e' || cin->peek() == 'E') {
       str += (char)cin->get();
       if (decDigits(str)) ok = true; // 1E2
     }
   }
   else
   {
     if (cin->peek() == '.') {
       str += (char)cin->get();
       if (decDigits(str)) {
         if (cin->peek() == 'e' || cin->peek() == 'E') {
           str += (char)cin->get();
           if (decDigits(str)) ok = true; // .3E2
         }
         else ok = true; // .3
       }
     }
   }
   if (ok) {
     token = Token((float)atof(str.c_str()),loc);
   }
   else cin->unget(str.size());
   return ok;
 }