redscript-mc 2.5.0 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/README.md +5 -75
- package/README.zh.md +165 -147
- package/ROADMAP.md +195 -0
- package/dist/data/linalg/function/_vec2d_len_sq_fx.mcfunction +17 -0
- package/dist/data/linalg/function/_vec3d_len_sq_fx.mcfunction +27 -0
- package/dist/data/linalg/function/load.mcfunction +1 -0
- package/dist/data/linalg/function/mat2d_det.mcfunction +16 -0
- package/dist/data/linalg/function/mat2d_mul_r0c0.mcfunction +16 -0
- package/dist/data/linalg/function/mat2d_mul_r0c1.mcfunction +16 -0
- package/dist/data/linalg/function/mat2d_mul_r1c0.mcfunction +16 -0
- package/dist/data/linalg/function/mat2d_mul_r1c1.mcfunction +16 -0
- package/dist/data/linalg/function/mat2d_vecmul_x.mcfunction +16 -0
- package/dist/data/linalg/function/mat2d_vecmul_y.mcfunction +16 -0
- package/dist/data/linalg/function/solve2d_x.mcfunction +27 -0
- package/dist/data/linalg/function/solve2d_y.mcfunction +27 -0
- package/dist/data/linalg/function/vec2d_dist.mcfunction +15 -0
- package/dist/data/linalg/function/vec2d_dot.mcfunction +16 -0
- package/dist/data/linalg/function/vec2d_length.mcfunction +21 -0
- package/dist/data/linalg/function/vec2d_normalize_x.mcfunction +8 -0
- package/dist/data/linalg/function/vec2d_normalize_x__merge_1.mcfunction +10 -0
- package/dist/data/linalg/function/vec2d_normalize_x__then_0.mcfunction +3 -0
- package/dist/data/linalg/function/vec2d_normalize_y.mcfunction +8 -0
- package/dist/data/linalg/function/vec2d_normalize_y__merge_1.mcfunction +10 -0
- package/dist/data/linalg/function/vec2d_normalize_y__then_0.mcfunction +3 -0
- package/dist/data/linalg/function/vec3d_cross_x.mcfunction +16 -0
- package/dist/data/linalg/function/vec3d_cross_y.mcfunction +16 -0
- package/dist/data/linalg/function/vec3d_cross_z.mcfunction +16 -0
- package/dist/data/linalg/function/vec3d_dist.mcfunction +21 -0
- package/dist/data/linalg/function/vec3d_dot.mcfunction +26 -0
- package/dist/data/linalg/function/vec3d_length.mcfunction +31 -0
- package/dist/data/linalg/function/vec3d_normalize_x.mcfunction +9 -0
- package/dist/data/linalg/function/vec3d_normalize_x__merge_1.mcfunction +11 -0
- package/dist/data/linalg/function/vec3d_normalize_x__then_0.mcfunction +3 -0
- package/dist/data/linalg/function/vec3d_normalize_y.mcfunction +9 -0
- package/dist/data/linalg/function/vec3d_normalize_y__merge_1.mcfunction +11 -0
- package/dist/data/linalg/function/vec3d_normalize_y__then_0.mcfunction +3 -0
- package/dist/data/linalg/function/vec3d_normalize_z.mcfunction +9 -0
- package/dist/data/linalg/function/vec3d_normalize_z__merge_1.mcfunction +11 -0
- package/dist/data/linalg/function/vec3d_normalize_z__then_0.mcfunction +3 -0
- package/dist/data/math_hp/function/cos_hp.mcfunction +8 -0
- package/dist/data/math_hp/function/div3_hp.mcfunction +23 -0
- package/dist/data/math_hp/function/div_hp.mcfunction +13 -0
- package/dist/data/math_hp/function/init_div.mcfunction +1 -0
- package/dist/data/math_hp/function/init_trig.mcfunction +1 -0
- package/dist/data/math_hp/function/ln_5term.mcfunction +6 -0
- package/dist/data/math_hp/function/ln_5term__loop_body_1.mcfunction +8 -0
- package/dist/data/math_hp/function/ln_5term__loop_body_4.mcfunction +8 -0
- package/dist/data/math_hp/function/ln_5term__loop_exit_2.mcfunction +1 -0
- package/dist/data/math_hp/function/ln_5term__loop_exit_5.mcfunction +61 -0
- package/dist/data/math_hp/function/ln_5term__loop_header_0.mcfunction +3 -0
- package/dist/data/math_hp/function/ln_5term__loop_header_3.mcfunction +6 -0
- package/dist/data/math_hp/function/load.mcfunction +1 -0
- package/dist/data/math_hp/function/norm3_hp.mcfunction +43 -0
- package/dist/data/math_hp/function/sin_hp.mcfunction +8 -0
- package/dist/data/math_hp/function/sqrt_hp.mcfunction +17 -0
- package/dist/data/math_hp/function/sqrt_hp__merge_1.mcfunction +21 -0
- package/dist/data/math_hp/function/sqrt_hp__then_0.mcfunction +2 -0
- package/dist/data/minecraft/tags/function/load.json +1 -2
- package/dist/data/minecraft/tags/function/tick.json +1 -1
- package/dist/data/readme_demo/function/_draw.mcfunction +1 -0
- package/dist/data/readme_demo/function/_init.mcfunction +1 -0
- package/dist/data/readme_demo/function/_math_init.mcfunction +4 -0
- package/dist/data/readme_demo/function/_wave_tick.mcfunction +1 -0
- package/dist/data/readme_demo/function/_wave_tick__foreach_t8.mcfunction +109 -0
- package/dist/data/readme_demo/function/acos_approx.mcfunction +7 -0
- package/dist/data/readme_demo/function/approx_eq.mcfunction +10 -0
- package/dist/data/readme_demo/function/approx_eq__merge_1.mcfunction +3 -0
- package/dist/data/readme_demo/function/approx_eq__merge_3.mcfunction +2 -0
- package/dist/data/readme_demo/function/approx_eq__then_0.mcfunction +4 -0
- package/dist/data/readme_demo/function/approx_eq__then_2.mcfunction +2 -0
- package/dist/data/readme_demo/function/asin_approx.mcfunction +5 -0
- package/dist/data/readme_demo/function/asin_approx__merge_1.mcfunction +3 -0
- package/dist/data/readme_demo/function/asin_approx__merge_10.mcfunction +5 -0
- package/dist/data/readme_demo/function/asin_approx__merge_4.mcfunction +12 -0
- package/dist/data/readme_demo/function/asin_approx__merge_7.mcfunction +14 -0
- package/dist/data/readme_demo/function/asin_approx__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/asin_approx__then_3.mcfunction +2 -0
- package/dist/data/readme_demo/function/asin_approx__then_6.mcfunction +2 -0
- package/dist/data/readme_demo/function/asin_approx__then_9.mcfunction +2 -0
- package/dist/data/readme_demo/function/cbrt_fx.mcfunction +5 -0
- package/dist/data/readme_demo/function/cbrt_fx__loop_body_6.mcfunction +7 -0
- package/dist/data/readme_demo/function/cbrt_fx__loop_exit_7.mcfunction +1 -0
- package/dist/data/readme_demo/function/cbrt_fx__loop_header_5.mcfunction +4 -0
- package/dist/data/readme_demo/function/cbrt_fx__merge_1.mcfunction +8 -0
- package/dist/data/readme_demo/function/cbrt_fx__merge_11.mcfunction +5 -0
- package/dist/data/readme_demo/function/cbrt_fx__merge_13.mcfunction +4 -0
- package/dist/data/readme_demo/function/cbrt_fx__merge_4.mcfunction +2 -0
- package/dist/data/readme_demo/function/cbrt_fx__merge_9.mcfunction +13 -0
- package/dist/data/readme_demo/function/cbrt_fx__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/cbrt_fx__then_10.mcfunction +2 -0
- package/dist/data/readme_demo/function/cbrt_fx__then_12.mcfunction +2 -0
- package/dist/data/readme_demo/function/cbrt_fx__then_3.mcfunction +2 -0
- package/dist/data/readme_demo/function/cbrt_fx__then_8.mcfunction +2 -0
- package/dist/data/readme_demo/function/cbrt_newton.mcfunction +5 -0
- package/dist/data/readme_demo/function/cbrt_newton__else_7.mcfunction +2 -0
- package/dist/data/readme_demo/function/cbrt_newton__merge_1.mcfunction +11 -0
- package/dist/data/readme_demo/function/cbrt_newton__merge_4.mcfunction +1 -0
- package/dist/data/readme_demo/function/cbrt_newton__merge_6.mcfunction +1 -0
- package/dist/data/readme_demo/function/cbrt_newton__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/cbrt_newton__then_3.mcfunction +17 -0
- package/dist/data/readme_demo/function/cbrt_newton__then_5.mcfunction +11 -0
- package/dist/data/readme_demo/function/ceil_div.mcfunction +9 -0
- package/dist/data/readme_demo/function/combinations.mcfunction +6 -0
- package/dist/data/readme_demo/function/combinations__loop_body_9.mcfunction +15 -0
- package/dist/data/readme_demo/function/combinations__loop_exit_10.mcfunction +1 -0
- package/dist/data/readme_demo/function/combinations__loop_header_8.mcfunction +3 -0
- package/dist/data/readme_demo/function/combinations__merge_1.mcfunction +3 -0
- package/dist/data/readme_demo/function/combinations__merge_4.mcfunction +6 -0
- package/dist/data/readme_demo/function/combinations__merge_7.mcfunction +3 -0
- package/dist/data/readme_demo/function/combinations__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/combinations__then_3.mcfunction +2 -0
- package/dist/data/readme_demo/function/combinations__then_6.mcfunction +4 -0
- package/dist/data/readme_demo/function/cos_fixed.mcfunction +7 -0
- package/dist/data/readme_demo/function/cubic_disc_fx.mcfunction +26 -0
- package/dist/data/readme_demo/function/cubic_newton.mcfunction +8 -0
- package/dist/data/readme_demo/function/cubic_newton__loop_body_1.mcfunction +55 -0
- package/dist/data/readme_demo/function/cubic_newton__loop_exit_2.mcfunction +1 -0
- package/dist/data/readme_demo/function/cubic_newton__loop_header_0.mcfunction +4 -0
- package/dist/data/readme_demo/function/cubic_newton__merge_10.mcfunction +1 -0
- package/dist/data/readme_demo/function/cubic_newton__merge_4.mcfunction +4 -0
- package/dist/data/readme_demo/function/cubic_newton__merge_6.mcfunction +4 -0
- package/dist/data/readme_demo/function/cubic_newton__merge_8.mcfunction +4 -0
- package/dist/data/readme_demo/function/cubic_newton__then_3.mcfunction +2 -0
- package/dist/data/readme_demo/function/cubic_newton__then_5.mcfunction +13 -0
- package/dist/data/readme_demo/function/cubic_newton__then_7.mcfunction +4 -0
- package/dist/data/readme_demo/function/cubic_newton__then_9.mcfunction +2 -0
- package/dist/data/readme_demo/function/divfix.mcfunction +6 -0
- package/dist/data/readme_demo/function/divfix__merge_1.mcfunction +6 -0
- package/dist/data/readme_demo/function/divfix__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/exp_fx.mcfunction +16 -0
- package/dist/data/readme_demo/function/exp_fx__loop_body_10.mcfunction +8 -0
- package/dist/data/readme_demo/function/exp_fx__loop_body_5.mcfunction +8 -0
- package/dist/data/readme_demo/function/exp_fx__loop_exit_11.mcfunction +1 -0
- package/dist/data/readme_demo/function/exp_fx__loop_exit_6.mcfunction +1 -0
- package/dist/data/readme_demo/function/exp_fx__loop_header_4.mcfunction +3 -0
- package/dist/data/readme_demo/function/exp_fx__loop_header_9.mcfunction +3 -0
- package/dist/data/readme_demo/function/exp_fx__merge_1.mcfunction +47 -0
- package/dist/data/readme_demo/function/exp_fx__merge_3.mcfunction +4 -0
- package/dist/data/readme_demo/function/exp_fx__merge_8.mcfunction +1 -0
- package/dist/data/readme_demo/function/exp_fx__then_0.mcfunction +7 -0
- package/dist/data/readme_demo/function/exp_fx__then_2.mcfunction +2 -0
- package/dist/data/readme_demo/function/exp_fx__then_7.mcfunction +5 -0
- package/dist/data/readme_demo/function/factorial.mcfunction +5 -0
- package/dist/data/readme_demo/function/factorial__loop_body_4.mcfunction +7 -0
- package/dist/data/readme_demo/function/factorial__loop_exit_5.mcfunction +1 -0
- package/dist/data/readme_demo/function/factorial__loop_header_3.mcfunction +3 -0
- package/dist/data/readme_demo/function/factorial__merge_1.mcfunction +3 -0
- package/dist/data/readme_demo/function/factorial__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/gamma_int.mcfunction +5 -0
- package/dist/data/readme_demo/function/gamma_int__merge_1.mcfunction +6 -0
- package/dist/data/readme_demo/function/gamma_int__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/gcd.mcfunction +7 -0
- package/dist/data/readme_demo/function/gcd__loop_body_5.mcfunction +5 -0
- package/dist/data/readme_demo/function/gcd__loop_exit_6.mcfunction +1 -0
- package/dist/data/readme_demo/function/gcd__loop_header_4.mcfunction +4 -0
- package/dist/data/readme_demo/function/gcd__merge_1.mcfunction +5 -0
- package/dist/data/readme_demo/function/gcd__merge_3.mcfunction +1 -0
- package/dist/data/readme_demo/function/gcd__then_0.mcfunction +4 -0
- package/dist/data/readme_demo/function/gcd__then_2.mcfunction +4 -0
- package/dist/data/readme_demo/function/isqrt.mcfunction +5 -0
- package/dist/data/readme_demo/function/isqrt__loop_body_10.mcfunction +8 -0
- package/dist/data/readme_demo/function/isqrt__loop_body_13.mcfunction +11 -0
- package/dist/data/readme_demo/function/isqrt__loop_body_7.mcfunction +8 -0
- package/dist/data/readme_demo/function/isqrt__loop_exit_11.mcfunction +2 -0
- package/dist/data/readme_demo/function/isqrt__loop_exit_14.mcfunction +1 -0
- package/dist/data/readme_demo/function/isqrt__loop_exit_8.mcfunction +9 -0
- package/dist/data/readme_demo/function/isqrt__loop_header_12.mcfunction +4 -0
- package/dist/data/readme_demo/function/isqrt__loop_header_6.mcfunction +4 -0
- package/dist/data/readme_demo/function/isqrt__loop_header_9.mcfunction +3 -0
- package/dist/data/readme_demo/function/isqrt__merge_1.mcfunction +4 -0
- package/dist/data/readme_demo/function/isqrt__merge_16.mcfunction +5 -0
- package/dist/data/readme_demo/function/isqrt__merge_4.mcfunction +3 -0
- package/dist/data/readme_demo/function/isqrt__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/isqrt__then_15.mcfunction +1 -0
- package/dist/data/readme_demo/function/isqrt__then_3.mcfunction +2 -0
- package/dist/data/readme_demo/function/lcm.mcfunction +11 -0
- package/dist/data/readme_demo/function/lcm__merge_1.mcfunction +5 -0
- package/dist/data/readme_demo/function/lcm__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/lerp.mcfunction +13 -0
- package/dist/data/readme_demo/function/ln.mcfunction +9 -0
- package/dist/data/readme_demo/function/ln__loop_body_1.mcfunction +8 -0
- package/dist/data/readme_demo/function/ln__loop_body_4.mcfunction +8 -0
- package/dist/data/readme_demo/function/ln__loop_exit_2.mcfunction +1 -0
- package/dist/data/readme_demo/function/ln__loop_exit_5.mcfunction +37 -0
- package/dist/data/readme_demo/function/ln__loop_header_0.mcfunction +3 -0
- package/dist/data/readme_demo/function/ln__loop_header_3.mcfunction +6 -0
- package/dist/data/readme_demo/function/load.mcfunction +1 -0
- package/dist/data/readme_demo/function/log10_fx.mcfunction +11 -0
- package/dist/data/readme_demo/function/log2_fx.mcfunction +11 -0
- package/dist/data/readme_demo/function/log2_int.mcfunction +5 -0
- package/dist/data/readme_demo/function/log2_int__loop_body_4.mcfunction +8 -0
- package/dist/data/readme_demo/function/log2_int__loop_exit_5.mcfunction +1 -0
- package/dist/data/readme_demo/function/log2_int__loop_header_3.mcfunction +4 -0
- package/dist/data/readme_demo/function/log2_int__merge_1.mcfunction +3 -0
- package/dist/data/readme_demo/function/log2_int__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/loga_fx.mcfunction +10 -0
- package/dist/data/readme_demo/function/loga_fx__merge_1.mcfunction +9 -0
- package/dist/data/readme_demo/function/loga_fx__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/map.mcfunction +12 -0
- package/dist/data/readme_demo/function/map__merge_1.mcfunction +11 -0
- package/dist/data/readme_demo/function/map__then_0.mcfunction +1 -0
- package/dist/data/readme_demo/function/mulfix.mcfunction +8 -0
- package/dist/data/readme_demo/function/newton_step.mcfunction +7 -0
- package/dist/data/readme_demo/function/newton_step__merge_1.mcfunction +8 -0
- package/dist/data/readme_demo/function/newton_step__then_0.mcfunction +1 -0
- package/dist/data/readme_demo/function/pow_int.mcfunction +6 -0
- package/dist/data/readme_demo/function/pow_int__loop_body_4.mcfunction +7 -0
- package/dist/data/readme_demo/function/pow_int__loop_exit_5.mcfunction +1 -0
- package/dist/data/readme_demo/function/pow_int__loop_header_3.mcfunction +4 -0
- package/dist/data/readme_demo/function/pow_int__merge_1.mcfunction +4 -0
- package/dist/data/readme_demo/function/pow_int__merge_7.mcfunction +8 -0
- package/dist/data/readme_demo/function/pow_int__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/pow_int__then_6.mcfunction +4 -0
- package/dist/data/readme_demo/function/quadratic_disc.mcfunction +12 -0
- package/dist/data/readme_demo/function/quadratic_x1.mcfunction +7 -0
- package/dist/data/readme_demo/function/quadratic_x1__merge_1.mcfunction +13 -0
- package/dist/data/readme_demo/function/quadratic_x1__merge_4.mcfunction +15 -0
- package/dist/data/readme_demo/function/quadratic_x1__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/quadratic_x1__then_3.mcfunction +2 -0
- package/dist/data/readme_demo/function/quadratic_x2.mcfunction +7 -0
- package/dist/data/readme_demo/function/quadratic_x2__merge_1.mcfunction +13 -0
- package/dist/data/readme_demo/function/quadratic_x2__merge_4.mcfunction +15 -0
- package/dist/data/readme_demo/function/quadratic_x2__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/quadratic_x2__then_3.mcfunction +2 -0
- package/dist/data/readme_demo/function/sign.mcfunction +5 -0
- package/dist/data/readme_demo/function/sign__merge_1.mcfunction +4 -0
- package/dist/data/readme_demo/function/sign__merge_4.mcfunction +2 -0
- package/dist/data/readme_demo/function/sign__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/sign__then_3.mcfunction +2 -0
- package/dist/data/readme_demo/function/simpson_step.mcfunction +16 -0
- package/dist/data/readme_demo/function/sin_fixed.mcfunction +9 -0
- package/dist/data/readme_demo/function/sin_fixed__merge_1.mcfunction +4 -0
- package/dist/data/readme_demo/function/sin_fixed__merge_3.mcfunction +4 -0
- package/dist/data/readme_demo/function/sin_fixed__merge_6.mcfunction +4 -0
- package/dist/data/readme_demo/function/sin_fixed__merge_9.mcfunction +10 -0
- package/dist/data/readme_demo/function/sin_fixed__then_0.mcfunction +4 -0
- package/dist/data/readme_demo/function/sin_fixed__then_2.mcfunction +6 -0
- package/dist/data/readme_demo/function/sin_fixed__then_5.mcfunction +8 -0
- package/dist/data/readme_demo/function/sin_fixed__then_8.mcfunction +10 -0
- package/dist/data/readme_demo/function/smootherstep.mcfunction +10 -0
- package/dist/data/readme_demo/function/smootherstep__merge_1.mcfunction +12 -0
- package/dist/data/readme_demo/function/smootherstep__merge_4.mcfunction +4 -0
- package/dist/data/readme_demo/function/smootherstep__merge_6.mcfunction +27 -0
- package/dist/data/readme_demo/function/smootherstep__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/smootherstep__then_3.mcfunction +2 -0
- package/dist/data/readme_demo/function/smootherstep__then_5.mcfunction +2 -0
- package/dist/data/readme_demo/function/smoothstep.mcfunction +10 -0
- package/dist/data/readme_demo/function/smoothstep__merge_1.mcfunction +12 -0
- package/dist/data/readme_demo/function/smoothstep__merge_4.mcfunction +4 -0
- package/dist/data/readme_demo/function/smoothstep__merge_6.mcfunction +15 -0
- package/dist/data/readme_demo/function/smoothstep__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/smoothstep__then_3.mcfunction +2 -0
- package/dist/data/readme_demo/function/smoothstep__then_5.mcfunction +2 -0
- package/dist/data/readme_demo/function/solve2x2_x.mcfunction +17 -0
- package/dist/data/readme_demo/function/solve2x2_x__merge_1.mcfunction +12 -0
- package/dist/data/readme_demo/function/solve2x2_x__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/solve2x2_y.mcfunction +17 -0
- package/dist/data/readme_demo/function/solve2x2_y__merge_1.mcfunction +12 -0
- package/dist/data/readme_demo/function/solve2x2_y__then_0.mcfunction +2 -0
- package/dist/data/readme_demo/function/sqrt_fixed.mcfunction +8 -0
- package/dist/data/readme_demo/function/sqrt_fx.mcfunction +8 -0
- package/dist/data/readme_demo/function/start.mcfunction +2 -0
- package/dist/data/readme_demo/function/stop.mcfunction +1 -0
- package/dist/data/readme_demo/function/trapezoid_step.mcfunction +11 -0
- package/dist/data/stdextra/function/__load.mcfunction +2 -0
- package/dist/data/stdextra/function/load.mcfunction +1 -0
- package/dist/data/stdextra/function/test_bigint.mcfunction +52 -0
- package/dist/data/stdextra/function/test_bits.mcfunction +33 -0
- package/dist/data/stdextra/function/test_list_sort.mcfunction +55 -0
- package/dist/data/stdextra/function/test_random.mcfunction +17 -0
- package/dist/data/stdextra/function/test_random__merge_1.mcfunction +4 -0
- package/dist/data/stdextra/function/test_random__merge_11.mcfunction +1 -0
- package/dist/data/stdextra/function/test_random__merge_3.mcfunction +14 -0
- package/dist/data/stdextra/function/test_random__merge_5.mcfunction +8 -0
- package/dist/data/stdextra/function/test_random__merge_7.mcfunction +1 -0
- package/dist/data/stdextra/function/test_random__merge_9.mcfunction +1 -0
- package/dist/data/stdextra/function/test_random__then_0.mcfunction +4 -0
- package/dist/data/stdextra/function/test_random__then_10.mcfunction +2 -0
- package/dist/data/stdextra/function/test_random__then_2.mcfunction +2 -0
- package/dist/data/stdextra/function/test_random__then_4.mcfunction +4 -0
- package/dist/data/stdextra/function/test_random__then_6.mcfunction +2 -0
- package/dist/data/stdextra/function/test_random__then_8.mcfunction +4 -0
- package/dist/data/test/function/__dyn_idx_test_arrays_nums.mcfunction +1 -0
- package/dist/data/test/function/__dyn_idx_test_arrays_parent.mcfunction +1 -0
- package/dist/data/test/function/__dyn_idx_test_arrays_queue.mcfunction +1 -0
- package/dist/data/test/function/__dyn_idx_test_arrays_rev.mcfunction +1 -0
- package/dist/data/test/function/__dyn_idx_test_arrays_visited.mcfunction +1 -0
- package/dist/data/test/function/__dyn_wrt_test_arrays_parent.mcfunction +1 -0
- package/dist/data/test/function/__dyn_wrt_test_arrays_visited.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1.mcfunction +2 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1__loop_body_1.mcfunction +17 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1__loop_body_1_continue.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1__loop_body_1_yield.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1__loop_header_0.mcfunction +4 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1__loop_header_0_exit.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2.mcfunction +2 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__else_8.mcfunction +19 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__loop_body_4.mcfunction +9 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__loop_header_3.mcfunction +3 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__loop_header_3_exit.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_10.mcfunction +11 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_12.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_14.mcfunction +11 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_16.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_18.mcfunction +11 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_20.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_22.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_24.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_7.mcfunction +6 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_7_continue.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_7_yield.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_11.mcfunction +15 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_13.mcfunction +13 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_15.mcfunction +15 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_17.mcfunction +13 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_19.mcfunction +15 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_21.mcfunction +13 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_23.mcfunction +15 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_6.mcfunction +2 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_9.mcfunction +13 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3.mcfunction +2 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__else_32.mcfunction +4 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__loop_body_28.mcfunction +6 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__loop_header_27.mcfunction +4 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__loop_header_27_exit.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__merge_31.mcfunction +6 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__merge_31_continue.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__merge_31_yield.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__then_30.mcfunction +2 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4.mcfunction +2 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4__loop_body_34.mcfunction +16 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4__loop_body_34_continue.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4__loop_body_34_yield.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4__loop_header_33.mcfunction +4 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4__loop_header_33_exit.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_5.mcfunction +16 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_5__merge_26.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_tick.mcfunction +4 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__call_1.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__call_2.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__call_3.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__call_4.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__call_5.mcfunction +1 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__check_2.mcfunction +4 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__check_3.mcfunction +4 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__check_4.mcfunction +4 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__check_5.mcfunction +4 -0
- package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__done.mcfunction +1 -0
- package/dist/data/test/function/_hsl_chroma_x.mcfunction +1 -2
- package/dist/data/test/function/aabb_contains.mcfunction +1 -2
- package/dist/data/test/function/aabb_contains__merge_1.mcfunction +1 -2
- package/dist/data/test/function/aabb_contains__merge_10.mcfunction +1 -2
- package/dist/data/test/function/aabb_contains__merge_13.mcfunction +1 -2
- package/dist/data/test/function/aabb_contains__merge_4.mcfunction +1 -2
- package/dist/data/test/function/aabb_contains__merge_7.mcfunction +1 -2
- package/dist/data/test/function/acos_approx.mcfunction +7 -0
- package/dist/data/test/function/add_to_team.mcfunction +5 -0
- package/dist/data/test/function/angle_diff.mcfunction +1 -2
- package/dist/data/test/function/angle_normalize__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/angle_normalize__loop_header_3.mcfunction +1 -2
- package/dist/data/test/function/angry_at.mcfunction +1 -0
- package/dist/data/test/function/apply_damage.mcfunction +12 -0
- package/dist/data/test/function/apply_damage__else_2.mcfunction +2 -0
- package/dist/data/test/function/apply_damage__merge_1.mcfunction +1 -0
- package/dist/data/test/function/apply_damage__then_0.mcfunction +2 -0
- package/dist/data/test/function/arr_test.mcfunction +4 -0
- package/dist/data/test/function/asin_approx.mcfunction +5 -0
- package/dist/data/test/function/asin_approx__merge_1.mcfunction +3 -0
- package/dist/data/test/function/asin_approx__merge_10.mcfunction +5 -0
- package/dist/data/test/function/asin_approx__merge_4.mcfunction +12 -0
- package/dist/data/test/function/asin_approx__merge_7.mcfunction +14 -0
- package/dist/data/test/function/asin_approx__then_0.mcfunction +2 -0
- package/dist/data/test/function/asin_approx__then_3.mcfunction +2 -0
- package/dist/data/test/function/asin_approx__then_6.mcfunction +2 -0
- package/dist/data/test/function/asin_approx__then_9.mcfunction +2 -0
- package/dist/data/test/function/barrier_wall.mcfunction +1 -0
- package/dist/data/test/function/bernoulli.mcfunction +1 -2
- package/dist/data/test/function/bernoulli__merge_1.mcfunction +1 -2
- package/dist/data/test/function/bigint_chunk.mcfunction +2 -0
- package/dist/data/test/function/bigint_div_small.mcfunction +6 -0
- package/dist/data/test/function/bigint_div_small__loop_body_1.mcfunction +12 -0
- package/dist/data/test/function/bigint_div_small__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/bigint_div_small__loop_header_0.mcfunction +3 -0
- package/dist/data/test/function/bigint_mod_small.mcfunction +6 -0
- package/dist/data/test/function/bigint_mod_small__loop_body_1.mcfunction +12 -0
- package/dist/data/test/function/bigint_mod_small__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/bigint_mod_small__loop_header_0.mcfunction +3 -0
- package/dist/data/test/function/bit_and__loop_body_1.mcfunction +1 -2
- package/dist/data/test/function/bit_and__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/bit_and__then_3.mcfunction +1 -2
- package/dist/data/test/function/bit_clear__loop_exit_2.mcfunction +1 -2
- package/dist/data/test/function/bit_clear__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/bit_get__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/bit_not__loop_body_1.mcfunction +1 -2
- package/dist/data/test/function/bit_not__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/bit_or__loop_body_1.mcfunction +1 -2
- package/dist/data/test/function/bit_or__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/bit_or__merge_4.mcfunction +1 -2
- package/dist/data/test/function/bit_or__then_5.mcfunction +1 -2
- package/dist/data/test/function/bit_set__loop_exit_2.mcfunction +1 -2
- package/dist/data/test/function/bit_set__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/bit_shl__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/bit_shr__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/bit_toggle__loop_exit_2.mcfunction +1 -2
- package/dist/data/test/function/bit_toggle__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/bit_xor__loop_body_1.mcfunction +1 -2
- package/dist/data/test/function/bit_xor__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/buff_all.mcfunction +22 -0
- package/dist/data/test/function/cbrt_newton.mcfunction +5 -0
- package/dist/data/test/function/cbrt_newton__else_7.mcfunction +2 -0
- package/dist/data/test/function/cbrt_newton__merge_1.mcfunction +11 -0
- package/dist/data/test/function/cbrt_newton__merge_4.mcfunction +1 -0
- package/dist/data/test/function/cbrt_newton__merge_6.mcfunction +1 -0
- package/dist/data/test/function/cbrt_newton__then_0.mcfunction +2 -0
- package/dist/data/test/function/cbrt_newton__then_3.mcfunction +17 -0
- package/dist/data/test/function/cbrt_newton__then_5.mcfunction +11 -0
- package/dist/data/test/function/check_holding_item.mcfunction +1 -0
- package/dist/data/test/function/check_look_down.mcfunction +1 -0
- package/dist/data/test/function/check_look_down__foreach_t0.mcfunction +2 -0
- package/dist/data/test/function/check_look_straight.mcfunction +1 -0
- package/dist/data/test/function/check_look_straight__foreach_t0.mcfunction +2 -0
- package/dist/data/test/function/check_look_up.mcfunction +1 -0
- package/dist/data/test/function/check_look_up__foreach_t0.mcfunction +2 -0
- package/dist/data/test/function/cleanup_teams.mcfunction +8 -0
- package/dist/data/test/function/clear_area.mcfunction +1 -0
- package/dist/data/test/function/clear_effect.mcfunction +1 -0
- package/dist/data/test/function/clear_effects.mcfunction +1 -0
- package/dist/data/test/function/clear_inventory.mcfunction +1 -0
- package/dist/data/test/function/cooldown_ready.mcfunction +7 -0
- package/dist/data/test/function/cooldown_ready__merge_1.mcfunction +4 -0
- package/dist/data/test/function/cooldown_ready__merge_4.mcfunction +2 -0
- package/dist/data/test/function/cooldown_ready__then_0.mcfunction +2 -0
- package/dist/data/test/function/cooldown_ready__then_3.mcfunction +2 -0
- package/dist/data/test/function/cooldown_start.mcfunction +3 -0
- package/dist/data/test/function/cooldown_tick.mcfunction +7 -0
- package/dist/data/test/function/cooldown_tick__else_5.mcfunction +2 -0
- package/dist/data/test/function/cooldown_tick__merge_1.mcfunction +4 -0
- package/dist/data/test/function/cooldown_tick__merge_4.mcfunction +1 -0
- package/dist/data/test/function/cooldown_tick__merge_7.mcfunction +1 -0
- package/dist/data/test/function/cooldown_tick__then_0.mcfunction +1 -0
- package/dist/data/test/function/cooldown_tick__then_3.mcfunction +7 -0
- package/dist/data/test/function/cooldown_tick__then_6.mcfunction +2 -0
- package/dist/data/test/function/cos_hp.mcfunction +4 -2
- package/dist/data/test/function/create_blue_team.mcfunction +10 -0
- package/dist/data/test/function/create_green_team.mcfunction +10 -0
- package/dist/data/test/function/create_health_bar.mcfunction +24 -0
- package/dist/data/test/function/create_progress_bar.mcfunction +24 -0
- package/dist/data/test/function/create_red_team.mcfunction +10 -0
- package/dist/data/test/function/create_team.mcfunction +8 -0
- package/dist/data/test/function/create_timer_bar.mcfunction +30 -0
- package/dist/data/test/function/create_yellow_team.mcfunction +10 -0
- package/dist/data/test/function/cubic_disc_fx.mcfunction +26 -0
- package/dist/data/test/function/cubic_newton.mcfunction +8 -0
- package/dist/data/test/function/cubic_newton__loop_body_1.mcfunction +55 -0
- package/dist/data/test/function/cubic_newton__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/cubic_newton__loop_header_0.mcfunction +4 -0
- package/dist/data/test/function/cubic_newton__merge_10.mcfunction +1 -0
- package/dist/data/test/function/cubic_newton__merge_4.mcfunction +4 -0
- package/dist/data/test/function/cubic_newton__merge_6.mcfunction +4 -0
- package/dist/data/test/function/cubic_newton__merge_8.mcfunction +4 -0
- package/dist/data/test/function/cubic_newton__then_3.mcfunction +2 -0
- package/dist/data/test/function/cubic_newton__then_5.mcfunction +13 -0
- package/dist/data/test/function/cubic_newton__then_7.mcfunction +4 -0
- package/dist/data/test/function/cubic_newton__then_9.mcfunction +2 -0
- package/dist/data/test/function/curve_length_2d.mcfunction +6 -0
- package/dist/data/test/function/curve_length_2d__loop_body_1.mcfunction +32 -0
- package/dist/data/test/function/curve_length_2d__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/curve_length_2d__loop_header_0.mcfunction +5 -0
- package/dist/data/test/function/cylinder_contains.mcfunction +1 -2
- package/dist/data/test/function/damage.mcfunction +9 -0
- package/dist/data/test/function/damage__else_2.mcfunction +2 -0
- package/dist/data/test/function/damage__merge_1.mcfunction +1 -0
- package/dist/data/test/function/damage__then_0.mcfunction +2 -0
- package/dist/data/test/function/deriv_central.mcfunction +7 -0
- package/dist/data/test/function/deriv_central__merge_1.mcfunction +10 -0
- package/dist/data/test/function/deriv_central__then_0.mcfunction +2 -0
- package/dist/data/test/function/deriv_forward.mcfunction +7 -0
- package/dist/data/test/function/deriv_forward__merge_1.mcfunction +8 -0
- package/dist/data/test/function/deriv_forward__then_0.mcfunction +2 -0
- package/dist/data/test/function/disable_fire_spread.mcfunction +1 -0
- package/dist/data/test/function/disable_keep_inventory.mcfunction +1 -0
- package/dist/data/test/function/disable_mob_griefing.mcfunction +1 -0
- package/dist/data/test/function/div3_hp.mcfunction +23 -0
- package/dist/data/test/function/div_hp.mcfunction +13 -0
- package/dist/data/test/function/draw_circle.mcfunction +8 -0
- package/dist/data/test/function/draw_circle__loop_body_1.mcfunction +34 -0
- package/dist/data/test/function/draw_circle__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/draw_circle__loop_header_0.mcfunction +3 -0
- package/dist/data/test/function/draw_helix.mcfunction +10 -0
- package/dist/data/test/function/draw_helix__loop_body_1.mcfunction +42 -0
- package/dist/data/test/function/draw_helix__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/draw_helix__loop_header_0.mcfunction +3 -0
- package/dist/data/test/function/draw_line_2d.mcfunction +9 -0
- package/dist/data/test/function/draw_line_2d__loop_body_1.mcfunction +34 -0
- package/dist/data/test/function/draw_line_2d__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/draw_line_2d__loop_header_0.mcfunction +3 -0
- package/dist/data/test/function/ease_in_expo.mcfunction +1 -2
- package/dist/data/test/function/ease_in_out_back.mcfunction +1 -2
- package/dist/data/test/function/ease_in_out_bounce.mcfunction +1 -2
- package/dist/data/test/function/ease_in_out_cubic.mcfunction +1 -2
- package/dist/data/test/function/ease_in_out_quad.mcfunction +1 -2
- package/dist/data/test/function/ease_in_out_sine.mcfunction +1 -2
- package/dist/data/test/function/ease_out_bounce.mcfunction +1 -2
- package/dist/data/test/function/ease_out_bounce__merge_1.mcfunction +1 -2
- package/dist/data/test/function/ease_out_bounce__merge_4.mcfunction +1 -2
- package/dist/data/test/function/ease_out_expo.mcfunction +1 -2
- package/dist/data/test/function/enable_keep_inventory.mcfunction +1 -0
- package/dist/data/test/function/end_sparkles_at.mcfunction +1 -0
- package/dist/data/test/function/enemy_health.mcfunction +2 -0
- package/dist/data/test/function/example_right_click.mcfunction +1 -0
- package/dist/data/test/function/example_right_click__foreach_t0.mcfunction +5 -0
- package/dist/data/test/function/example_right_click__foreach_t0__merge_1.mcfunction +1 -0
- package/dist/data/test/function/example_right_click__foreach_t0__then_0.mcfunction +3 -0
- package/dist/data/test/function/exp_dist_approx.mcfunction +1 -2
- package/dist/data/test/function/exp_dist_approx__merge_1.mcfunction +1 -2
- package/dist/data/test/function/exp_dist_approx__merge_3.mcfunction +1 -2
- package/dist/data/test/function/explosion_effect.mcfunction +1 -0
- package/dist/data/test/function/fbm_1d__loop_exit_2.mcfunction +1 -2
- package/dist/data/test/function/fbm_1d__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/fbm_2d__loop_exit_2.mcfunction +1 -2
- package/dist/data/test/function/fbm_2d__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/flames.mcfunction +1 -0
- package/dist/data/test/function/gather_all.mcfunction +8 -0
- package/dist/data/test/function/give_kit_archer.mcfunction +6 -0
- package/dist/data/test/function/give_kit_mage.mcfunction +5 -0
- package/dist/data/test/function/give_kit_warrior.mcfunction +6 -0
- package/dist/data/test/function/glass_box.mcfunction +2 -0
- package/dist/data/test/function/glow.mcfunction +1 -0
- package/dist/data/test/function/goto_arena.mcfunction +7 -0
- package/dist/data/test/function/goto_lobby.mcfunction +7 -0
- package/dist/data/test/function/happy_at.mcfunction +1 -0
- package/dist/data/test/function/hash_1d_pos.mcfunction +1 -2
- package/dist/data/test/function/hash_2d_pos.mcfunction +1 -2
- package/dist/data/test/function/heal.mcfunction +5 -0
- package/dist/data/test/function/heap_new.mcfunction +7 -0
- package/dist/data/test/function/heap_new__loop_body_1.mcfunction +7 -0
- package/dist/data/test/function/heap_new__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/heap_new__loop_header_0.mcfunction +4 -0
- package/dist/data/test/function/heap_peek.mcfunction +2 -0
- package/dist/data/test/function/heap_pop.mcfunction +4 -0
- package/dist/data/test/function/heap_pop__else_13.mcfunction +2 -0
- package/dist/data/test/function/heap_pop__loop_body_1.mcfunction +14 -0
- package/dist/data/test/function/heap_pop__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/heap_pop__loop_header_0.mcfunction +4 -0
- package/dist/data/test/function/heap_pop__merge_10.mcfunction +1 -0
- package/dist/data/test/function/heap_pop__merge_12.mcfunction +1 -0
- package/dist/data/test/function/heap_pop__merge_4.mcfunction +3 -0
- package/dist/data/test/function/heap_pop__merge_6.mcfunction +1 -0
- package/dist/data/test/function/heap_pop__merge_8.mcfunction +3 -0
- package/dist/data/test/function/heap_pop__then_11.mcfunction +2 -0
- package/dist/data/test/function/heap_pop__then_3.mcfunction +3 -0
- package/dist/data/test/function/heap_pop__then_5.mcfunction +2 -0
- package/dist/data/test/function/heap_pop__then_7.mcfunction +3 -0
- package/dist/data/test/function/heap_pop__then_9.mcfunction +2 -0
- package/dist/data/test/function/heap_push.mcfunction +6 -0
- package/dist/data/test/function/heap_push__else_5.mcfunction +2 -0
- package/dist/data/test/function/heap_push__else_8.mcfunction +2 -0
- package/dist/data/test/function/heap_push__loop_body_1.mcfunction +4 -0
- package/dist/data/test/function/heap_push__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/heap_push__loop_header_0.mcfunction +4 -0
- package/dist/data/test/function/heap_push__merge_4.mcfunction +1 -0
- package/dist/data/test/function/heap_push__merge_7.mcfunction +1 -0
- package/dist/data/test/function/heap_push__then_3.mcfunction +7 -0
- package/dist/data/test/function/heap_push__then_6.mcfunction +2 -0
- package/dist/data/test/function/heap_size.mcfunction +2 -0
- package/dist/data/test/function/hearts_at.mcfunction +1 -0
- package/dist/data/test/function/hide_bar.mcfunction +4 -0
- package/dist/data/test/function/hsl_to_b.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_b__merge_1.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_b__merge_12.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_b__merge_3.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_b__merge_6.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_b__merge_9.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_g.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_g__merge_1.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_g__merge_12.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_g__merge_3.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_g__merge_6.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_g__merge_9.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_r.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_r__merge_1.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_r__merge_12.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_r__merge_3.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_r__merge_6.mcfunction +1 -2
- package/dist/data/test/function/hsl_to_r__merge_9.mcfunction +1 -2
- package/dist/data/test/function/init_div.mcfunction +1 -0
- package/dist/data/test/function/insertion_sort.mcfunction +4 -0
- package/dist/data/test/function/insertion_sort__else_11.mcfunction +2 -0
- package/dist/data/test/function/insertion_sort__else_8.mcfunction +2 -0
- package/dist/data/test/function/insertion_sort__loop_body_1.mcfunction +6 -0
- package/dist/data/test/function/insertion_sort__loop_body_4.mcfunction +4 -0
- package/dist/data/test/function/insertion_sort__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/insertion_sort__loop_exit_5.mcfunction +4 -0
- package/dist/data/test/function/insertion_sort__loop_header_0.mcfunction +3 -0
- package/dist/data/test/function/insertion_sort__loop_header_3.mcfunction +4 -0
- package/dist/data/test/function/insertion_sort__merge_10.mcfunction +1 -0
- package/dist/data/test/function/insertion_sort__merge_7.mcfunction +1 -0
- package/dist/data/test/function/insertion_sort__then_6.mcfunction +3 -0
- package/dist/data/test/function/insertion_sort__then_9.mcfunction +4 -0
- package/dist/data/test/function/insertion_sort_desc.mcfunction +4 -0
- package/dist/data/test/function/insertion_sort_desc__else_11.mcfunction +2 -0
- package/dist/data/test/function/insertion_sort_desc__else_8.mcfunction +2 -0
- package/dist/data/test/function/insertion_sort_desc__loop_body_1.mcfunction +6 -0
- package/dist/data/test/function/insertion_sort_desc__loop_body_4.mcfunction +4 -0
- package/dist/data/test/function/insertion_sort_desc__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/insertion_sort_desc__loop_exit_5.mcfunction +4 -0
- package/dist/data/test/function/insertion_sort_desc__loop_header_0.mcfunction +3 -0
- package/dist/data/test/function/insertion_sort_desc__loop_header_3.mcfunction +4 -0
- package/dist/data/test/function/insertion_sort_desc__merge_10.mcfunction +1 -0
- package/dist/data/test/function/insertion_sort_desc__merge_7.mcfunction +1 -0
- package/dist/data/test/function/insertion_sort_desc__then_6.mcfunction +3 -0
- package/dist/data/test/function/insertion_sort_desc__then_9.mcfunction +4 -0
- package/dist/data/test/function/integrate_simpson.mcfunction +7 -0
- package/dist/data/test/function/integrate_simpson__loop_body_6.mcfunction +7 -0
- package/dist/data/test/function/integrate_simpson__loop_exit_7.mcfunction +6 -0
- package/dist/data/test/function/integrate_simpson__loop_header_5.mcfunction +5 -0
- package/dist/data/test/function/integrate_simpson__merge_1.mcfunction +8 -0
- package/dist/data/test/function/integrate_simpson__merge_11.mcfunction +4 -0
- package/dist/data/test/function/integrate_simpson__merge_4.mcfunction +5 -0
- package/dist/data/test/function/integrate_simpson__merge_9.mcfunction +7 -0
- package/dist/data/test/function/integrate_simpson__then_0.mcfunction +6 -0
- package/dist/data/test/function/integrate_simpson__then_10.mcfunction +6 -0
- package/dist/data/test/function/integrate_simpson__then_3.mcfunction +4 -0
- package/dist/data/test/function/integrate_simpson__then_8.mcfunction +6 -0
- package/dist/data/test/function/integrate_trapezoid.mcfunction +7 -0
- package/dist/data/test/function/integrate_trapezoid__loop_body_4.mcfunction +7 -0
- package/dist/data/test/function/integrate_trapezoid__loop_exit_5.mcfunction +6 -0
- package/dist/data/test/function/integrate_trapezoid__loop_header_3.mcfunction +5 -0
- package/dist/data/test/function/integrate_trapezoid__merge_1.mcfunction +11 -0
- package/dist/data/test/function/integrate_trapezoid__then_0.mcfunction +2 -0
- package/dist/data/test/function/interactions_init.mcfunction +9 -0
- package/dist/data/test/function/invisible.mcfunction +1 -0
- package/dist/data/test/function/is_op.mcfunction +2 -0
- package/dist/data/test/function/is_op__exec_t1.mcfunction +1 -0
- package/dist/data/test/function/is_sneaking.mcfunction +5 -0
- package/dist/data/test/function/is_sneaking__merge_1.mcfunction +2 -0
- package/dist/data/test/function/is_sneaking__then_0.mcfunction +2 -0
- package/dist/data/test/function/jump.mcfunction +1 -0
- package/dist/data/test/function/launch_up.mcfunction +6 -0
- package/dist/data/test/function/list_max3.mcfunction +1 -2
- package/dist/data/test/function/list_max3__merge_1.mcfunction +1 -2
- package/dist/data/test/function/list_max5.mcfunction +1 -2
- package/dist/data/test/function/list_max5__merge_1.mcfunction +1 -2
- package/dist/data/test/function/list_max5__merge_3.mcfunction +1 -2
- package/dist/data/test/function/list_max5__merge_5.mcfunction +1 -2
- package/dist/data/test/function/list_min3.mcfunction +1 -2
- package/dist/data/test/function/list_min3__merge_1.mcfunction +1 -2
- package/dist/data/test/function/list_min5.mcfunction +1 -2
- package/dist/data/test/function/list_min5__merge_1.mcfunction +1 -2
- package/dist/data/test/function/list_min5__merge_3.mcfunction +1 -2
- package/dist/data/test/function/list_min5__merge_5.mcfunction +1 -2
- package/dist/data/test/function/list_sort_asc__loop_body_4.mcfunction +1 -2
- package/dist/data/test/function/list_sort_asc__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/list_sort_asc__loop_header_3.mcfunction +1 -2
- package/dist/data/test/function/list_sort_desc__loop_body_4.mcfunction +1 -2
- package/dist/data/test/function/list_sort_desc__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/list_sort_desc__loop_header_3.mcfunction +1 -2
- package/dist/data/test/function/max_heap_pop.mcfunction +4 -0
- package/dist/data/test/function/max_heap_pop__else_13.mcfunction +2 -0
- package/dist/data/test/function/max_heap_pop__loop_body_1.mcfunction +14 -0
- package/dist/data/test/function/max_heap_pop__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/max_heap_pop__loop_header_0.mcfunction +4 -0
- package/dist/data/test/function/max_heap_pop__merge_10.mcfunction +1 -0
- package/dist/data/test/function/max_heap_pop__merge_12.mcfunction +1 -0
- package/dist/data/test/function/max_heap_pop__merge_4.mcfunction +3 -0
- package/dist/data/test/function/max_heap_pop__merge_6.mcfunction +1 -0
- package/dist/data/test/function/max_heap_pop__merge_8.mcfunction +3 -0
- package/dist/data/test/function/max_heap_pop__then_11.mcfunction +2 -0
- package/dist/data/test/function/max_heap_pop__then_3.mcfunction +3 -0
- package/dist/data/test/function/max_heap_pop__then_5.mcfunction +2 -0
- package/dist/data/test/function/max_heap_pop__then_7.mcfunction +3 -0
- package/dist/data/test/function/max_heap_pop__then_9.mcfunction +2 -0
- package/dist/data/test/function/max_heap_push.mcfunction +6 -0
- package/dist/data/test/function/max_heap_push__else_5.mcfunction +2 -0
- package/dist/data/test/function/max_heap_push__else_8.mcfunction +2 -0
- package/dist/data/test/function/max_heap_push__loop_body_1.mcfunction +4 -0
- package/dist/data/test/function/max_heap_push__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/max_heap_push__loop_header_0.mcfunction +4 -0
- package/dist/data/test/function/max_heap_push__merge_4.mcfunction +1 -0
- package/dist/data/test/function/max_heap_push__merge_7.mcfunction +1 -0
- package/dist/data/test/function/max_heap_push__then_3.mcfunction +7 -0
- package/dist/data/test/function/max_heap_push__then_6.mcfunction +2 -0
- package/dist/data/test/function/newton_step.mcfunction +7 -0
- package/dist/data/test/function/newton_step__merge_1.mcfunction +8 -0
- package/dist/data/test/function/newton_step__then_0.mcfunction +1 -0
- package/dist/data/test/function/night_vision.mcfunction +1 -0
- package/dist/data/test/function/norm3_hp.mcfunction +43 -0
- package/dist/data/test/function/normal_approx12.mcfunction +1 -2
- package/dist/data/test/function/normal_approx12__merge_1.mcfunction +1 -2
- package/dist/data/test/function/normal_approx12__merge_11.mcfunction +1 -2
- package/dist/data/test/function/normal_approx12__merge_13.mcfunction +1 -2
- package/dist/data/test/function/normal_approx12__merge_15.mcfunction +1 -2
- package/dist/data/test/function/normal_approx12__merge_17.mcfunction +1 -2
- package/dist/data/test/function/normal_approx12__merge_19.mcfunction +1 -2
- package/dist/data/test/function/normal_approx12__merge_21.mcfunction +1 -2
- package/dist/data/test/function/normal_approx12__merge_3.mcfunction +1 -2
- package/dist/data/test/function/normal_approx12__merge_5.mcfunction +1 -2
- package/dist/data/test/function/normal_approx12__merge_7.mcfunction +1 -2
- package/dist/data/test/function/normal_approx12__merge_9.mcfunction +1 -2
- package/dist/data/test/function/on_double_sneak.mcfunction +1 -0
- package/dist/data/test/function/on_double_sneak__foreach_t0.mcfunction +9 -0
- package/dist/data/test/function/on_double_sneak__foreach_t0__merge_1.mcfunction +1 -0
- package/dist/data/test/function/on_double_sneak__foreach_t0__merge_3.mcfunction +2 -0
- package/dist/data/test/function/on_double_sneak__foreach_t0__then_0.mcfunction +6 -0
- package/dist/data/test/function/on_double_sneak__foreach_t0__then_2.mcfunction +2 -0
- package/dist/data/test/function/on_right_click.mcfunction +1 -0
- package/dist/data/test/function/on_right_click__foreach_t1.mcfunction +5 -0
- package/dist/data/test/function/on_right_click__foreach_t1__merge_1.mcfunction +1 -0
- package/dist/data/test/function/on_right_click__foreach_t1__then_0.mcfunction +3 -0
- package/dist/data/test/function/on_sneak_click.mcfunction +1 -0
- package/dist/data/test/function/on_sneak_click__foreach_t0.mcfunction +7 -0
- package/dist/data/test/function/on_sneak_click__foreach_t0__else_4.mcfunction +3 -0
- package/dist/data/test/function/on_sneak_click__foreach_t0__merge_1.mcfunction +1 -0
- package/dist/data/test/function/on_sneak_click__foreach_t0__merge_3.mcfunction +1 -0
- package/dist/data/test/function/on_sneak_click__foreach_t0__then_0.mcfunction +4 -0
- package/dist/data/test/function/on_sneak_click__foreach_t0__then_2.mcfunction +3 -0
- package/dist/data/test/function/on_sneak_start.mcfunction +1 -0
- package/dist/data/test/function/on_sneak_start__foreach_t0.mcfunction +5 -0
- package/dist/data/test/function/on_sneak_start__foreach_t0__else_2.mcfunction +2 -0
- package/dist/data/test/function/on_sneak_start__foreach_t0__merge_1.mcfunction +1 -0
- package/dist/data/test/function/on_sneak_start__foreach_t0__then_0.mcfunction +2 -0
- package/dist/data/test/function/particle_at_fx.mcfunction +1 -0
- package/dist/data/test/function/particle_dot.mcfunction +1 -0
- package/dist/data/test/function/pathfind_bfs.mcfunction +11 -0
- package/dist/data/test/function/pathfind_bfs__else_33.mcfunction +4 -0
- package/dist/data/test/function/pathfind_bfs__else_8.mcfunction +19 -0
- package/dist/data/test/function/pathfind_bfs__loop_body_1.mcfunction +10 -0
- package/dist/data/test/function/pathfind_bfs__loop_body_29.mcfunction +6 -0
- package/dist/data/test/function/pathfind_bfs__loop_body_35.mcfunction +9 -0
- package/dist/data/test/function/pathfind_bfs__loop_body_4.mcfunction +9 -0
- package/dist/data/test/function/pathfind_bfs__loop_exit_2.mcfunction +24 -0
- package/dist/data/test/function/pathfind_bfs__loop_exit_30.mcfunction +6 -0
- package/dist/data/test/function/pathfind_bfs__loop_exit_36.mcfunction +1 -0
- package/dist/data/test/function/pathfind_bfs__loop_exit_5.mcfunction +6 -0
- package/dist/data/test/function/pathfind_bfs__loop_header_0.mcfunction +4 -0
- package/dist/data/test/function/pathfind_bfs__loop_header_28.mcfunction +4 -0
- package/dist/data/test/function/pathfind_bfs__loop_header_3.mcfunction +3 -0
- package/dist/data/test/function/pathfind_bfs__loop_header_34.mcfunction +4 -0
- package/dist/data/test/function/pathfind_bfs__merge_10.mcfunction +11 -0
- package/dist/data/test/function/pathfind_bfs__merge_12.mcfunction +1 -0
- package/dist/data/test/function/pathfind_bfs__merge_14.mcfunction +11 -0
- package/dist/data/test/function/pathfind_bfs__merge_16.mcfunction +1 -0
- package/dist/data/test/function/pathfind_bfs__merge_18.mcfunction +11 -0
- package/dist/data/test/function/pathfind_bfs__merge_20.mcfunction +1 -0
- package/dist/data/test/function/pathfind_bfs__merge_22.mcfunction +1 -0
- package/dist/data/test/function/pathfind_bfs__merge_24.mcfunction +1 -0
- package/dist/data/test/function/pathfind_bfs__merge_26.mcfunction +5 -0
- package/dist/data/test/function/pathfind_bfs__merge_32.mcfunction +1 -0
- package/dist/data/test/function/pathfind_bfs__merge_7.mcfunction +1 -0
- package/dist/data/test/function/pathfind_bfs__then_11.mcfunction +15 -0
- package/dist/data/test/function/pathfind_bfs__then_13.mcfunction +13 -0
- package/dist/data/test/function/pathfind_bfs__then_15.mcfunction +15 -0
- package/dist/data/test/function/pathfind_bfs__then_17.mcfunction +13 -0
- package/dist/data/test/function/pathfind_bfs__then_19.mcfunction +15 -0
- package/dist/data/test/function/pathfind_bfs__then_21.mcfunction +13 -0
- package/dist/data/test/function/pathfind_bfs__then_23.mcfunction +15 -0
- package/dist/data/test/function/pathfind_bfs__then_25.mcfunction +1 -0
- package/dist/data/test/function/pathfind_bfs__then_31.mcfunction +2 -0
- package/dist/data/test/function/pathfind_bfs__then_6.mcfunction +3 -0
- package/dist/data/test/function/pathfind_bfs__then_9.mcfunction +13 -0
- package/dist/data/test/function/pathfind_bfs_coro.mcfunction +1 -0
- package/dist/data/test/function/pcg_output.mcfunction +1 -2
- package/dist/data/test/function/pf_heuristic.mcfunction +14 -0
- package/dist/data/test/function/pf_heuristic__merge_1.mcfunction +4 -0
- package/dist/data/test/function/pf_heuristic__merge_3.mcfunction +6 -0
- package/dist/data/test/function/pf_heuristic__then_0.mcfunction +4 -0
- package/dist/data/test/function/pf_heuristic__then_2.mcfunction +4 -0
- package/dist/data/test/function/pf_is_blocked.mcfunction +7 -0
- package/dist/data/test/function/pf_is_blocked__merge_1.mcfunction +4 -0
- package/dist/data/test/function/pf_is_blocked__merge_10.mcfunction +4 -0
- package/dist/data/test/function/pf_is_blocked__merge_4.mcfunction +4 -0
- package/dist/data/test/function/pf_is_blocked__merge_7.mcfunction +4 -0
- package/dist/data/test/function/pf_is_blocked__then_0.mcfunction +2 -0
- package/dist/data/test/function/pf_is_blocked__then_3.mcfunction +2 -0
- package/dist/data/test/function/pf_is_blocked__then_6.mcfunction +2 -0
- package/dist/data/test/function/pf_is_blocked__then_9.mcfunction +2 -0
- package/dist/data/test/function/pf_new_map.mcfunction +4 -0
- package/dist/data/test/function/pf_new_map__loop_body_1.mcfunction +7 -0
- package/dist/data/test/function/pf_new_map__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/pf_new_map__loop_header_0.mcfunction +4 -0
- package/dist/data/test/function/pf_noop.mcfunction +1 -0
- package/dist/data/test/function/pf_pack.mcfunction +8 -0
- package/dist/data/test/function/pf_set_blocked.mcfunction +5 -0
- package/dist/data/test/function/pf_set_open.mcfunction +5 -0
- package/dist/data/test/function/pf_unpack_x.mcfunction +5 -0
- package/dist/data/test/function/pf_unpack_z.mcfunction +5 -0
- package/dist/data/test/function/popcount__loop_body_1.mcfunction +1 -2
- package/dist/data/test/function/popcount__loop_header_0.mcfunction +1 -2
- package/dist/data/test/function/portal_effect.mcfunction +1 -0
- package/dist/data/test/function/random_bool.mcfunction +1 -2
- package/dist/data/test/function/random_range.mcfunction +1 -2
- package/dist/data/test/function/regen.mcfunction +1 -0
- package/dist/data/test/function/remove_bar.mcfunction +3 -0
- package/dist/data/test/function/remove_from_teams.mcfunction +3 -0
- package/dist/data/test/function/remove_item.mcfunction +1 -0
- package/dist/data/test/function/resistance.mcfunction +1 -0
- package/dist/data/test/function/rgb_to_h.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_h__merge_1.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_h__merge_12.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_h__merge_3.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_h__merge_5.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_h__merge_7.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_h__merge_9.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_h__then_11.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_l.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_l__merge_1.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_l__merge_3.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_l__merge_5.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_s.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_s__merge_1.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_s__merge_3.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_s__merge_5.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_s__merge_7.mcfunction +1 -2
- package/dist/data/test/function/rgb_to_s__merge_9.mcfunction +1 -2
- package/dist/data/test/function/riemann_left.mcfunction +6 -0
- package/dist/data/test/function/riemann_left__loop_body_1.mcfunction +7 -0
- package/dist/data/test/function/riemann_left__loop_exit_2.mcfunction +6 -0
- package/dist/data/test/function/riemann_left__loop_header_0.mcfunction +5 -0
- package/dist/data/test/function/riemann_mid.mcfunction +6 -0
- package/dist/data/test/function/riemann_mid__loop_body_1.mcfunction +7 -0
- package/dist/data/test/function/riemann_mid__loop_exit_2.mcfunction +6 -0
- package/dist/data/test/function/riemann_mid__loop_header_0.mcfunction +3 -0
- package/dist/data/test/function/riemann_right.mcfunction +6 -0
- package/dist/data/test/function/riemann_right__loop_body_1.mcfunction +7 -0
- package/dist/data/test/function/riemann_right__loop_exit_2.mcfunction +6 -0
- package/dist/data/test/function/riemann_right__loop_header_0.mcfunction +3 -0
- package/dist/data/test/function/running_m2.mcfunction +16 -0
- package/dist/data/test/function/running_mean.mcfunction +7 -0
- package/dist/data/test/function/running_mean__merge_1.mcfunction +13 -0
- package/dist/data/test/function/running_mean__then_0.mcfunction +1 -0
- package/dist/data/test/function/second_deriv.mcfunction +8 -0
- package/dist/data/test/function/second_deriv__merge_1.mcfunction +14 -0
- package/dist/data/test/function/second_deriv__then_0.mcfunction +2 -0
- package/dist/data/test/function/set_day.mcfunction +1 -0
- package/dist/data/test/function/set_easy.mcfunction +1 -0
- package/dist/data/test/function/set_hard.mcfunction +1 -0
- package/dist/data/test/function/set_midnight.mcfunction +1 -0
- package/dist/data/test/function/set_night.mcfunction +1 -0
- package/dist/data/test/function/set_noon.mcfunction +1 -0
- package/dist/data/test/function/set_normal.mcfunction +1 -0
- package/dist/data/test/function/set_peaceful.mcfunction +1 -0
- package/dist/data/test/function/setup_four_teams.mcfunction +4 -0
- package/dist/data/test/function/setup_two_teams.mcfunction +2 -0
- package/dist/data/test/function/show_bar.mcfunction +4 -0
- package/dist/data/test/function/simpson_step.mcfunction +16 -0
- package/dist/data/test/function/sin_hp.mcfunction +4 -2
- package/dist/data/test/function/slow_fall.mcfunction +1 -0
- package/dist/data/test/function/smoke.mcfunction +1 -0
- package/dist/data/test/function/sort2_max.mcfunction +1 -2
- package/dist/data/test/function/sort2_min.mcfunction +1 -2
- package/dist/data/test/function/sort3.mcfunction +1 -2
- package/dist/data/test/function/sort3__merge_1.mcfunction +1 -2
- package/dist/data/test/function/sort3__merge_3.mcfunction +1 -2
- package/dist/data/test/function/sort3__merge_5.mcfunction +1 -2
- package/dist/data/test/function/sort3__merge_7.mcfunction +1 -2
- package/dist/data/test/function/sort4.mcfunction +1 -2
- package/dist/data/test/function/sort4__merge_1.mcfunction +1 -2
- package/dist/data/test/function/sort4__merge_11.mcfunction +1 -2
- package/dist/data/test/function/sort4__merge_14.mcfunction +1 -2
- package/dist/data/test/function/sort4__merge_3.mcfunction +1 -2
- package/dist/data/test/function/sort4__merge_5.mcfunction +1 -2
- package/dist/data/test/function/sort4__merge_7.mcfunction +1 -2
- package/dist/data/test/function/sort4__merge_9.mcfunction +1 -2
- package/dist/data/test/function/sort5.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_1.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_11.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_13.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_15.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_17.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_19.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_22.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_25.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_3.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_5.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_7.mcfunction +1 -2
- package/dist/data/test/function/sort5__merge_9.mcfunction +1 -2
- package/dist/data/test/function/sort_merge.mcfunction +10 -0
- package/dist/data/test/function/sort_merge__else_11.mcfunction +7 -0
- package/dist/data/test/function/sort_merge__else_14.mcfunction +2 -0
- package/dist/data/test/function/sort_merge__else_5.mcfunction +3 -0
- package/dist/data/test/function/sort_merge__else_8.mcfunction +7 -0
- package/dist/data/test/function/sort_merge__loop_body_1.mcfunction +3 -0
- package/dist/data/test/function/sort_merge__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/sort_merge__loop_header_0.mcfunction +4 -0
- package/dist/data/test/function/sort_merge__merge_10.mcfunction +1 -0
- package/dist/data/test/function/sort_merge__merge_13.mcfunction +1 -0
- package/dist/data/test/function/sort_merge__merge_4.mcfunction +1 -0
- package/dist/data/test/function/sort_merge__merge_7.mcfunction +1 -0
- package/dist/data/test/function/sort_merge__then_12.mcfunction +7 -0
- package/dist/data/test/function/sort_merge__then_3.mcfunction +3 -0
- package/dist/data/test/function/sort_merge__then_6.mcfunction +3 -0
- package/dist/data/test/function/sort_merge__then_9.mcfunction +7 -0
- package/dist/data/test/function/sparkles_at.mcfunction +1 -0
- package/dist/data/test/function/speed.mcfunction +1 -0
- package/dist/data/test/function/sphere_contains.mcfunction +1 -2
- package/dist/data/test/function/spread_players.mcfunction +1 -0
- package/dist/data/test/function/sqrt_fx.mcfunction +5 -8
- package/dist/data/test/function/sqrt_hp.mcfunction +17 -0
- package/dist/data/test/function/sqrt_hp__merge_1.mcfunction +21 -0
- package/dist/data/test/function/sqrt_hp__then_0.mcfunction +2 -0
- package/dist/data/test/function/std_dev_approx.mcfunction +5 -0
- package/dist/data/test/function/std_dev_approx__merge_1.mcfunction +13 -0
- package/dist/data/test/function/std_dev_approx__then_0.mcfunction +2 -0
- package/dist/data/test/function/str_len.mcfunction +2 -0
- package/dist/data/test/function/strength.mcfunction +1 -0
- package/dist/data/test/function/t.mcfunction +3 -0
- package/dist/data/test/function/teleport_to.mcfunction +9 -0
- package/dist/data/test/function/teleport_to_entity.mcfunction +5 -0
- package/dist/data/test/function/test.mcfunction +5 -0
- package/dist/data/test/function/test__loop_body_1.mcfunction +9 -0
- package/dist/data/test/function/test__loop_exit_2.mcfunction +1 -0
- package/dist/data/test/function/test__loop_header_0.mcfunction +3 -0
- package/dist/data/test/function/tile_of.mcfunction +1 -2
- package/dist/data/test/function/timer/done.mcfunction +1 -2
- package/dist/data/test/function/timer/remaining.mcfunction +1 -2
- package/dist/data/test/function/timer/tick.mcfunction +1 -2
- package/dist/data/test/function/timer/tick__then_0.mcfunction +1 -2
- package/dist/data/test/function/totem_at.mcfunction +1 -0
- package/dist/data/test/function/trapezoid_step.mcfunction +11 -0
- package/dist/data/test/function/uniform_frac.mcfunction +1 -2
- package/dist/data/test/function/uniform_int.mcfunction +1 -2
- package/dist/data/test/function/update_bar.mcfunction +5 -0
- package/dist/data/test/function/update_bar_color.mcfunction +6 -0
- package/dist/data/test/function/update_bar_color__else_2.mcfunction +4 -0
- package/dist/data/test/function/update_bar_color__else_5.mcfunction +4 -0
- package/dist/data/test/function/update_bar_color__merge_1.mcfunction +1 -0
- package/dist/data/test/function/update_bar_color__merge_4.mcfunction +1 -0
- package/dist/data/test/function/update_bar_color__then_0.mcfunction +4 -0
- package/dist/data/test/function/update_bar_color__then_3.mcfunction +4 -0
- package/dist/data/test/function/value_noise_1d.mcfunction +1 -2
- package/dist/data/test/function/value_noise_2d.mcfunction +1 -2
- package/dist/data/test/function/value_noise_2d__merge_1.mcfunction +1 -2
- package/dist/data/test/function/variance_from_m2.mcfunction +6 -0
- package/dist/data/test/function/variance_from_m2__merge_1.mcfunction +5 -0
- package/dist/data/test/function/variance_from_m2__then_0.mcfunction +2 -0
- package/dist/data/test/function/weapon_damage.mcfunction +5 -0
- package/dist/data/test/function/weather_clear.mcfunction +1 -0
- package/dist/data/test/function/weather_rain.mcfunction +1 -0
- package/dist/data/test/function/weather_thunder.mcfunction +1 -0
- package/dist/data/test/function/weighted2.mcfunction +1 -2
- package/dist/data/test/function/weighted2__merge_1.mcfunction +1 -2
- package/dist/data/test/function/weighted3.mcfunction +1 -2
- package/dist/data/test/function/weighted3__merge_1.mcfunction +1 -2
- package/dist/data/test/function/weighted3__merge_3.mcfunction +1 -2
- package/dist/data/test_dmul/function/__double_mul_macro.mcfunction +1 -0
- package/dist/data/test_dmul/function/double_mul_fixed.mcfunction +6 -0
- package/dist/data/test_dmul/function/load.mcfunction +1 -0
- package/dist/data/test_double_fn/function/double_test.mcfunction +2 -0
- package/dist/data/test_double_fn/function/load.mcfunction +1 -0
- package/dist/data/test_double_fn2/function/double_test.mcfunction +2 -0
- package/dist/data/test_double_fn2/function/load.mcfunction +1 -0
- package/dist/data/test_double_pass/function/caller_fn.mcfunction +4 -0
- package/dist/data/test_double_pass/function/consume_double.mcfunction +2 -0
- package/dist/data/test_double_pass/function/load.mcfunction +1 -0
- package/dist/data/test_macro/function/load.mcfunction +1 -0
- package/dist/data/test_macro/function/macro_helper.mcfunction +1 -0
- package/dist/data/test_macro3/function/__dmul_macro.mcfunction +1 -0
- package/dist/data/test_macro3/function/double_mul_test.mcfunction +7 -0
- package/dist/data/test_macro3/function/load.mcfunction +1 -0
- package/dist/data/test_ret_double/function/load.mcfunction +1 -0
- package/dist/data/test_ret_double/function/make_double.mcfunction +3 -0
- package/dist/data/test_ret_double/function/use_it.mcfunction +3 -0
- package/dist/pack.mcmeta +1 -1
- package/dist/src/__tests__/array-dynamic.test.js +42 -0
- package/dist/src/__tests__/builtins.test.d.ts +1 -0
- package/dist/src/__tests__/builtins.test.js +55 -0
- package/dist/src/__tests__/compile-all.test.js +1 -0
- package/dist/src/__tests__/diagnostics.test.js +8 -11
- package/dist/src/__tests__/double.test.d.ts +7 -0
- package/dist/src/__tests__/double.test.js +464 -0
- package/dist/src/__tests__/e2e/ecs-stdlib.test.d.ts +7 -0
- package/dist/src/__tests__/e2e/ecs-stdlib.test.js +328 -0
- package/dist/src/__tests__/e2e/events-stdlib.test.d.ts +1 -0
- package/dist/src/__tests__/e2e/events-stdlib.test.js +81 -0
- package/dist/src/__tests__/e2e/fft-stdlib.test.d.ts +13 -0
- package/dist/src/__tests__/e2e/fft-stdlib.test.js +288 -0
- package/dist/src/__tests__/e2e/for-in-array.test.d.ts +4 -0
- package/dist/src/__tests__/e2e/for-in-array.test.js +59 -0
- package/dist/src/__tests__/e2e/macros.test.js +7 -7
- package/dist/src/__tests__/e2e/ode-stdlib.test.d.ts +1 -0
- package/dist/src/__tests__/e2e/ode-stdlib.test.js +91 -0
- package/dist/src/__tests__/e2e/stdlib-e2e.test.js +1616 -0
- package/dist/src/__tests__/emit/compile.test.d.ts +1 -0
- package/dist/src/__tests__/emit/compile.test.js +95 -0
- package/dist/src/__tests__/emit/index.test.d.ts +1 -0
- package/dist/src/__tests__/emit/index.test.js +180 -0
- package/dist/src/__tests__/emit/modules-extra.test.d.ts +1 -0
- package/dist/src/__tests__/emit/modules-extra.test.js +77 -0
- package/dist/src/__tests__/enum.test.js +4 -6
- package/dist/src/__tests__/fixed.test.d.ts +7 -0
- package/dist/src/__tests__/fixed.test.js +148 -0
- package/dist/src/__tests__/float-lint.test.d.ts +7 -0
- package/dist/src/__tests__/float-lint.test.js +96 -0
- package/dist/src/__tests__/float.test.d.ts +7 -0
- package/dist/src/__tests__/float.test.js +148 -0
- package/dist/src/__tests__/for-each.test.d.ts +1 -0
- package/dist/src/__tests__/for-each.test.js +125 -0
- package/dist/src/__tests__/for-range.test.d.ts +1 -0
- package/dist/src/__tests__/for-range.test.js +136 -0
- package/dist/src/__tests__/generics.test.js +4 -4
- package/dist/src/__tests__/impl.test.d.ts +1 -0
- package/dist/src/__tests__/impl.test.js +199 -0
- package/dist/src/__tests__/lsp-logic.test.d.ts +1 -0
- package/dist/src/__tests__/lsp-logic.test.js +145 -0
- package/dist/src/__tests__/match.test.d.ts +10 -0
- package/dist/src/__tests__/match.test.js +197 -0
- package/dist/src/__tests__/mc-integration/item-entity-events.test.d.ts +18 -0
- package/dist/src/__tests__/mc-integration/item-entity-events.test.js +287 -0
- package/dist/src/__tests__/mc-integration/stdlib-coverage-2.test.d.ts +13 -0
- package/dist/src/__tests__/mc-integration/stdlib-coverage-2.test.js +833 -0
- package/dist/src/__tests__/mc-integration/stdlib-coverage.test.d.ts +13 -0
- package/dist/src/__tests__/mc-integration/stdlib-coverage.test.js +707 -0
- package/dist/src/__tests__/mc-integration/syntax-coverage.test.d.ts +9 -0
- package/dist/src/__tests__/mc-integration/syntax-coverage.test.js +442 -0
- package/dist/src/__tests__/mc-integration.test.js +835 -5
- package/dist/src/__tests__/optimizer/constant_fold.test.js +105 -0
- package/dist/src/__tests__/optimizer/coroutine.test.js +3 -2
- package/dist/src/__tests__/parser.test.js +5 -5
- package/dist/src/__tests__/runtime.test.js +143 -238
- package/dist/src/__tests__/stdlib/arr-len.test.d.ts +13 -0
- package/dist/src/__tests__/stdlib/arr-len.test.js +195 -0
- package/dist/src/__tests__/stdlib/calculus.test.d.ts +5 -0
- package/dist/src/__tests__/stdlib/calculus.test.js +123 -0
- package/dist/src/__tests__/stdlib/dialog.test.d.ts +6 -0
- package/dist/src/__tests__/stdlib/dialog.test.js +142 -0
- package/dist/src/__tests__/stdlib/easing.test.d.ts +5 -0
- package/dist/src/__tests__/stdlib/easing.test.js +117 -0
- package/dist/src/__tests__/stdlib/geometry.test.d.ts +5 -0
- package/dist/src/__tests__/stdlib/geometry.test.js +163 -0
- package/dist/src/__tests__/stdlib/heap.test.d.ts +4 -0
- package/dist/src/__tests__/stdlib/heap.test.js +141 -0
- package/dist/src/__tests__/stdlib/list.test.d.ts +5 -0
- package/dist/src/__tests__/stdlib/list.test.js +134 -0
- package/dist/src/__tests__/stdlib/matrix.test.d.ts +5 -0
- package/dist/src/__tests__/stdlib/matrix.test.js +148 -0
- package/dist/src/__tests__/stdlib/pathfind.test.d.ts +4 -0
- package/dist/src/__tests__/stdlib/pathfind.test.js +167 -0
- package/dist/src/__tests__/stdlib/scheduler.test.d.ts +6 -0
- package/dist/src/__tests__/stdlib/scheduler.test.js +177 -0
- package/dist/src/__tests__/stdlib/sort-v2.test.d.ts +4 -0
- package/dist/src/__tests__/stdlib/sort-v2.test.js +131 -0
- package/dist/src/__tests__/stdlib/sort.test.d.ts +4 -0
- package/dist/src/__tests__/stdlib/sort.test.js +128 -0
- package/dist/src/__tests__/stdlib/state.test.d.ts +5 -0
- package/dist/src/__tests__/stdlib/state.test.js +176 -0
- package/dist/src/__tests__/typechecker-strict.test.js +21 -21
- package/dist/src/__tests__/typechecker.test.js +5 -3
- package/dist/src/ast/types.d.ts +28 -2
- package/dist/src/emit/compile.js +30 -3
- package/dist/src/emit/index.d.ts +2 -0
- package/dist/src/emit/index.js +20 -1
- package/dist/src/emit/modules.js +3 -2
- package/dist/src/events/types.d.ts +1 -1
- package/dist/src/events/types.js +5 -2
- package/dist/src/hir/lower.js +88 -2
- package/dist/src/hir/monomorphize.js +11 -5
- package/dist/src/hir/types.d.ts +20 -1
- package/dist/src/lexer/index.d.ts +1 -1
- package/dist/src/lexer/index.js +10 -1
- package/dist/src/lir/lower.js +7 -0
- package/dist/src/lsp/server.js +912 -56
- package/dist/src/mc-test/client.d.ts +13 -1
- package/dist/src/mc-test/client.js +29 -1
- package/dist/src/mir/lower.js +703 -74
- package/dist/src/mir/types.d.ts +5 -0
- package/dist/src/mir/verify.js +2 -0
- package/dist/src/optimizer/constant_fold.js +10 -6
- package/dist/src/optimizer/coroutine.js +90 -33
- package/dist/src/optimizer/interprocedural.js +4 -0
- package/dist/src/parser/index.d.ts +5 -0
- package/dist/src/parser/index.js +171 -39
- package/dist/src/runtime/index.js +24 -0
- package/dist/src/typechecker/index.d.ts +8 -1
- package/dist/src/typechecker/index.js +73 -14
- package/docs/LANGUAGE_REFERENCE.md +302 -67
- package/docs/stdlib/README.md +54 -0
- package/docs/stdlib/advanced.md +276 -0
- package/docs/stdlib/bigint.md +285 -0
- package/docs/stdlib/bits.md +159 -0
- package/docs/stdlib/bossbar.md +101 -0
- package/docs/stdlib/calculus.md +141 -0
- package/docs/stdlib/color.md +125 -0
- package/docs/stdlib/combat.md +41 -0
- package/docs/stdlib/cooldown.md +48 -0
- package/docs/stdlib/easing.md +157 -0
- package/docs/stdlib/effects.md +101 -0
- package/docs/stdlib/expr.md +38 -0
- package/docs/stdlib/geometry.md +130 -0
- package/docs/stdlib/interactions.md +111 -0
- package/docs/stdlib/inventory.md +53 -0
- package/docs/stdlib/list.md +189 -0
- package/docs/stdlib/math.md +334 -0
- package/docs/stdlib/math_hp.md +185 -0
- package/docs/stdlib/matrix.md +123 -0
- package/docs/stdlib/mobs.md +131 -0
- package/docs/stdlib/noise.md +103 -0
- package/docs/stdlib/parabola.md +119 -0
- package/docs/stdlib/particles.md +123 -0
- package/docs/stdlib/physics.md +148 -0
- package/docs/stdlib/player.md +43 -0
- package/docs/stdlib/quaternion.md +159 -0
- package/docs/stdlib/random.md +86 -0
- package/docs/stdlib/sets.md +68 -0
- package/docs/stdlib/signal.md +141 -0
- package/docs/stdlib/spawn.md +65 -0
- package/docs/stdlib/strings.md +17 -0
- package/docs/stdlib/tags.md +117 -0
- package/docs/stdlib/teams.md +87 -0
- package/docs/stdlib/timer.md +126 -0
- package/docs/stdlib/vec.md +193 -0
- package/docs/stdlib/world.md +151 -0
- package/editors/vscode/build.mjs +31 -12
- package/editors/vscode/out/extension.js +3670 -200
- package/editors/vscode/out/lsp-server.js +14854 -0
- package/editors/vscode/package-lock.json +3 -3
- package/editors/vscode/package.json +1 -1
- package/editors/vscode/snippets/redscript.json +109 -30
- package/editors/vscode/src/extension.ts +15 -13
- package/examples/readme-demo.mcrs +4 -4
- package/jest.config.js +5 -2
- package/package.json +1 -1
- package/scripts/postbuild.js +20 -0
- package/src/__tests__/array-dynamic.test.ts +42 -0
- package/src/__tests__/builtins.test.ts +66 -0
- package/src/__tests__/compile-all.test.ts +3 -2
- package/src/__tests__/diagnostics.test.ts +8 -10
- package/src/__tests__/double.test.ts +478 -0
- package/src/__tests__/e2e/ecs-stdlib.test.ts +371 -0
- package/src/__tests__/e2e/events-stdlib.test.ts +50 -0
- package/src/__tests__/e2e/fft-stdlib.test.ts +313 -0
- package/src/__tests__/e2e/macros.test.ts +7 -7
- package/src/__tests__/e2e/ode-stdlib.test.ts +68 -0
- package/src/__tests__/e2e/stdlib-e2e.test.ts +1952 -0
- package/src/__tests__/emit/compile.test.ts +102 -0
- package/src/__tests__/emit/index.test.ts +189 -0
- package/src/__tests__/emit/modules-extra.test.ts +80 -0
- package/src/__tests__/enum.test.ts +4 -6
- package/src/__tests__/fixed.test.ts +159 -0
- package/src/__tests__/fixtures/coroutine-mc-test.mcrs +58 -0
- package/src/__tests__/fixtures/for-range.mcrs +15 -0
- package/src/__tests__/fixtures/heap-sort-mc-test.mcrs +87 -0
- package/src/__tests__/fixtures/impl-test.mcrs +13 -44
- package/src/__tests__/fixtures/stdlib-extra-test.mcrs +226 -0
- package/src/__tests__/fixtures/stdlib-math-integration.mcrs +28 -0
- package/src/__tests__/fixtures/stdlib-math-test.mcrs +53 -0
- package/src/__tests__/float-lint.test.ts +102 -0
- package/src/__tests__/float.test.ts +158 -0
- package/src/__tests__/for-each.test.ts +135 -0
- package/src/__tests__/for-range.test.ts +149 -0
- package/src/__tests__/generics.test.ts +4 -4
- package/src/__tests__/impl.test.ts +207 -0
- package/src/__tests__/lsp-logic.test.ts +162 -0
- package/src/__tests__/match.test.ts +212 -0
- package/src/__tests__/mc-integration/item-entity-events.test.ts +298 -0
- package/src/__tests__/mc-integration/stdlib-coverage-2.test.ts +817 -0
- package/src/__tests__/mc-integration/stdlib-coverage.test.ts +699 -0
- package/src/__tests__/mc-integration/syntax-coverage.test.ts +464 -0
- package/src/__tests__/mc-integration.test.ts +889 -5
- package/src/__tests__/optimizer/constant_fold.test.ts +115 -0
- package/src/__tests__/optimizer/coroutine.test.ts +3 -2
- package/src/__tests__/parser.test.ts +5 -5
- package/src/__tests__/runtime.test.ts +194 -0
- package/src/__tests__/stdlib/arr-len.test.ts +231 -0
- package/src/__tests__/stdlib/calculus.test.ts +99 -0
- package/src/__tests__/stdlib/dialog.test.ts +132 -0
- package/src/__tests__/stdlib/easing.test.ts +97 -0
- package/src/__tests__/stdlib/geometry.test.ts +171 -0
- package/src/__tests__/stdlib/heap.test.ts +121 -0
- package/src/__tests__/stdlib/list.test.ts +117 -0
- package/src/__tests__/stdlib/matrix.test.ts +140 -0
- package/src/__tests__/stdlib/pathfind.test.ts +151 -0
- package/src/__tests__/stdlib/scheduler.test.ts +171 -0
- package/src/__tests__/stdlib/sort-v2.test.ts +111 -0
- package/src/__tests__/stdlib/sort.test.ts +106 -0
- package/src/__tests__/stdlib/state.test.ts +164 -0
- package/src/__tests__/typechecker-strict.test.ts +21 -21
- package/src/__tests__/typechecker.test.ts +5 -3
- package/src/ast/types.ts +16 -3
- package/src/emit/compile.ts +32 -3
- package/src/emit/index.ts +24 -1
- package/src/emit/modules.ts +2 -1
- package/src/events/types.ts +5 -2
- package/src/examples/capture_the_flag.mcrs +2 -2
- package/src/examples/hunger_games.mcrs +4 -4
- package/src/examples/parkour_race.mcrs +8 -8
- package/src/examples/tutorial_01_hello.mcrs +63 -0
- package/src/examples/tutorial_02_variables.mcrs +157 -0
- package/src/examples/tutorial_03_functions_structs.mcrs +162 -0
- package/src/examples/tutorial_04_selectors.mcrs +139 -0
- package/src/examples/tutorial_05_decorators.mcrs +131 -0
- package/src/examples/tutorial_06_math_particles.mcrs +123 -0
- package/src/examples/tutorial_07_random.mcrs +142 -0
- package/src/examples/tutorial_08_coroutine.mcrs +163 -0
- package/src/examples/tutorial_09_precision.mcrs +154 -0
- package/src/examples/tutorial_10_kill_race.mcrs +289 -0
- package/src/examples/zombie_survival.mcrs +7 -7
- package/src/hir/lower.ts +101 -4
- package/src/hir/monomorphize.ts +11 -6
- package/src/hir/types.ts +14 -1
- package/src/lexer/index.ts +11 -2
- package/src/lir/lower.ts +8 -0
- package/src/lsp/server.ts +894 -54
- package/src/mc-test/client.ts +32 -1
- package/src/mir/lower.ts +703 -74
- package/src/mir/types.ts +1 -0
- package/src/mir/verify.ts +2 -0
- package/src/optimizer/constant_fold.ts +11 -6
- package/src/optimizer/coroutine.ts +89 -29
- package/src/optimizer/interprocedural.ts +4 -0
- package/src/parser/index.ts +175 -41
- package/src/runtime/index.ts +26 -0
- package/src/stdlib/advanced.mcrs +47 -0
- package/src/stdlib/bigint.mcrs +251 -0
- package/src/stdlib/calculus.mcrs +150 -0
- package/src/stdlib/color.mcrs +102 -82
- package/src/stdlib/combat.mcrs +18 -12
- package/src/stdlib/dialog.mcrs +55 -0
- package/src/stdlib/ecs.mcrs +238 -0
- package/src/stdlib/events.mcrs +29 -0
- package/src/stdlib/expr.mcrs +117 -0
- package/src/stdlib/fft.mcrs +177 -0
- package/src/stdlib/geometry.mcrs +89 -0
- package/src/stdlib/graph.mcrs +274 -0
- package/src/stdlib/heap.mcrs +175 -0
- package/src/stdlib/linalg.mcrs +260 -0
- package/src/stdlib/list.mcrs +99 -0
- package/src/stdlib/math.mcrs +121 -5
- package/src/stdlib/math_hp.mcrs +452 -0
- package/src/stdlib/matrix.mcrs +113 -0
- package/src/stdlib/ode.mcrs +168 -0
- package/src/stdlib/parabola.mcrs +160 -0
- package/src/stdlib/particles.mcrs +69 -0
- package/src/stdlib/pathfind.mcrs +321 -0
- package/src/stdlib/quaternion.mcrs +192 -0
- package/src/stdlib/random.mcrs +46 -1
- package/src/stdlib/scheduler.mcrs +271 -0
- package/src/stdlib/signal.mcrs +223 -0
- package/src/stdlib/sort.mcrs +194 -0
- package/src/stdlib/state.mcrs +65 -0
- package/src/stdlib/world.mcrs +24 -0
- package/src/typechecker/index.ts +88 -15
- package/test_trig.ts +43 -0
package/dist/src/lsp/server.js
CHANGED
|
@@ -9,9 +9,45 @@
|
|
|
9
9
|
* - Go-to-definition (functions, variables)
|
|
10
10
|
* - Completion (keywords, functions, builtins)
|
|
11
11
|
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
12
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
46
|
const node_1 = require("vscode-languageserver/node");
|
|
14
47
|
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
const fs = __importStar(require("fs"));
|
|
50
|
+
const url_1 = require("url");
|
|
15
51
|
const lexer_1 = require("../lexer");
|
|
16
52
|
const parser_1 = require("../parser");
|
|
17
53
|
const typechecker_1 = require("../typechecker");
|
|
@@ -22,6 +58,90 @@ const metadata_1 = require("../builtins/metadata");
|
|
|
22
58
|
// ---------------------------------------------------------------------------
|
|
23
59
|
const connection = (0, node_1.createConnection)(node_1.ProposedFeatures.all);
|
|
24
60
|
const documents = new node_1.TextDocuments(vscode_languageserver_textdocument_1.TextDocument);
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// Builtin metadata: augment BUILTIN_METADATA from builtins.d.mcrs if present
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
/**
|
|
65
|
+
* Parse builtins.d.mcrs for `declare fn` entries and extract doc/param info.
|
|
66
|
+
* This ensures LSP hover covers every declared builtin even if metadata.ts
|
|
67
|
+
* is not yet updated.
|
|
68
|
+
*/
|
|
69
|
+
function loadBuiltinsFromDeclFile() {
|
|
70
|
+
const extra = {};
|
|
71
|
+
// Candidate paths: next to server.ts (dev), or next to the package root
|
|
72
|
+
const candidates = [
|
|
73
|
+
path.resolve(__dirname, '../../builtins.d.mcrs'),
|
|
74
|
+
path.resolve(__dirname, '../../../builtins.d.mcrs'),
|
|
75
|
+
path.resolve(__dirname, '../../../../builtins.d.mcrs'),
|
|
76
|
+
];
|
|
77
|
+
let src = '';
|
|
78
|
+
for (const p of candidates) {
|
|
79
|
+
if (fs.existsSync(p)) {
|
|
80
|
+
src = fs.readFileSync(p, 'utf-8');
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (!src)
|
|
85
|
+
return extra;
|
|
86
|
+
const lines = src.split('\n');
|
|
87
|
+
let docLines = [];
|
|
88
|
+
let paramDocs = {};
|
|
89
|
+
for (const line of lines) {
|
|
90
|
+
const tripleDoc = line.match(/^\/\/\/\s?(.*)$/);
|
|
91
|
+
if (tripleDoc) {
|
|
92
|
+
const content = tripleDoc[1];
|
|
93
|
+
const paramMatch = content.match(/^@param\s+(\w+)\s+(.+)$/);
|
|
94
|
+
if (paramMatch) {
|
|
95
|
+
paramDocs[paramMatch[1]] = paramMatch[2];
|
|
96
|
+
}
|
|
97
|
+
else if (!content.startsWith('@example')) {
|
|
98
|
+
docLines.push(content);
|
|
99
|
+
}
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const declMatch = line.match(/^declare fn (\w+)\(([^)]*)\):\s*(\w+);?$/);
|
|
103
|
+
if (declMatch) {
|
|
104
|
+
const [, fnName, paramsStr, retType] = declMatch;
|
|
105
|
+
// Only add if not already in BUILTIN_METADATA
|
|
106
|
+
if (!ALL_BUILTINS[fnName]) {
|
|
107
|
+
const params = paramsStr.trim()
|
|
108
|
+
? paramsStr.split(',').map(p => {
|
|
109
|
+
const [pname, ptype] = p.trim().split(':').map(s => s.trim());
|
|
110
|
+
return {
|
|
111
|
+
name: pname ?? '',
|
|
112
|
+
type: ptype ?? 'string',
|
|
113
|
+
required: true,
|
|
114
|
+
doc: paramDocs[pname ?? ''] ?? '',
|
|
115
|
+
docZh: '',
|
|
116
|
+
};
|
|
117
|
+
})
|
|
118
|
+
: [];
|
|
119
|
+
extra[fnName] = {
|
|
120
|
+
name: fnName,
|
|
121
|
+
params,
|
|
122
|
+
returns: (retType === 'void' || retType === 'int' || retType === 'bool' || retType === 'string')
|
|
123
|
+
? retType : 'void',
|
|
124
|
+
doc: docLines.join(' ').trim(),
|
|
125
|
+
docZh: '',
|
|
126
|
+
examples: [],
|
|
127
|
+
category: 'builtin',
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
docLines = [];
|
|
131
|
+
paramDocs = {};
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
// Non-comment, non-declare line resets doc accumulator
|
|
135
|
+
if (line.trim() && !line.startsWith('//')) {
|
|
136
|
+
docLines = [];
|
|
137
|
+
paramDocs = {};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return extra;
|
|
141
|
+
}
|
|
142
|
+
const EXTRA_BUILTINS = loadBuiltinsFromDeclFile();
|
|
143
|
+
/** Combined lookup: metadata.ts entries + anything declared in builtins.d.mcrs */
|
|
144
|
+
const ALL_BUILTINS = { ...EXTRA_BUILTINS, ...metadata_1.BUILTIN_METADATA };
|
|
25
145
|
const parsedDocs = new Map();
|
|
26
146
|
// ---------------------------------------------------------------------------
|
|
27
147
|
// Helpers
|
|
@@ -46,14 +166,21 @@ function parseDocument(uri, source) {
|
|
|
46
166
|
const errors = [];
|
|
47
167
|
let program = null;
|
|
48
168
|
try {
|
|
49
|
-
|
|
169
|
+
// Strip path-based imports ("import "stdlib/xxx.mcrs"") before parsing,
|
|
170
|
+
// since the Parser only understands import module::symbol syntax.
|
|
171
|
+
// These are handled at compile time by pre-processing, not by the parser.
|
|
172
|
+
const strippedSource = source.replace(/^import\s+"[^"]*"\s*;?\s*$/gm, '// (import stripped for LSP)');
|
|
173
|
+
const lexer = new lexer_1.Lexer(strippedSource);
|
|
50
174
|
const tokens = lexer.tokenize();
|
|
51
|
-
const parser = new parser_1.Parser(tokens,
|
|
175
|
+
const parser = new parser_1.Parser(tokens, strippedSource, uri);
|
|
52
176
|
program = parser.parse('redscript');
|
|
53
177
|
// Type-check (warn mode — collects errors but doesn't throw)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
178
|
+
try {
|
|
179
|
+
const checker = new typechecker_1.TypeChecker(source, uri);
|
|
180
|
+
const typeErrors = checker.check(program);
|
|
181
|
+
errors.push(...typeErrors);
|
|
182
|
+
}
|
|
183
|
+
catch { /* type errors are non-fatal; keep the parsed program */ }
|
|
57
184
|
}
|
|
58
185
|
catch (err) {
|
|
59
186
|
if (err instanceof diagnostics_1.DiagnosticError) {
|
|
@@ -86,18 +213,18 @@ function toDiagnostic(err) {
|
|
|
86
213
|
// Decorator hover docs
|
|
87
214
|
// ---------------------------------------------------------------------------
|
|
88
215
|
const DECORATOR_DOCS = {
|
|
89
|
-
tick: 'Runs every
|
|
90
|
-
load: 'Runs on `/reload`. Use for initialization
|
|
91
|
-
coroutine: '
|
|
92
|
-
schedule: 'Schedules the function to run after
|
|
93
|
-
on_trigger: 'Runs when a trigger
|
|
94
|
-
keep: 'Prevents the
|
|
95
|
-
on: 'Generic event handler
|
|
96
|
-
on_advancement: 'Runs when a player earns an advancement
|
|
97
|
-
on_craft: 'Runs when a player crafts an item
|
|
98
|
-
on_death: 'Runs when a player dies
|
|
99
|
-
on_join_team: 'Runs when a player joins a team
|
|
100
|
-
on_login: 'Runs when a player logs
|
|
216
|
+
tick: 'Runs every game tick.\n\n**Optional args:** `rate=N` (every N ticks, e.g. `@tick(rate=20)` = once per second)\n\nExample: `@tick fn every_tick() {}` or `@tick(rate=20) fn every_second() {}`',
|
|
217
|
+
load: 'Runs once on `/reload`. Use for initialization.\n\nExample: `@load fn init() { scoreboard_create(...) }`',
|
|
218
|
+
coroutine: 'Wraps a loop to spread execution across multiple ticks.\n\n**Required arg:** `batch=N` — iterations per tick.\n\nExample: `@coroutine(batch=10) fn scan_blocks() { for i in 0..1000 { ... } }`',
|
|
219
|
+
schedule: 'Schedules the function to run after a delay.\n\n**Required arg:** `ticks=N`\n\nExample: `@schedule(ticks=100) fn delayed() {}`',
|
|
220
|
+
on_trigger: 'Runs when a player executes `/trigger <name>`.\n\n**Required arg:** trigger objective name.\n\nExample: `@on_trigger("shop") fn open_shop() {}`',
|
|
221
|
+
keep: 'Prevents dead-code elimination. Use for exported entry points not referenced in the same file.\n\nExample: `@keep fn public_api() {}`',
|
|
222
|
+
on: 'Generic event handler. Arg: event name.\n\nExample: `@on("custom:event") fn handler() {}`',
|
|
223
|
+
on_advancement: 'Runs when a player earns an advancement.\n\n**Arg:** advancement id (e.g. `"story/mine_diamond"`).\n\nExample: `@on_advancement("story/mine_diamond") fn reward() {}`',
|
|
224
|
+
on_craft: 'Runs when a player crafts an item.\n\n**Arg:** item id (e.g. `"minecraft:diamond_sword"`).\n\nExample: `@on_craft("minecraft:diamond_sword") fn on_craft_sword() {}`',
|
|
225
|
+
on_death: 'Runs when a player dies.\n\nExample: `@on_death fn on_player_death() {}`',
|
|
226
|
+
on_join_team: 'Runs when a player joins a team.\n\n**Arg:** team name.\n\nExample: `@on_join_team("red") fn joined_red() {}`',
|
|
227
|
+
on_login: 'Runs when a player logs into the server.\n\nExample: `@on_login fn welcome() { tell(@s, f"Welcome back!") }`',
|
|
101
228
|
};
|
|
102
229
|
// ---------------------------------------------------------------------------
|
|
103
230
|
// Hover helpers
|
|
@@ -142,6 +269,63 @@ function formatFnSignature(fn) {
|
|
|
142
269
|
// Go-to-definition helpers
|
|
143
270
|
// ---------------------------------------------------------------------------
|
|
144
271
|
/** Build a mapping from identifier name → definition location. */
|
|
272
|
+
/**
|
|
273
|
+
* Extract the leading doc comment (/** ... *\/) immediately before a function
|
|
274
|
+
* declaration, returning it as plain text (tags stripped).
|
|
275
|
+
*/
|
|
276
|
+
function extractDocComment(source, fn) {
|
|
277
|
+
if (!fn.span)
|
|
278
|
+
return null;
|
|
279
|
+
const lines = source.split('\n');
|
|
280
|
+
// fn.span.line is 1-based; scan upward from fn declaration line
|
|
281
|
+
let endLine = fn.span.line - 2; // 0-based index of line before fn
|
|
282
|
+
if (endLine < 0)
|
|
283
|
+
return null;
|
|
284
|
+
// Skip blank lines
|
|
285
|
+
while (endLine >= 0 && lines[endLine].trim() === '')
|
|
286
|
+
endLine--;
|
|
287
|
+
if (endLine < 0)
|
|
288
|
+
return null;
|
|
289
|
+
// Case 1: /** ... */ block comment
|
|
290
|
+
if (lines[endLine].trim().endsWith('*/')) {
|
|
291
|
+
let startLine = endLine;
|
|
292
|
+
while (startLine >= 0 && !lines[startLine].trim().startsWith('/**'))
|
|
293
|
+
startLine--;
|
|
294
|
+
if (startLine < 0)
|
|
295
|
+
return null;
|
|
296
|
+
const commentLines = lines.slice(startLine, endLine + 1);
|
|
297
|
+
return commentLines
|
|
298
|
+
.map(l => l.replace(/^\s*\/\*\*\s?/, '').replace(/^\s*\*\/\s?$/, '').replace(/^\s*\*\s?/, '').trimEnd())
|
|
299
|
+
.filter(l => l.length > 0)
|
|
300
|
+
.join('\n') || null;
|
|
301
|
+
}
|
|
302
|
+
// Case 2: consecutive // or /// line comments
|
|
303
|
+
if (lines[endLine].trim().startsWith('//')) {
|
|
304
|
+
let startLine = endLine;
|
|
305
|
+
while (startLine > 0 && lines[startLine - 1].trim().startsWith('//'))
|
|
306
|
+
startLine--;
|
|
307
|
+
return lines.slice(startLine, endLine + 1)
|
|
308
|
+
.map(l => l.replace(/^\s*\/\/\/?\/?\s?/, '').trimEnd())
|
|
309
|
+
.filter(l => l.length > 0)
|
|
310
|
+
.join('\n') || null;
|
|
311
|
+
}
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Find which function declaration contains the given 1-based line number.
|
|
316
|
+
* Uses the next fn's start line as the implicit end when span.endLine is missing.
|
|
317
|
+
*/
|
|
318
|
+
function findEnclosingFn(program, curLine) {
|
|
319
|
+
const fns = program.declarations.filter(f => f.span);
|
|
320
|
+
for (let i = 0; i < fns.length; i++) {
|
|
321
|
+
const fn = fns[i];
|
|
322
|
+
const startLine = fn.span.line;
|
|
323
|
+
const endLine = fn.span.endLine ?? (fns[i + 1]?.span?.line ? fns[i + 1].span.line - 1 : Infinity);
|
|
324
|
+
if (curLine >= startLine && curLine <= endLine)
|
|
325
|
+
return fn;
|
|
326
|
+
}
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
145
329
|
function buildDefinitionMap(program, source) {
|
|
146
330
|
const map = new Map();
|
|
147
331
|
for (const fn of program.declarations) {
|
|
@@ -184,19 +368,41 @@ const KEYWORD_COMPLETIONS = [
|
|
|
184
368
|
kind: node_1.CompletionItemKind.Keyword,
|
|
185
369
|
}));
|
|
186
370
|
const TYPE_COMPLETIONS = [
|
|
187
|
-
'int', 'bool', 'float', 'string', 'void', 'BlockPos', 'byte', 'short', 'long', 'double',
|
|
371
|
+
'int', 'bool', 'fixed', 'float', 'string', 'void', 'BlockPos', 'byte', 'short', 'long', 'double',
|
|
188
372
|
'entity', 'Player', 'Mob', 'HostileMob', 'PassiveMob',
|
|
189
373
|
'Zombie', 'Skeleton', 'Creeper', 'Spider', 'Enderman',
|
|
190
374
|
].map(t => ({
|
|
191
375
|
label: t,
|
|
192
376
|
kind: node_1.CompletionItemKind.TypeParameter,
|
|
193
377
|
}));
|
|
378
|
+
// Decorator completions — triggered when '@' is typed at line start context.
|
|
379
|
+
// insertText is the full token WITHOUT '@' because '@' is already on screen.
|
|
380
|
+
// VSCode will keep the completion open as user types more letters (filter by label).
|
|
194
381
|
const DECORATOR_COMPLETIONS = [
|
|
195
|
-
'@tick', '
|
|
196
|
-
|
|
197
|
-
label:
|
|
198
|
-
|
|
199
|
-
}
|
|
382
|
+
{ label: '@tick', detail: 'Run every game tick (~20 Hz)', insertText: 'tick' },
|
|
383
|
+
{ label: '@load', detail: 'Run on /reload (initialization)', insertText: 'load' },
|
|
384
|
+
{ label: '@on_trigger', detail: 'Run when a player uses /trigger', insertText: 'on_trigger' },
|
|
385
|
+
{ label: '@schedule', detail: 'Schedule function after N ticks', insertText: 'schedule' },
|
|
386
|
+
{ label: '@coroutine', detail: 'Spread loop across ticks (batch=N)', insertText: 'coroutine' },
|
|
387
|
+
{ label: '@keep', detail: 'Prevent dead-code elimination', insertText: 'keep' },
|
|
388
|
+
{ label: '@on', detail: 'Generic event handler', insertText: 'on' },
|
|
389
|
+
{ label: '@on_advancement', detail: 'Run on advancement earned', insertText: 'on_advancement' },
|
|
390
|
+
{ label: '@on_craft', detail: 'Run on item craft', insertText: 'on_craft' },
|
|
391
|
+
{ label: '@on_death', detail: 'Run on player death', insertText: 'on_death' },
|
|
392
|
+
{ label: '@on_join_team', detail: 'Run on team join', insertText: 'on_join_team' },
|
|
393
|
+
{ label: '@on_login', detail: 'Run on player login', insertText: 'on_login' },
|
|
394
|
+
{ label: '@require_on_load', detail: 'Ensure a fn runs on load (stdlib)', insertText: 'require_on_load' },
|
|
395
|
+
].map(d => ({ ...d, kind: node_1.CompletionItemKind.Event }));
|
|
396
|
+
/** Entity selector completions triggered by @ inside expressions.
|
|
397
|
+
* insertText is without '@' (already typed). label has '@' for display. */
|
|
398
|
+
const SELECTOR_COMPLETIONS = [
|
|
399
|
+
{ label: '@a', insertText: 'a', kind: node_1.CompletionItemKind.Value, detail: 'All players', documentation: 'Targets all online players.' },
|
|
400
|
+
{ label: '@p', insertText: 'p', kind: node_1.CompletionItemKind.Value, detail: 'Nearest player', documentation: 'Targets the nearest player to the command source.' },
|
|
401
|
+
{ label: '@s', insertText: 's', kind: node_1.CompletionItemKind.Value, detail: 'Executing entity', documentation: 'Targets the entity currently executing the command.' },
|
|
402
|
+
{ label: '@e', insertText: 'e', kind: node_1.CompletionItemKind.Value, detail: 'All entities', documentation: 'Targets all entities (use [type=...] to filter).' },
|
|
403
|
+
{ label: '@r', insertText: 'r', kind: node_1.CompletionItemKind.Value, detail: 'Random player', documentation: 'Targets a random online player.' },
|
|
404
|
+
{ label: '@n', insertText: 'n', kind: node_1.CompletionItemKind.Value, detail: 'Nearest entity', documentation: 'Targets the nearest entity (any type).' },
|
|
405
|
+
];
|
|
200
406
|
const BUILTIN_FN_COMPLETIONS = [
|
|
201
407
|
'say', 'tell', 'give', 'kill', 'teleport', 'summon', 'setblock',
|
|
202
408
|
'fill', 'clone', 'effect', 'enchant', 'experience', 'gamemode',
|
|
@@ -220,6 +426,12 @@ connection.onInitialize((_params) => {
|
|
|
220
426
|
triggerCharacters: ['.', '@'],
|
|
221
427
|
resolveProvider: false,
|
|
222
428
|
},
|
|
429
|
+
signatureHelpProvider: {
|
|
430
|
+
triggerCharacters: ['(', ','],
|
|
431
|
+
},
|
|
432
|
+
referencesProvider: true,
|
|
433
|
+
renameProvider: true,
|
|
434
|
+
inlayHintProvider: true,
|
|
223
435
|
},
|
|
224
436
|
serverInfo: {
|
|
225
437
|
name: 'redscript-lsp',
|
|
@@ -253,35 +465,77 @@ connection.onHover((params) => {
|
|
|
253
465
|
if (!doc)
|
|
254
466
|
return null;
|
|
255
467
|
const source = doc.getText();
|
|
256
|
-
|
|
257
|
-
const program = cached?.program ?? null;
|
|
258
|
-
if (!program)
|
|
259
|
-
return null;
|
|
260
|
-
// Check if cursor is on a decorator (@tick, @load, etc.)
|
|
468
|
+
// ── Decorator hover: works even if program is null (parse errors elsewhere) ──
|
|
261
469
|
const lines = source.split('\n');
|
|
262
470
|
const lineText = lines[params.position.line] ?? '';
|
|
263
|
-
const
|
|
264
|
-
if
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
471
|
+
const ch = params.position.character;
|
|
472
|
+
// Find all @xxx on this line and check if cursor is inside one
|
|
473
|
+
const decorRe = /@([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
474
|
+
let dm;
|
|
475
|
+
while ((dm = decorRe.exec(lineText)) !== null) {
|
|
476
|
+
const atIdx = dm.index;
|
|
477
|
+
const decorEnd = atIdx + dm[0].length;
|
|
478
|
+
if (ch >= atIdx && ch <= decorEnd) {
|
|
479
|
+
const decoratorName = dm[1];
|
|
270
480
|
const decoratorDoc = DECORATOR_DOCS[decoratorName];
|
|
271
481
|
if (decoratorDoc) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
482
|
+
return {
|
|
483
|
+
contents: {
|
|
484
|
+
kind: node_1.MarkupKind.Markdown,
|
|
485
|
+
value: `**@${decoratorName}** — ${decoratorDoc}`,
|
|
486
|
+
},
|
|
275
487
|
};
|
|
276
|
-
return { contents: content };
|
|
277
488
|
}
|
|
278
489
|
}
|
|
279
490
|
}
|
|
491
|
+
// ── Selector hover: @a, @p, @s etc ─────────────────────────────────────────
|
|
492
|
+
const SELECTOR_DOCS = {
|
|
493
|
+
'@a': 'All online players',
|
|
494
|
+
'@p': 'Nearest player to the command source',
|
|
495
|
+
'@s': 'The entity currently executing the command (self)',
|
|
496
|
+
'@e': 'All entities (use [type=...] to filter)',
|
|
497
|
+
'@r': 'A random online player',
|
|
498
|
+
'@n': 'The nearest entity of any type',
|
|
499
|
+
};
|
|
500
|
+
// Match @x or @x[...] token at cursor
|
|
501
|
+
const selRe = /@([a-zA-Z])/g;
|
|
502
|
+
let sm;
|
|
503
|
+
while ((sm = selRe.exec(lineText)) !== null) {
|
|
504
|
+
const selStart = sm.index;
|
|
505
|
+
const selEnd = selStart + sm[0].length;
|
|
506
|
+
if (ch >= selStart && ch <= selEnd) {
|
|
507
|
+
const selKey = sm[0]; // e.g. '@a'
|
|
508
|
+
const selDoc = SELECTOR_DOCS[selKey];
|
|
509
|
+
if (selDoc) {
|
|
510
|
+
return {
|
|
511
|
+
contents: {
|
|
512
|
+
kind: node_1.MarkupKind.Markdown,
|
|
513
|
+
value: `**${selKey}** — ${selDoc}`,
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
const cached = parsedDocs.get(params.textDocument.uri);
|
|
520
|
+
const program = cached?.program ?? null;
|
|
521
|
+
if (!program)
|
|
522
|
+
return null;
|
|
280
523
|
const word = wordAt(source, params.position);
|
|
281
524
|
if (!word)
|
|
282
525
|
return null;
|
|
526
|
+
// If cursor is on a selector like @s/@a/@p, the word is just 's'/'a'/'p'.
|
|
527
|
+
// Detect this by checking the character before the word start.
|
|
528
|
+
const hovLines = source.split('\n');
|
|
529
|
+
const hovLine = hovLines[params.position.line] ?? '';
|
|
530
|
+
const hovCh = params.position.character;
|
|
531
|
+
// Find start of current word
|
|
532
|
+
let hovWordStart = hovCh;
|
|
533
|
+
while (hovWordStart > 0 && /\w/.test(hovLine[hovWordStart - 1]))
|
|
534
|
+
hovWordStart--;
|
|
535
|
+
if (hovWordStart > 0 && hovLine[hovWordStart - 1] === '@')
|
|
536
|
+
return null; // It's a selector, no hover
|
|
283
537
|
// Check builtins
|
|
284
|
-
const builtin =
|
|
538
|
+
const builtin = ALL_BUILTINS[word];
|
|
285
539
|
if (builtin) {
|
|
286
540
|
const paramStr = builtin.params
|
|
287
541
|
.map(p => `${p.name}: ${p.type}${p.required ? '' : '?'}`)
|
|
@@ -332,16 +586,181 @@ connection.onHover((params) => {
|
|
|
332
586
|
};
|
|
333
587
|
return { contents: content };
|
|
334
588
|
}
|
|
589
|
+
// Check globals
|
|
590
|
+
const globalDecl = program.globals?.find(g => g.name === word);
|
|
591
|
+
if (globalDecl) {
|
|
592
|
+
const content = {
|
|
593
|
+
kind: node_1.MarkupKind.Markdown,
|
|
594
|
+
value: `\`\`\`redscript\nlet ${globalDecl.name}: ${typeToString(globalDecl.type)}\n\`\`\`\n*global variable*`,
|
|
595
|
+
};
|
|
596
|
+
return { contents: content };
|
|
597
|
+
}
|
|
598
|
+
// Check locals and params in the enclosing function
|
|
599
|
+
{
|
|
600
|
+
const curLine = params.position.line + 1;
|
|
601
|
+
const fn = findEnclosingFn(program, curLine);
|
|
602
|
+
if (fn) {
|
|
603
|
+
// Check params
|
|
604
|
+
const param = fn.params.find(p => p.name === word);
|
|
605
|
+
if (param) {
|
|
606
|
+
return {
|
|
607
|
+
contents: {
|
|
608
|
+
kind: node_1.MarkupKind.Markdown,
|
|
609
|
+
value: `\`\`\`redscript\n(param) ${param.name}: ${typeToString(param.type)}\n\`\`\``,
|
|
610
|
+
},
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
// Check locals
|
|
614
|
+
if (fn.body) {
|
|
615
|
+
const locals = collectLocals(fn.body);
|
|
616
|
+
const localType = locals.get(word);
|
|
617
|
+
if (localType) {
|
|
618
|
+
return {
|
|
619
|
+
contents: {
|
|
620
|
+
kind: node_1.MarkupKind.Markdown,
|
|
621
|
+
value: `\`\`\`redscript\nlet ${word}: ${typeToString(localType)}\n\`\`\``,
|
|
622
|
+
},
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
// ── Check imported files (import "stdlib/xxx.mcrs" and import xxx::*) ──────
|
|
629
|
+
try {
|
|
630
|
+
const importedPrograms = getImportedPrograms(source, params.textDocument.uri);
|
|
631
|
+
for (const { prog, filePath } of importedPrograms) {
|
|
632
|
+
const importedFn = findFunction(prog, word);
|
|
633
|
+
if (importedFn) {
|
|
634
|
+
const sig = formatFnSignature(importedFn);
|
|
635
|
+
// Extract leading /** ... */ comment from the source file
|
|
636
|
+
const docComment = extractDocComment(fs.readFileSync(filePath, 'utf-8'), importedFn);
|
|
637
|
+
const docLine = docComment ? `\n\n${docComment}` : '';
|
|
638
|
+
const content = {
|
|
639
|
+
kind: node_1.MarkupKind.Markdown,
|
|
640
|
+
value: `\`\`\`redscript\n${sig}\n\`\`\`${docLine}\n\n*from ${path.basename(filePath)}*`,
|
|
641
|
+
};
|
|
642
|
+
return { contents: content };
|
|
643
|
+
}
|
|
644
|
+
const importedStruct = prog.structs?.find(s => s.name === word);
|
|
645
|
+
if (importedStruct) {
|
|
646
|
+
const fields = importedStruct.fields.map(f => ` ${f.name}: ${typeToString(f.type)}`).join('\n');
|
|
647
|
+
const content = {
|
|
648
|
+
kind: node_1.MarkupKind.Markdown,
|
|
649
|
+
value: `\`\`\`redscript\nstruct ${importedStruct.name} {\n${fields}\n}\n\`\`\`\n\n*from ${path.basename(filePath)}*`,
|
|
650
|
+
};
|
|
651
|
+
return { contents: content };
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
catch { /* ignore */ }
|
|
335
656
|
return null;
|
|
336
657
|
});
|
|
337
658
|
// ---------------------------------------------------------------------------
|
|
338
659
|
// Go-to-definition
|
|
339
660
|
// ---------------------------------------------------------------------------
|
|
661
|
+
/**
|
|
662
|
+
* Parse all import declarations in `source` (both path-based and module::*
|
|
663
|
+
* forms) and return parsed Program objects for each resolved file.
|
|
664
|
+
*/
|
|
665
|
+
function getImportedPrograms(source, fromUri) {
|
|
666
|
+
const result = [];
|
|
667
|
+
// 1. Path-based: import "stdlib/math.mcrs"
|
|
668
|
+
const FILE_IMPORT_RE = /^import\s+"([^"]+)"/gm;
|
|
669
|
+
let m;
|
|
670
|
+
while ((m = FILE_IMPORT_RE.exec(source)) !== null) {
|
|
671
|
+
const resolved = resolveImportPath(m[1], fromUri);
|
|
672
|
+
if (!resolved || !fs.existsSync(resolved))
|
|
673
|
+
continue;
|
|
674
|
+
try {
|
|
675
|
+
const src = fs.readFileSync(resolved, 'utf-8');
|
|
676
|
+
const tokens = new lexer_1.Lexer(src).tokenize();
|
|
677
|
+
const prog = new parser_1.Parser(tokens).parse(path.basename(resolved, '.mcrs'));
|
|
678
|
+
result.push({ prog, filePath: resolved });
|
|
679
|
+
}
|
|
680
|
+
catch { /* skip */ }
|
|
681
|
+
}
|
|
682
|
+
// 2. Module-star: import random::* or import random::fn_name
|
|
683
|
+
const MOD_IMPORT_RE = /^import\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*::/gm;
|
|
684
|
+
while ((m = MOD_IMPORT_RE.exec(source)) !== null) {
|
|
685
|
+
const modName = m[1];
|
|
686
|
+
// Try to resolve as stdlib/modName.mcrs
|
|
687
|
+
const resolved = resolveImportPath(`stdlib/${modName}.mcrs`, fromUri);
|
|
688
|
+
if (!resolved || !fs.existsSync(resolved))
|
|
689
|
+
continue;
|
|
690
|
+
// Avoid duplicates if already resolved above
|
|
691
|
+
if (result.some(r => r.filePath === resolved))
|
|
692
|
+
continue;
|
|
693
|
+
try {
|
|
694
|
+
const src = fs.readFileSync(resolved, 'utf-8');
|
|
695
|
+
const tokens = new lexer_1.Lexer(src).tokenize();
|
|
696
|
+
const prog = new parser_1.Parser(tokens).parse(modName);
|
|
697
|
+
result.push({ prog, filePath: resolved });
|
|
698
|
+
}
|
|
699
|
+
catch { /* skip */ }
|
|
700
|
+
}
|
|
701
|
+
return result;
|
|
702
|
+
}
|
|
703
|
+
/** Resolve a relative or stdlib import path to an absolute file path. */
|
|
704
|
+
function resolveImportPath(importStr, fromUri) {
|
|
705
|
+
try {
|
|
706
|
+
const fromFile = (0, url_1.fileURLToPath)(fromUri);
|
|
707
|
+
const fromDir = path.dirname(fromFile);
|
|
708
|
+
if (importStr.startsWith('.')) {
|
|
709
|
+
// Relative path: import "../stdlib/math.mcrs"
|
|
710
|
+
const resolved = path.resolve(fromDir, importStr);
|
|
711
|
+
if (fs.existsSync(resolved))
|
|
712
|
+
return resolved;
|
|
713
|
+
// Try adding .mcrs extension
|
|
714
|
+
if (!resolved.endsWith('.mcrs') && fs.existsSync(resolved + '.mcrs'))
|
|
715
|
+
return resolved + '.mcrs';
|
|
716
|
+
}
|
|
717
|
+
else {
|
|
718
|
+
// stdlib path: import "stdlib/math" or "stdlib/math.mcrs"
|
|
719
|
+
// Walk up to find package root (contains package.json)
|
|
720
|
+
let dir = fromDir;
|
|
721
|
+
for (let i = 0; i < 10; i++) {
|
|
722
|
+
if (fs.existsSync(path.join(dir, 'package.json'))) {
|
|
723
|
+
const candidate = path.join(dir, 'src', importStr);
|
|
724
|
+
if (fs.existsSync(candidate))
|
|
725
|
+
return candidate;
|
|
726
|
+
if (fs.existsSync(candidate + '.mcrs'))
|
|
727
|
+
return candidate + '.mcrs';
|
|
728
|
+
// also try without 'src/'
|
|
729
|
+
const candidate2 = path.join(dir, importStr);
|
|
730
|
+
if (fs.existsSync(candidate2))
|
|
731
|
+
return candidate2;
|
|
732
|
+
if (fs.existsSync(candidate2 + '.mcrs'))
|
|
733
|
+
return candidate2 + '.mcrs';
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
dir = path.dirname(dir);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
catch { /* ignore */ }
|
|
741
|
+
return null;
|
|
742
|
+
}
|
|
340
743
|
connection.onDefinition((params) => {
|
|
341
744
|
const doc = documents.get(params.textDocument.uri);
|
|
342
745
|
if (!doc)
|
|
343
746
|
return null;
|
|
344
747
|
const source = doc.getText();
|
|
748
|
+
const lines = source.split('\n');
|
|
749
|
+
const lineText = lines[params.position.line] ?? '';
|
|
750
|
+
const ch = params.position.character;
|
|
751
|
+
// ── import "path/to/file.mcrs" ─────────────────────────────────────────────
|
|
752
|
+
// Cursor is anywhere on the line that starts with `import "..."`
|
|
753
|
+
const fileImportMatch = lineText.match(/^import\s+"([^"]+)"/);
|
|
754
|
+
if (fileImportMatch) {
|
|
755
|
+
const importStr = fileImportMatch[1];
|
|
756
|
+
const resolved = resolveImportPath(importStr, params.textDocument.uri);
|
|
757
|
+
if (resolved) {
|
|
758
|
+
return {
|
|
759
|
+
uri: (0, url_1.pathToFileURL)(resolved).toString(),
|
|
760
|
+
range: { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } },
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
}
|
|
345
764
|
const cached = parsedDocs.get(params.textDocument.uri);
|
|
346
765
|
const program = cached?.program ?? null;
|
|
347
766
|
if (!program)
|
|
@@ -349,37 +768,234 @@ connection.onDefinition((params) => {
|
|
|
349
768
|
const word = wordAt(source, params.position);
|
|
350
769
|
if (!word)
|
|
351
770
|
return null;
|
|
771
|
+
// If cursor is on a selector like @s/@a, the word is 's'/'a' — no F12.
|
|
772
|
+
let defWordStart = params.position.character;
|
|
773
|
+
while (defWordStart > 0 && /\w/.test(lineText[defWordStart - 1]))
|
|
774
|
+
defWordStart--;
|
|
775
|
+
if (defWordStart > 0 && lineText[defWordStart - 1] === '@')
|
|
776
|
+
return null;
|
|
777
|
+
// ── Normal in-file definition (top-level fn/struct/const/global) ────────────
|
|
352
778
|
const defMap = buildDefinitionMap(program, source);
|
|
353
779
|
const span = defMap.get(word);
|
|
354
|
-
if (
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
}
|
|
780
|
+
if (span) {
|
|
781
|
+
const line = Math.max(0, span.line - 1);
|
|
782
|
+
const col = Math.max(0, span.col - 1);
|
|
783
|
+
return {
|
|
784
|
+
uri: params.textDocument.uri,
|
|
785
|
+
range: {
|
|
786
|
+
start: { line, character: col },
|
|
787
|
+
end: { line, character: col + word.length },
|
|
788
|
+
},
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
// ── If word is a local/param in the enclosing fn, don't fall through to imports ──
|
|
792
|
+
const defCurLine = params.position.line + 1; // 1-based
|
|
793
|
+
const enclosingFn = findEnclosingFn(program, defCurLine);
|
|
794
|
+
if (enclosingFn) {
|
|
795
|
+
if (enclosingFn.params.some(p => p.name === word))
|
|
796
|
+
return null;
|
|
797
|
+
if (enclosingFn.body) {
|
|
798
|
+
const locals = collectLocals(enclosingFn.body);
|
|
799
|
+
if (locals.has(word))
|
|
800
|
+
return null;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
// Struct fields — clicking on .phase, .active etc. should not jump to stdlib
|
|
804
|
+
for (const s of program.structs ?? []) {
|
|
805
|
+
if (s.fields.some(f => f.name === word))
|
|
806
|
+
return null;
|
|
807
|
+
}
|
|
808
|
+
// ── Imported symbol F12 — jump to definition inside the imported file ────────
|
|
809
|
+
// Only reached if word is not a local. Avoids false matches for short names like 'p', 'k'.
|
|
810
|
+
try {
|
|
811
|
+
const importedPrograms = getImportedPrograms(source, params.textDocument.uri);
|
|
812
|
+
for (const { prog, filePath } of importedPrograms) {
|
|
813
|
+
const importedDefMap = buildDefinitionMap(prog, fs.readFileSync(filePath, 'utf-8'));
|
|
814
|
+
const importedSpan = importedDefMap.get(word);
|
|
815
|
+
if (importedSpan) {
|
|
816
|
+
const line = Math.max(0, importedSpan.line - 1);
|
|
817
|
+
const col = Math.max(0, importedSpan.col - 1);
|
|
818
|
+
return {
|
|
819
|
+
uri: (0, url_1.pathToFileURL)(filePath).toString(),
|
|
820
|
+
range: {
|
|
821
|
+
start: { line, character: col },
|
|
822
|
+
end: { line, character: col + word.length },
|
|
823
|
+
},
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
catch { /* ignore */ }
|
|
829
|
+
// ── import module::symbol (legacy AST imports) — open module file ONLY for explicit symbols ──
|
|
830
|
+
// NOTE: do NOT match im.symbol === '*' — that would cause any word to jump to the first import!
|
|
831
|
+
const importDecl = program.imports?.find(im => im.symbol === word);
|
|
832
|
+
if (importDecl) {
|
|
833
|
+
const resolved = resolveImportPath(`stdlib/${importDecl.moduleName}.mcrs`, params.textDocument.uri)
|
|
834
|
+
?? resolveImportPath(importDecl.moduleName, params.textDocument.uri)
|
|
835
|
+
?? resolveImportPath(importDecl.moduleName + '.mcrs', params.textDocument.uri);
|
|
836
|
+
if (resolved) {
|
|
837
|
+
return {
|
|
838
|
+
uri: (0, url_1.pathToFileURL)(resolved).toString(),
|
|
839
|
+
range: { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } },
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
return null;
|
|
365
844
|
});
|
|
366
845
|
// ---------------------------------------------------------------------------
|
|
846
|
+
// Completion helpers
|
|
847
|
+
// ---------------------------------------------------------------------------
|
|
848
|
+
/** int[] built-in methods */
|
|
849
|
+
const ARRAY_METHOD_COMPLETIONS = [
|
|
850
|
+
{ label: 'push', kind: node_1.CompletionItemKind.Method, detail: '(value: int): void', documentation: 'Append an element to the array.' },
|
|
851
|
+
{ label: 'pop', kind: node_1.CompletionItemKind.Method, detail: '(): int', documentation: 'Remove and return the last element.' },
|
|
852
|
+
{ label: 'length', kind: node_1.CompletionItemKind.Property, detail: 'int', documentation: 'Number of elements in the array.' },
|
|
853
|
+
];
|
|
854
|
+
/** Collect (name → TypeNode) for all let bindings visible in the function body at offset. */
|
|
855
|
+
function collectLocals(body) {
|
|
856
|
+
const map = new Map();
|
|
857
|
+
// Sentinel type for variables whose type is unknown (e.g. foreach bindings)
|
|
858
|
+
const ENTITY_TYPE = { kind: 'named', name: 'int' }; // placeholder for entity/selector binding
|
|
859
|
+
function walk(stmts) {
|
|
860
|
+
for (const s of stmts) {
|
|
861
|
+
if (s.kind === 'let' && s.type) {
|
|
862
|
+
map.set(s.name, s.type);
|
|
863
|
+
}
|
|
864
|
+
else if (s.kind === 'foreach') {
|
|
865
|
+
// foreach binding is an entity/selector variable
|
|
866
|
+
map.set(s.binding, ENTITY_TYPE);
|
|
867
|
+
if (Array.isArray(s.body))
|
|
868
|
+
walk(s.body);
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
871
|
+
else if (s.kind === 'for') {
|
|
872
|
+
// for i in range — binding is int
|
|
873
|
+
if (s.binding)
|
|
874
|
+
map.set(s.binding, { kind: 'named', name: 'int' });
|
|
875
|
+
}
|
|
876
|
+
// Recurse into sub-blocks
|
|
877
|
+
const sub = s;
|
|
878
|
+
if (Array.isArray(sub['body']))
|
|
879
|
+
walk(sub['body']);
|
|
880
|
+
if (Array.isArray(sub['then']))
|
|
881
|
+
walk(sub['then']);
|
|
882
|
+
if (Array.isArray(sub['else_']))
|
|
883
|
+
walk(sub['else_']);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
walk(body);
|
|
887
|
+
return map;
|
|
888
|
+
}
|
|
889
|
+
/** Determine if line at cursor is a dot-access context: `<expr>.` */
|
|
890
|
+
function getDotReceiver(lineText, charPos) {
|
|
891
|
+
// Check that the character just before cursor is '.'
|
|
892
|
+
if (lineText[charPos - 1] !== '.')
|
|
893
|
+
return null;
|
|
894
|
+
// Scan left to collect the identifier before '.'
|
|
895
|
+
let end = charPos - 2;
|
|
896
|
+
while (end >= 0 && /\s/.test(lineText[end]))
|
|
897
|
+
end--;
|
|
898
|
+
if (end < 0)
|
|
899
|
+
return null;
|
|
900
|
+
let start = end;
|
|
901
|
+
while (start > 0 && /[a-zA-Z0-9_]/.test(lineText[start - 1]))
|
|
902
|
+
start--;
|
|
903
|
+
return lineText.slice(start, end + 1) || null;
|
|
904
|
+
}
|
|
905
|
+
// ---------------------------------------------------------------------------
|
|
367
906
|
// Completion
|
|
368
907
|
// ---------------------------------------------------------------------------
|
|
369
908
|
connection.onCompletion((params) => {
|
|
370
909
|
const doc = documents.get(params.textDocument.uri);
|
|
910
|
+
if (!doc) {
|
|
911
|
+
return [...KEYWORD_COMPLETIONS, ...TYPE_COMPLETIONS, ...BUILTIN_FN_COMPLETIONS, ...DECORATOR_COMPLETIONS];
|
|
912
|
+
}
|
|
913
|
+
const source = doc.getText();
|
|
914
|
+
const lines = source.split('\n');
|
|
915
|
+
const lineText = lines[params.position.line] ?? '';
|
|
916
|
+
const charPos = params.position.character;
|
|
917
|
+
const cached = parsedDocs.get(params.textDocument.uri);
|
|
918
|
+
const program = cached?.program ?? null;
|
|
919
|
+
// ── @ trigger: selector (@a/@p/@s/@e/@r/@n) vs decorator (@tick etc) ────────
|
|
920
|
+
// Only fires when the character just typed is '@' (triggerCharacter).
|
|
921
|
+
// insertText includes the full @xxx so VSCode replaces the '@' already on screen.
|
|
922
|
+
const prevChar = lineText[charPos - 1];
|
|
923
|
+
if (prevChar === '@') {
|
|
924
|
+
const before = lineText.slice(0, charPos - 1).trim();
|
|
925
|
+
const isExprContext = before.length > 0 && !/^(fn|let|if|while|for|return|@)/.test(before.split(/\s+/).pop() ?? '');
|
|
926
|
+
if (isExprContext) {
|
|
927
|
+
return SELECTOR_COMPLETIONS;
|
|
928
|
+
}
|
|
929
|
+
return DECORATOR_COMPLETIONS;
|
|
930
|
+
}
|
|
931
|
+
// ── Dot-access completion ──────────────────────────────────────────────────
|
|
932
|
+
const dotReceiver = getDotReceiver(lineText, charPos);
|
|
933
|
+
if (dotReceiver !== null) {
|
|
934
|
+
const items = [];
|
|
935
|
+
if (program) {
|
|
936
|
+
// Find which function body contains this line (by span)
|
|
937
|
+
const curLine = params.position.line + 1; // spans are 1-based
|
|
938
|
+
const encFn = findEnclosingFn(program, curLine);
|
|
939
|
+
const locals = encFn?.body
|
|
940
|
+
? collectLocals(encFn.body)
|
|
941
|
+
: null;
|
|
942
|
+
// Determine type of receiver
|
|
943
|
+
const receiverType = locals?.get(dotReceiver)
|
|
944
|
+
?? program.consts?.find(c => c.name === dotReceiver)?.type
|
|
945
|
+
?? program.globals?.find(g => g.name === dotReceiver)?.type;
|
|
946
|
+
if (receiverType) {
|
|
947
|
+
if (receiverType.kind === 'array') {
|
|
948
|
+
// int[] → push / pop / length
|
|
949
|
+
items.push(...ARRAY_METHOD_COMPLETIONS);
|
|
950
|
+
}
|
|
951
|
+
else if (receiverType.kind === 'named' || receiverType.kind === 'struct') {
|
|
952
|
+
const typeName = receiverType.name;
|
|
953
|
+
// Struct fields
|
|
954
|
+
const structDecl = program.structs?.find(s => s.name === typeName);
|
|
955
|
+
if (structDecl) {
|
|
956
|
+
for (const f of structDecl.fields) {
|
|
957
|
+
items.push({
|
|
958
|
+
label: f.name,
|
|
959
|
+
kind: node_1.CompletionItemKind.Field,
|
|
960
|
+
detail: typeToString(f.type),
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
// Impl methods
|
|
965
|
+
const implBlock = program.implBlocks?.find(ib => ib.typeName === typeName);
|
|
966
|
+
if (implBlock) {
|
|
967
|
+
for (const m of implBlock.methods) {
|
|
968
|
+
const params_ = m.params.map(p => `${p.name}: ${typeToString(p.type)}`).join(', ');
|
|
969
|
+
items.push({
|
|
970
|
+
label: m.name,
|
|
971
|
+
kind: node_1.CompletionItemKind.Method,
|
|
972
|
+
detail: `(${params_}): ${typeToString(m.returnType)}`,
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
else {
|
|
979
|
+
// Unknown type — offer all struct fields + impl methods as fallback
|
|
980
|
+
for (const ib of program.implBlocks ?? []) {
|
|
981
|
+
for (const m of ib.methods) {
|
|
982
|
+
items.push({ label: m.name, kind: node_1.CompletionItemKind.Method });
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
items.push(...ARRAY_METHOD_COMPLETIONS);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
return items;
|
|
989
|
+
}
|
|
990
|
+
// ── Global / normal completion ─────────────────────────────────────────────
|
|
371
991
|
const items = [
|
|
372
992
|
...KEYWORD_COMPLETIONS,
|
|
373
993
|
...TYPE_COMPLETIONS,
|
|
374
994
|
...BUILTIN_FN_COMPLETIONS,
|
|
375
995
|
...DECORATOR_COMPLETIONS,
|
|
376
996
|
];
|
|
377
|
-
if (!doc)
|
|
378
|
-
return items;
|
|
379
|
-
// Add user-defined functions from the parsed doc
|
|
380
|
-
const cached = parsedDocs.get(params.textDocument.uri);
|
|
381
|
-
const program = cached?.program ?? null;
|
|
382
997
|
if (program) {
|
|
998
|
+
// User-defined top-level symbols
|
|
383
999
|
for (const fn of program.declarations) {
|
|
384
1000
|
items.push({ label: fn.name, kind: node_1.CompletionItemKind.Function });
|
|
385
1001
|
}
|
|
@@ -392,10 +1008,250 @@ connection.onCompletion((params) => {
|
|
|
392
1008
|
for (const c of program.consts ?? []) {
|
|
393
1009
|
items.push({ label: c.name, kind: node_1.CompletionItemKind.Constant });
|
|
394
1010
|
}
|
|
1011
|
+
for (const g of program.globals ?? []) {
|
|
1012
|
+
items.push({ label: g.name, kind: node_1.CompletionItemKind.Variable });
|
|
1013
|
+
}
|
|
1014
|
+
// Locals from the enclosing function
|
|
1015
|
+
const curLine2 = params.position.line + 1;
|
|
1016
|
+
const encFn2 = findEnclosingFn(program, curLine2);
|
|
1017
|
+
if (encFn2?.body) {
|
|
1018
|
+
for (const [name, typ] of collectLocals(encFn2.body)) {
|
|
1019
|
+
items.push({
|
|
1020
|
+
label: name,
|
|
1021
|
+
kind: node_1.CompletionItemKind.Variable,
|
|
1022
|
+
detail: typeToString(typ),
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
// ── Functions from imported files (both "path" and module::* forms) ────────
|
|
1028
|
+
try {
|
|
1029
|
+
const importedPrograms = getImportedPrograms(source, params.textDocument.uri);
|
|
1030
|
+
for (const { prog, filePath } of importedPrograms) {
|
|
1031
|
+
for (const fn of prog.declarations) {
|
|
1032
|
+
const paramList = fn.params.map(p => `${p.name}: ${typeToString(p.type)}`).join(', ');
|
|
1033
|
+
items.push({
|
|
1034
|
+
label: fn.name,
|
|
1035
|
+
kind: node_1.CompletionItemKind.Function,
|
|
1036
|
+
detail: `(${paramList}) → ${typeToString(fn.returnType ?? { kind: 'named', name: 'void' })}`,
|
|
1037
|
+
documentation: `from ${path.basename(filePath)}`,
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
for (const s of prog.structs ?? []) {
|
|
1041
|
+
items.push({ label: s.name, kind: node_1.CompletionItemKind.Struct, documentation: `from ${path.basename(filePath)}` });
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
395
1044
|
}
|
|
1045
|
+
catch { /* ignore import completion errors */ }
|
|
396
1046
|
return items;
|
|
397
1047
|
});
|
|
398
1048
|
// ---------------------------------------------------------------------------
|
|
1049
|
+
// Helpers for word-at-position (used by references and rename)
|
|
1050
|
+
// ---------------------------------------------------------------------------
|
|
1051
|
+
function getWordRangeAtPosition(doc, position) {
|
|
1052
|
+
const text = doc.getText();
|
|
1053
|
+
const offset = doc.offsetAt(position);
|
|
1054
|
+
let start = offset;
|
|
1055
|
+
let end = offset;
|
|
1056
|
+
while (start > 0 && /[a-zA-Z0-9_]/.test(text[start - 1]))
|
|
1057
|
+
start--;
|
|
1058
|
+
while (end < text.length && /[a-zA-Z0-9_]/.test(text[end]))
|
|
1059
|
+
end++;
|
|
1060
|
+
if (start === end)
|
|
1061
|
+
return null;
|
|
1062
|
+
return { start: doc.positionAt(start), end: doc.positionAt(end) };
|
|
1063
|
+
}
|
|
1064
|
+
// ---------------------------------------------------------------------------
|
|
1065
|
+
// Signature Help
|
|
1066
|
+
// ---------------------------------------------------------------------------
|
|
1067
|
+
connection.onSignatureHelp((params) => {
|
|
1068
|
+
const doc = documents.get(params.textDocument.uri);
|
|
1069
|
+
if (!doc)
|
|
1070
|
+
return null;
|
|
1071
|
+
const parsed = parsedDocs.get(params.textDocument.uri);
|
|
1072
|
+
if (!parsed?.program)
|
|
1073
|
+
return null;
|
|
1074
|
+
const text = doc.getText();
|
|
1075
|
+
const offset = doc.offsetAt(params.position);
|
|
1076
|
+
// Walk backwards to find the opening '(' and count active parameter
|
|
1077
|
+
let depth = 0;
|
|
1078
|
+
let i = offset - 1;
|
|
1079
|
+
let activeParam = 0;
|
|
1080
|
+
while (i >= 0) {
|
|
1081
|
+
const ch = text[i];
|
|
1082
|
+
if (ch === ')')
|
|
1083
|
+
depth++;
|
|
1084
|
+
else if (ch === '(') {
|
|
1085
|
+
if (depth === 0)
|
|
1086
|
+
break;
|
|
1087
|
+
depth--;
|
|
1088
|
+
}
|
|
1089
|
+
else if (ch === ',' && depth === 0)
|
|
1090
|
+
activeParam++;
|
|
1091
|
+
i--;
|
|
1092
|
+
}
|
|
1093
|
+
if (i < 0)
|
|
1094
|
+
return null;
|
|
1095
|
+
// Extract function name before '('
|
|
1096
|
+
let nameEnd = i - 1;
|
|
1097
|
+
while (nameEnd >= 0 && /\s/.test(text[nameEnd]))
|
|
1098
|
+
nameEnd--;
|
|
1099
|
+
let nameStart = nameEnd;
|
|
1100
|
+
while (nameStart > 0 && /[a-zA-Z0-9_]/.test(text[nameStart - 1]))
|
|
1101
|
+
nameStart--;
|
|
1102
|
+
const fnName = text.slice(nameStart, nameEnd + 1);
|
|
1103
|
+
if (!fnName)
|
|
1104
|
+
return null;
|
|
1105
|
+
// Find function declaration in parsed program
|
|
1106
|
+
const fn = parsed.program.declarations.find(s => s.name === fnName);
|
|
1107
|
+
// Also check builtins (BUILTIN_METADATA is a Record<string, BuiltinDef>)
|
|
1108
|
+
const builtin = ALL_BUILTINS[fnName];
|
|
1109
|
+
if (!fn && !builtin)
|
|
1110
|
+
return null;
|
|
1111
|
+
let label;
|
|
1112
|
+
let paramsList;
|
|
1113
|
+
if (fn) {
|
|
1114
|
+
paramsList = fn.params.map(p => `${p.name}: ${typeToString(p.type)}`);
|
|
1115
|
+
label = `fn ${fn.name}(${paramsList.join(', ')}): ${typeToString(fn.returnType)}`;
|
|
1116
|
+
}
|
|
1117
|
+
else {
|
|
1118
|
+
paramsList = builtin.params?.map(p => `${p.name}: ${p.type}`) ?? [];
|
|
1119
|
+
label = `${builtin.name}(${paramsList.join(', ')}): ${builtin.returns ?? 'void'}`;
|
|
1120
|
+
}
|
|
1121
|
+
const paramInfos = paramsList.map(p => ({ label: p }));
|
|
1122
|
+
return {
|
|
1123
|
+
signatures: [
|
|
1124
|
+
{
|
|
1125
|
+
label,
|
|
1126
|
+
parameters: paramInfos,
|
|
1127
|
+
activeParameter: Math.min(activeParam, Math.max(0, paramInfos.length - 1)),
|
|
1128
|
+
},
|
|
1129
|
+
],
|
|
1130
|
+
activeSignature: 0,
|
|
1131
|
+
activeParameter: Math.min(activeParam, Math.max(0, paramInfos.length - 1)),
|
|
1132
|
+
};
|
|
1133
|
+
});
|
|
1134
|
+
// ---------------------------------------------------------------------------
|
|
1135
|
+
// Inlay Hints
|
|
1136
|
+
// ---------------------------------------------------------------------------
|
|
1137
|
+
connection.onRequest('textDocument/inlayHint', (params) => {
|
|
1138
|
+
const parsed = parsedDocs.get(params.textDocument.uri);
|
|
1139
|
+
if (!parsed?.program)
|
|
1140
|
+
return [];
|
|
1141
|
+
const doc = documents.get(params.textDocument.uri);
|
|
1142
|
+
if (!doc)
|
|
1143
|
+
return [];
|
|
1144
|
+
const hints = [];
|
|
1145
|
+
// Walk all let declarations with no explicit type annotation and emit inlay hints.
|
|
1146
|
+
// Since TypeChecker doesn't attach inferredType to AST nodes, we use collectLocals
|
|
1147
|
+
// which already infers types from init expressions.
|
|
1148
|
+
function walkBlock(stmts) {
|
|
1149
|
+
// Build a locals map for this block (includes inferred types)
|
|
1150
|
+
const locals = collectLocals(stmts);
|
|
1151
|
+
for (const stmt of stmts) {
|
|
1152
|
+
if (stmt.kind === 'let' && !stmt.type) {
|
|
1153
|
+
// No explicit type annotation — show inferred type as inlay hint
|
|
1154
|
+
const inferredType = locals.get(stmt.name);
|
|
1155
|
+
if (!inferredType)
|
|
1156
|
+
continue;
|
|
1157
|
+
const spanVal = stmt.span;
|
|
1158
|
+
if (!spanVal)
|
|
1159
|
+
continue;
|
|
1160
|
+
// Position hint after the variable name: line is 1-based in span, col is 1-based
|
|
1161
|
+
const line = Math.max(0, spanVal.line - 1);
|
|
1162
|
+
// Find the position after the variable name on that line
|
|
1163
|
+
const lineText = source.split('\n')[line] ?? '';
|
|
1164
|
+
const nameEnd = lineText.indexOf(stmt.name) + stmt.name.length;
|
|
1165
|
+
hints.push({
|
|
1166
|
+
position: { line, character: nameEnd },
|
|
1167
|
+
label: `: ${typeToString(inferredType)}`,
|
|
1168
|
+
kind: node_1.InlayHintKind.Type,
|
|
1169
|
+
paddingLeft: false,
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
// Recurse into nested blocks
|
|
1173
|
+
if (stmt.kind === 'if' || stmt.kind === 'while' || stmt.kind === 'for') {
|
|
1174
|
+
const s = stmt;
|
|
1175
|
+
const then_ = s['then'];
|
|
1176
|
+
if (Array.isArray(then_))
|
|
1177
|
+
walkBlock(then_);
|
|
1178
|
+
const else_ = s['else_'];
|
|
1179
|
+
if (Array.isArray(else_))
|
|
1180
|
+
walkBlock(else_);
|
|
1181
|
+
const body = s['body'];
|
|
1182
|
+
if (Array.isArray(body))
|
|
1183
|
+
walkBlock(body);
|
|
1184
|
+
}
|
|
1185
|
+
if (stmt.kind === 'foreach') {
|
|
1186
|
+
const s = stmt;
|
|
1187
|
+
const body = s['body'];
|
|
1188
|
+
if (Array.isArray(body))
|
|
1189
|
+
walkBlock(body);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
const source = doc.getText();
|
|
1194
|
+
parsed.program.declarations.forEach(top => {
|
|
1195
|
+
if (top.body)
|
|
1196
|
+
walkBlock(top.body);
|
|
1197
|
+
});
|
|
1198
|
+
return hints;
|
|
1199
|
+
});
|
|
1200
|
+
// ---------------------------------------------------------------------------
|
|
1201
|
+
// Find References
|
|
1202
|
+
// ---------------------------------------------------------------------------
|
|
1203
|
+
connection.onReferences((params) => {
|
|
1204
|
+
const doc = documents.get(params.textDocument.uri);
|
|
1205
|
+
if (!doc)
|
|
1206
|
+
return [];
|
|
1207
|
+
const parsed = parsedDocs.get(params.textDocument.uri);
|
|
1208
|
+
if (!parsed?.program)
|
|
1209
|
+
return [];
|
|
1210
|
+
const wordRange = getWordRangeAtPosition(doc, params.position);
|
|
1211
|
+
if (!wordRange)
|
|
1212
|
+
return [];
|
|
1213
|
+
const word = doc.getText(wordRange);
|
|
1214
|
+
if (!word)
|
|
1215
|
+
return [];
|
|
1216
|
+
const text = doc.getText();
|
|
1217
|
+
const locations = [];
|
|
1218
|
+
const regex = new RegExp(`\\b${word}\\b`, 'g');
|
|
1219
|
+
let match;
|
|
1220
|
+
while ((match = regex.exec(text)) !== null) {
|
|
1221
|
+
const start = doc.positionAt(match.index);
|
|
1222
|
+
const end = doc.positionAt(match.index + word.length);
|
|
1223
|
+
locations.push({
|
|
1224
|
+
uri: params.textDocument.uri,
|
|
1225
|
+
range: { start, end },
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
return locations;
|
|
1229
|
+
});
|
|
1230
|
+
// ---------------------------------------------------------------------------
|
|
1231
|
+
// Rename Symbol
|
|
1232
|
+
// ---------------------------------------------------------------------------
|
|
1233
|
+
connection.onRenameRequest((params) => {
|
|
1234
|
+
const doc = documents.get(params.textDocument.uri);
|
|
1235
|
+
if (!doc)
|
|
1236
|
+
return null;
|
|
1237
|
+
const wordRange = getWordRangeAtPosition(doc, params.position);
|
|
1238
|
+
if (!wordRange)
|
|
1239
|
+
return null;
|
|
1240
|
+
const word = doc.getText(wordRange);
|
|
1241
|
+
if (!word)
|
|
1242
|
+
return null;
|
|
1243
|
+
const text = doc.getText();
|
|
1244
|
+
const edits = [];
|
|
1245
|
+
const regex = new RegExp(`\\b${word}\\b`, 'g');
|
|
1246
|
+
let match;
|
|
1247
|
+
while ((match = regex.exec(text)) !== null) {
|
|
1248
|
+
const start = doc.positionAt(match.index);
|
|
1249
|
+
const end = doc.positionAt(match.index + word.length);
|
|
1250
|
+
edits.push({ range: { start, end }, newText: params.newName });
|
|
1251
|
+
}
|
|
1252
|
+
return { changes: { [params.textDocument.uri]: edits } };
|
|
1253
|
+
});
|
|
1254
|
+
// ---------------------------------------------------------------------------
|
|
399
1255
|
// Start
|
|
400
1256
|
// ---------------------------------------------------------------------------
|
|
401
1257
|
documents.listen(connection);
|