1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Platform-specific whitespace-end finder used by the lexer's
//! `skip_whitespace` routine.
//!
//! ## Public surface
//!
//! One function: `find_whitespace_end(bytes, start) -> usize`.
//!
//! Returns the index of the first non-whitespace byte at or after `start`,
//! or `bytes.len()` if all remaining bytes are whitespace. Only the four
//! DixScript whitespace bytes are recognised: space (0x20), tab (0x09),
//! carriage-return (0x0D), and line-feed (0x0A).
//!
//! ## Why split here instead of inside `skip_whitespace`?
//!
//! `skip_whitespace` needs to count newlines for accurate `line`/`column`
//! tracking. Mixing that count into the SIMD fast-path complicates the
//! implementation without a meaningful throughput win (whitespace blocks are
//! short in config files; newlines within them are rarer still).
//!
//! The chosen split:
//! 1. **Platform module** — finds the *position* of the first non-whitespace
//! byte as fast as possible (16 bytes at a time on SIMD targets).
//! 2. **Lexer** — counts `\n` bytes in the resulting slice with
//! `memchr::memchr_iter` (itself SIMD-accelerated) in a single pass,
//! then updates `line` and `column` arithmetically.
//!
//! ## Platform routing
//!
//! | Target | Module | Strategy |
//! |-----------------|--------------|---------------------------------------|
//! | `x86_64` | `x86_64` | SSE2 (guaranteed by ABI baseline) |
//! | `aarch64` | `aarch64` | NEON (guaranteed by ABI baseline) |
//! | `wasm32` | `wasm32` | SIMD128 when `+simd128` feature flag |
//! | everything else | `scalar` | byte-at-a-time match |
// Scalar is always compiled — used as the tail handler by SIMD modules.
/// Returns the byte offset of the first non-whitespace byte at or after
/// `start`, or `bytes.len()` if the remainder of the slice is all whitespace.
///
/// Recognises only ` ` (0x20), `\t` (0x09), `\r` (0x0D), `\n` (0x0A).