scanner: Avoid recomputing consumed index

f2ff6b8e805a68a62c8a646a820c370a392df250c46274315ad646fabdc952f3
`advance` incremented the cursor before loading the consumed byte.
Each call therefore subtracted one from the updated cursor.

Load the byte first and then increment the cursor. This removes
redundant arithmetic from the scanner hot path.

Assisted-by: Codex:gpt-5.6-sol
Alexis Sellier committed ago 1 parent a902a880
lib/std/lang/scanner.rad +2 -1
257 257
    return s.source[s.cursor + 1];
258 258
}
259 259
260 260
/// Advance scanner and return the character that was consumed.
261 261
fn advance(s: *mut Scanner) -> u8 {
262 +
    let ch = s.source[s.cursor];
262 263
    set s.cursor += 1;
263 -
    return s.source[s.cursor - 1];
264 +
    return ch;
264 265
}
265 266
266 267
/// Consume the expected character if it matches the current position.
267 268
fn consume(s: *mut Scanner, expected: u8) -> bool {
268 269
    if let c = current(s); c == expected {