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)
| 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. |
no test coverage detected