module lexer #include "@VMODROOT/lexer/block_scan.h" fn C.vile_identifier_run(const_source &u8, length i64) i64 fn C.vile_block_non_ascii(const_source &u8) int fn C.vile_block_string_special(const_source &u8) int @[inline] fn block_non_ascii(source string, start int) bool { // The private caller's loop established 0 <= start <= len - 16. C borrows // the immutable source synchronously and retains no pointer or allocation. return unsafe { C.vile_block_non_ascii(source.str + start) != 0 } } @[inline] fn block_string_special(source string, start int) bool { // Identical bounded-load contract to block_non_ascii; no source mutation, // ownership transfer, or pointer retention crosses this call. return unsafe { C.vile_block_string_special(source.str + start) != 0 } } @[inline] fn native_identifier_end(source string, start int) int { // The private caller supplies 0 <= start <= source.len. C borrows only the // remaining bytes, retains no pointer, and returns a count within that range. count := unsafe { C.vile_identifier_run(source.str + start, i64(source.len - start)) } return start + int(count) } fn C.vile_string_unicode_run(source &u8, length i64) i64 fn C.vile_comment_unicode_run(source &u8, length i64) i64 @[inline] fn native_string_unicode_end(source string, start int) int { return start + int(unsafe { C.vile_string_unicode_run(source.str + start, i64(source.len - start)) }) } @[inline] fn native_comment_unicode_end(source string, start int) int { return start + int(unsafe { C.vile_comment_unicode_run(source.str + start, i64(source.len - start)) }) } fn C.vile_string_legacy_run(source &u8, length i64) i64 @[inline] fn native_string_legacy_end(source string, start int) int { // Private caller proves start in0..len. C borrows only remaining bytes. return start + int(unsafe { C.vile_string_legacy_run(source.str + start, i64(source.len - start)) }) } fn C.vile_comment_ascii_run(source &u8, length i64) i64 @[inline] fn native_comment_ascii_end(source string, start int) int { // The caller proves an ASCII source and a valid remaining span. The existing // native loop specializes away Unicode candidates, without copies or views. return start + int(unsafe { C.vile_comment_ascii_run(source.str + start, i64(source.len - start)) }) }