236 enum class MatchPattern {
241 } matchPattern = MatchPattern::dec;
250 matchPattern = MatchPattern::hex;
257 matchPattern = MatchPattern::bin;
270 matchPattern = MatchPattern::oct;
276 matchPattern = MatchPattern::oct;
285 while (isdigit(
curCh) || (matchPattern == MatchPattern::hex && isxdigit(
curCh))) {
290 yoi_assert(
line,
col, matchPattern == MatchPattern::dec,
"lexer::digitStart() - invalid match pattern");
294 while (isdigit(
curCh)) {
313 switch (matchPattern) {
314 case MatchPattern::dec: {
318 case MatchPattern::hex: {
322 case MatchPattern::oct: {
326 case MatchPattern::bin: {
332 tok.basicVal.vInt = std::stoll(tempStr,
nullptr, base);
334 tok.basicVal.vUint = std::stoull(tempStr,
nullptr, base);
336 tok.basicVal.vShort =
static_cast<int16_t
>(std::stoi(tempStr,
nullptr, base));
338 tok.basicVal.vDeci = std::stod(tempStr);
void yoi_assert(bool condition, yoi::indexT line, yoi::indexT col, const std::string &msg)
Asserts a condition that would be true and throws a runtime_error if it is false.