UNPKG

@fink/loxia

Version:

A fink to JavaScript compiler.

87 lines (75 loc) 2.52 kB
const { transform: transform_0 } = require("../transform.js"); const { ir_fn: ir_fn_0 } = require("../context.js"); const str_2 = (value_0, name_or_id_0, drec_0, ctx_0) => { const result_0 = ir_fn_0(`str`, [value_0], name_or_id_0, { loc: drec_0.loc }, ctx_0); return result_0; }; const str_t_0 = (ids_0, name_or_id_1, drec_1, ctx_1) => { const result_1 = ir_fn_0(`strt`, ids_0, name_or_id_1, { loc: drec_1.loc }, ctx_1); return result_1; }; const str_tt_0 = (tag_id_0, ids_1, name_or_id_2, drec_2, ctx_2) => { const result_2 = ir_fn_0(`strtt`, [tag_id_0, ...ids_1], name_or_id_2, { loc: drec_2.loc }, ctx_2); return result_2; }; const transform_parts_0 = (...args_3) => { transform_parts_0: do { const dlst_0 = args_3[0]; const hdm_0 = dlst_0[0]; const expr_0 = undefined === hdm_0 ? false : hdm_0; const tail_14 = dlst_0.slice(1); const ctx_3 = args_3[1]; const hdm_1 = args_3[2]; const ids_2 = undefined === hdm_1 ? [] : hdm_1; const hdm_2 = args_3[3]; const out_0 = undefined === hdm_2 ? [] : hdm_2; /* istanbul ignore else */ if (expr_0 === false) { return [out_0, ids_2, ctx_3]; } /* istanbul ignore else */ if (null != expr_0) { /* istanbul ignore else */ if (expr_0.type === `string:text`) { const dlst_2 = str_2(expr_0.value, `str`, expr_0, ctx_3); args_3 = [tail_14, dlst_2[2], [...ids_2, dlst_2[1]], [...out_0, ...dlst_2[0]]]; continue transform_parts_0; } } const dlst_1 = transform_0(expr_0, `sx`, ctx_3); args_3 = [tail_14, dlst_1[2], [...ids_2, dlst_1[1]], [...out_0, ...dlst_1[0]]]; continue transform_parts_0; } while (true); }; const transform_string_0 = (node_0, result_9, ctx_4) => { const dlst_3 = transform_parts_0(node_0.exprs, ctx_4); const out_1 = dlst_3[0]; const ids_3 = dlst_3[1]; const next_ctx_2 = dlst_3[2]; /* istanbul ignore else */ if (null != node_0) { /* istanbul ignore else */ if (node_0.tag === false) { const dlst_6 = str_t_0(ids_3, result_9, node_0, next_ctx_2); return [[...out_1, ...dlst_6[0]], dlst_6[2]]; } } const dlst_4 = transform_0(node_0.tag, `tag`, next_ctx_2); const dlst_5 = str_tt_0(dlst_4[1], ids_3, result_9, node_0, dlst_4[2]); return [[...dlst_4[0], ...out_1, ...dlst_5[0]], dlst_5[2]]; }; exports.str = str_2; exports.str_t = str_t_0; exports.str_tt = str_tt_0; exports.transform_parts = transform_parts_0; exports.transform_string = transform_string_0;