Skip to main content

luaur_bytecode_cli/functions/
report_error_bytecode.rs

1use core::ffi::c_char;
2
3use luaur_ast::records::parse_error::ParseError;
4
5use crate::functions::report::report;
6
7pub fn report_error_c_char_luau_parse_error(name: *const c_char, error: &ParseError) {
8    // The C++ source calls report(name, error.getLocation(), "SyntaxError", error.what()).
9    // We use the exact Rust identifiers for the dependencies:
10    // - error.get_location() returns &Location
11    // - error.what() returns &str
12    // - report takes (*const c_char, &Location, *const c_char, *const c_char)
13
14    report(
15        name,
16        error.get_location(),
17        c"SyntaxError".as_ptr(),
18        error.what().as_ptr() as *const c_char,
19    );
20}