234 enum class MatchPattern {
239 } matchPattern = MatchPattern::dec;
248 matchPattern = MatchPattern::hex;
255 matchPattern = MatchPattern::bin;
268 matchPattern = MatchPattern::oct;
274 matchPattern = MatchPattern::oct;
283 while (isdigit(
curCh) || (matchPattern == MatchPattern::hex && isxdigit(
curCh))) {
288 yoi_assert(
line,
col, matchPattern == MatchPattern::dec,
"lexer::digitStart() - invalid match pattern");
292 while (isdigit(
curCh)) {
311 switch (matchPattern) {
312 case MatchPattern::dec: {
316 case MatchPattern::hex: {
320 case MatchPattern::oct: {
324 case MatchPattern::bin: {
330 tok.basicVal.vInt = std::stoll(tempStr,
nullptr, base);
332 tok.basicVal.vUint = std::stoull(tempStr,
nullptr, base);
334 tok.basicVal.vShort =
static_cast<int16_t
>(std::stoi(tempStr,
nullptr, base));
336 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.