@fink/loxia
Version:
A fink to JavaScript compiler.
47 lines (37 loc) • 1.11 kB
JavaScript
import { rx as rx_0 } from "@fink/std-lib/regex.js";
import { matches as matches_0 } from "@fink/std-lib/regex.js";
import { ir_fn as ir_fn_0 } from "../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]];
};
export const float = float_0,
int = int_0,
transform_number = transform_number_0;