MCPcopy Create free account
hub / github.com/davidblewett/rure-python / parse_flag

Method parse_flag

regex/regex-syntax/src/ast/parse.rs:1374–1387  ·  view source on GitHub ↗

Parse the current character as a flag. Do not advance the parser. # Errors If the flag is not recognized, then an error is returned.

(&self)

Source from the content-addressed store, hash-verified

1372 ///
1373 /// If the flag is not recognized, then an error is returned.
1374 fn parse_flag(&self) -> Result<ast::Flag> {
1375 match self.char() {
1376 'i' => Ok(ast::Flag::CaseInsensitive),
1377 'm' => Ok(ast::Flag::MultiLine),
1378 's' => Ok(ast::Flag::DotMatchesNewLine),
1379 'U' => Ok(ast::Flag::SwapGreed),
1380 'u' => Ok(ast::Flag::Unicode),
1381 'x' => Ok(ast::Flag::IgnoreWhitespace),
1382 _ => Err(self.error(
1383 self.span_char(),
1384 ast::ErrorKind::FlagUnrecognized,
1385 )),
1386 }
1387 }
1388
1389 /// Parse a primitive AST. e.g., A literal, non-set character class or
1390 /// assertion.

Callers 1

parse_flagsMethod · 0.80

Calls 3

span_charMethod · 0.80
charMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected