MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / is_bytes_prefix

Function is_bytes_prefix

compiler/src/modules/lexer/tables.rs:148–157  ·  view source on GitHub ↗
(s: &[u8])

Source from the content-addressed store, hash-verified

146/* Bytes literal prefix: b, B, br, Br, bR, BR, rb, Rb, rB, RB. Emitted as `Bytes` so the parser produces `Value::Bytes`. */
147#[inline]
148pub fn is_bytes_prefix(s: &[u8]) -> bool {
149 match s.len() {
150 1 => matches!(s[0], b'b' | b'B'),
151 2 => matches!(
152 (s[0], s[1]),
153 (b'b' | b'B', b'r' | b'R') | (b'r' | b'R', b'b' | b'B')
154 ),
155 _ => false,
156 }
157}
158
159/* UTF-8 byte length from lead byte; supports non-ASCII identifiers. */
160#[inline]

Callers 1

next_tokenMethod · 0.85

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected