return (uint32_t)val;
}
+static uint64_t scan_pint64(LEX *lf, char *str)
+{
+ uint64_t val = 0;
+ if (!is_a_number(str)) {
+ scan_err1(lf, _("expected a positive integer number, got: %s"), str);
+ /* NOT REACHED */
+ } else {
+ errno = 0;
+ val = str_to_uint64(str);
+ if (errno != 0) {
+ scan_err1(lf, _("expected a positive integer number, got: %s"), str);
+ /* NOT REACHED */
+ }
+ }
+ return val;
+}
+
/*
*
* Get the next token from the input
}
break;
+ case T_PINT64_RANGE:
+ if (token == T_NUMBER) {
+ lf->pint64_val = scan_pint64(lf, lf->str);
+ lf->pint64_val2 = lf->pint64_val;
+ token = T_PINT64;
+ } else {
+ char *p = strchr(lf->str, '-');
+ if (!p) {
+ scan_err2(lf, _("expected an integer or a range, got %s: %s"),
+ lex_tok_to_str(token), lf->str);
+ token = T_ERROR;
+ break;
+ }
+ *p++ = 0; /* terminate first half of range */
+ lf->pint64_val = scan_pint64(lf, lf->str);
+ lf->pint64_val2 = scan_pint64(lf, p);
+ token = T_PINT64_RANGE;
+ }
+ break;
+
case T_NAME:
if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
scan_err2(lf, _("expected a name, got %s: %s"),
#define T_INT64 117 /* 64 bit integer */
#define T_NAME 118 /* name max 128 chars */
#define T_STRING 119 /* string */
+#define T_PINT64_RANGE 120 /* positive integer range */
+#define T_PINT64 121 /* positive integer range */
#define T_ALL 0 /* no expectations */
uint32_t pint32_val2;
int32_t int32_val;
int64_t int64_val;
+ uint64_t pint64_val;
+ uint64_t pint64_val2;
void (*scan_error)(const char *file, int line, struct s_lex_context *lc, const char *msg, ...);
int err_type; /* message level for scan_error (M_..) */
void *caller_ctx; /* caller private data */