mirror of https://github.com/djcb/mu.git
parser: use the new number (de)serialization
Use the new lexnums, and the update parsing
This commit is contained in:
parent
55113c6d5c
commit
95710edff4
|
@ -19,6 +19,7 @@
|
||||||
#include "mu-parser.hh"
|
#include "mu-parser.hh"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#include "mu-tokenizer.hh"
|
#include "mu-tokenizer.hh"
|
||||||
#include "utils/mu-utils.hh"
|
#include "utils/mu-utils.hh"
|
||||||
|
@ -174,13 +175,14 @@ process_range(const std::string& field_str,
|
||||||
|
|
||||||
std::string l2 = lower;
|
std::string l2 = lower;
|
||||||
std::string u2 = upper;
|
std::string u2 = upper;
|
||||||
|
constexpr auto upper_limit = std::numeric_limits<int64_t>::max();
|
||||||
|
|
||||||
if (field_opt->id == Field::Id::Date) {
|
if (field_opt->id == Field::Id::Date) {
|
||||||
l2 = Mu::date_to_time_t_string(lower, true);
|
l2 = to_lexnum(parse_date_time(lower, true).value_or(0));
|
||||||
u2 = Mu::date_to_time_t_string(upper, false);
|
u2 = to_lexnum(parse_date_time(upper, false).value_or(upper_limit));
|
||||||
} else if (field_opt->id == Field::Id::Size) {
|
} else if (field_opt->id == Field::Id::Size) {
|
||||||
l2 = Mu::size_to_string(lower, true);
|
l2 = to_lexnum(parse_size(lower, true).value_or(0));
|
||||||
u2 = Mu::size_to_string(upper, false);
|
u2 = to_lexnum(parse_size(upper, false).value_or(upper_limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {l2, u2};
|
return {l2, u2};
|
||||||
|
|
Loading…
Reference in New Issue