MCPcopy Index your code
hub / github.com/RustPython/RustPython / at

Function at

crates/sre_engine/src/engine.rs:1192–1208  ·  view source on GitHub ↗
(req: &Request<'_, S>, ctx: &MatchContext, at_code: SreAtCode)

Source from the content-addressed store, hash-verified

1190}
1191
1192fn at<S: StrDrive>(req: &Request<'_, S>, ctx: &MatchContext, at_code: SreAtCode) -> bool {
1193 match at_code {
1194 SreAtCode::BEGINNING | SreAtCode::BEGINNING_STRING => ctx.at_beginning(),
1195 SreAtCode::BEGINNING_LINE => ctx.at_beginning() || is_linebreak(ctx.back_peek_char::<S>()),
1196 SreAtCode::BOUNDARY => ctx.at_boundary(req, is_word),
1197 SreAtCode::NON_BOUNDARY => ctx.at_non_boundary(req, is_word),
1198 SreAtCode::END => {
1199 (ctx.remaining_chars(req) == 1 && ctx.at_linebreak(req)) || ctx.at_end(req)
1200 }
1201 SreAtCode::END_LINE => ctx.at_linebreak(req) || ctx.at_end(req),
1202 SreAtCode::END_STRING => ctx.at_end(req),
1203 SreAtCode::LOC_BOUNDARY => ctx.at_boundary(req, is_loc_word),
1204 SreAtCode::LOC_NON_BOUNDARY => ctx.at_non_boundary(req, is_loc_word),
1205 SreAtCode::UNI_BOUNDARY => ctx.at_boundary(req, is_uni_word),
1206 SreAtCode::UNI_NON_BOUNDARY => ctx.at_non_boundary(req, is_uni_word),
1207 }
1208}
1209
1210fn char_loc_ignore(code: u32, c: u32) -> bool {
1211 code == c || code == lower_locate(c) || code == upper_locate(c)

Callers 3

fooMethod · 0.85
test_tp_await_2Method · 0.85
_matchFunction · 0.85

Calls 7

is_linebreakFunction · 0.85
at_beginningMethod · 0.80
at_boundaryMethod · 0.80
at_non_boundaryMethod · 0.80
remaining_charsMethod · 0.80
at_linebreakMethod · 0.80
at_endMethod · 0.45

Tested by 2

fooMethod · 0.68
test_tp_await_2Method · 0.68