@fink/loxia
Version:
A fink to JavaScript compiler.
55 lines (43 loc) • 1.13 kB
JavaScript
const {
rx: rx_0
} = require("@fink/std-lib/regex.js");
const {
matches: matches_0
} = require("@fink/std-lib/regex.js");
const {
ir_fn: ir_fn_0
} = require("../context.js");
const float_0 = (drec_0, res_id_0, ctx_0) => {
const result_0 = ir_fn_0(`float`, [drec_0.value], res_id_0, {
loc: drec_0.loc
}, ctx_0);
return result_0;
};
const int_0 = (drec_1, res_id_1, ctx_1) => {
const result_1 = ir_fn_0(`int`, [drec_1.value], res_id_1, {
loc: drec_1.loc
}, ctx_1);
return result_1;
};
const transform_number_0 = (expr_0, res_id_2, ctx_2) => {
let ret_2;
ret_2: {
const val_2 = matches_0(expr_0.value, rx_0`\.`);
/* istanbul ignore else */
if (true === val_2) {
const result_4 = float_0(expr_0, res_id_2, ctx_2);
ret_2 = result_4;
/* istanbul ignore next */
break ret_2;
}
const result_3 = int_0(expr_0, res_id_2, ctx_2);
ret_2 = result_3;
/* istanbul ignore next */
break ret_2;
}
const dlst_0 = ret_2;
return [dlst_0[0], dlst_0[2]];
};
exports.float = float_0;
exports.int = int_0;
exports.transform_number = transform_number_0;