Create an ast::SetFlags. The given pattern should be the full pattern string. The range given should correspond to the byte offsets where the flag set occurs. If negated is true, then the set is interpreted as beginning with a negation.
(
pat: &str,
range: Range<usize>,
flag: ast::Flag,
negated: bool,
)
| 2424 | /// If negated is true, then the set is interpreted as beginning with a |
| 2425 | /// negation. |
| 2426 | fn flag_set( |
| 2427 | pat: &str, |
| 2428 | range: Range<usize>, |
| 2429 | flag: ast::Flag, |
| 2430 | negated: bool, |
| 2431 | ) -> Ast { |
| 2432 | let mut items = vec![ |
| 2433 | ast::FlagsItem { |
| 2434 | span: span_range(pat, (range.end - 2)..(range.end - 1)), |
| 2435 | kind: ast::FlagsItemKind::Flag(flag), |
| 2436 | }, |
| 2437 | ]; |
| 2438 | if negated { |
| 2439 | items.insert(0, ast::FlagsItem { |
| 2440 | span: span_range(pat, (range.start + 2)..(range.end - 2)), |
| 2441 | kind: ast::FlagsItemKind::Negation, |
| 2442 | }); |
| 2443 | } |
| 2444 | Ast::Flags(ast::SetFlags { |
| 2445 | span: span_range(pat, range.clone()), |
| 2446 | flags: ast::Flags { |
| 2447 | span: span_range(pat, (range.start + 2)..(range.end - 1)), |
| 2448 | items: items, |
| 2449 | }, |
| 2450 | }) |
| 2451 | } |
| 2452 | |
| 2453 | #[test] |
| 2454 | fn parse_nest_limit() { |
nothing calls this directly
no test coverage detected