luaur_bytecode_cli/functions/
report.rs1use core::ffi::c_char;
2use core::ffi::CStr;
3
4pub fn report(
5 name: *const c_char,
6 location: &luaur_ast::records::location::Location,
7 r#type: *const c_char,
8 message: *const c_char,
9) {
10 unsafe {
11 let name_str = CStr::from_ptr(name).to_string_lossy();
12 let type_str = CStr::from_ptr(r#type).to_string_lossy();
13 let message_str = CStr::from_ptr(message).to_string_lossy();
14
15 eprintln!(
16 "{}({},{}): {}: {}",
17 name_str,
18 location.begin.line + 1,
19 location.begin.column + 1,
20 type_str,
21 message_str
22 );
23 }
24}