Recognizes keyword assignments exclusive to the `pkgbase` section in SRCINFO data. This function backtracks in case no keyword in this group matches.
(input: &mut &str)
| 520 | |
| 521 | /// Recognizes keyword assignments exclusive to the `pkgbase` section in SRCINFO data. |
| 522 | /// |
| 523 | /// This function backtracks in case no keyword in this group matches. |
| 524 | fn exclusive_property_parser(input: &mut &str) -> ModalResult<PackageBaseProperty> { |
| 525 | // First off, get the type of the property. |
| 526 | let keyword = |
| 527 | trace("exclusive_pkgbase_property", PackageBaseKeyword::parser).parse_next(input)?; |
| 528 | |
| 529 | // Parse a possible architecture suffix for architecture specific fields. |
| 530 | let architecture = match keyword { |
| 531 | PackageBaseKeyword::MakeDepends | PackageBaseKeyword::CheckDepends => { |
| 532 | architecture_suffix.parse_next(input)? |
| 533 | } |
| 534 | _ => None, |
| 535 | }; |
| 536 | |
| 537 | // Expect the ` = ` separator between the key-value pair |
| 538 | let _ = delimiter.parse_next(input)?; |
| 539 | |
| 540 | let property = match keyword { |
| 541 | PackageBaseKeyword::PkgVer => cut_err( |
| 542 | PackageVersion::parser_until_line_ending_inclusive |
| 543 | .map(PackageBaseProperty::PackageVersion), |
| 544 | ) |
| 545 | .parse_next(input)?, |
| 546 | PackageBaseKeyword::PkgRel => cut_err( |
| 547 | PackageRelease::parser_until_line_ending_inclusive |
| 548 | .map(PackageBaseProperty::PackageRelease), |
| 549 | ) |
| 550 | .parse_next(input)?, |
| 551 | |
| 552 | PackageBaseKeyword::Epoch => cut_err(Epoch::parser_until_line_ending_inclusive) |
| 553 | .map(PackageBaseProperty::PackageEpoch) |
| 554 | .parse_next(input)?, |
| 555 | PackageBaseKeyword::ValidPGPKeys => cut_err( |
| 556 | till_line_end |
| 557 | .try_map(OpenPGPIdentifier::from_str) |
| 558 | .map(PackageBaseProperty::ValidPgpKeys), |
| 559 | ) |
| 560 | .parse_next(input)?, |
| 561 | |
| 562 | // Handle `pkgbase` specific package relations. |
| 563 | PackageBaseKeyword::MakeDepends | PackageBaseKeyword::CheckDepends => { |
| 564 | // Read and parse the generic architecture specific PackageRelation. |
| 565 | let value = cut_err(PackageRelation::parser_until_line_ending).parse_next(input)?; |
| 566 | let arch_property = ArchProperty { |
| 567 | architecture, |
| 568 | value, |
| 569 | }; |
| 570 | |
| 571 | // Now map the generic relation to the specific relation type. |
| 572 | match keyword { |
| 573 | PackageBaseKeyword::CheckDepends => { |
| 574 | PackageBaseProperty::CheckDependency(arch_property) |
| 575 | } |
| 576 | PackageBaseKeyword::MakeDepends => { |
| 577 | PackageBaseProperty::MakeDependency(arch_property) |
| 578 | } |
| 579 | _ => unreachable!(), |
nothing calls this directly
no outgoing calls
no test coverage detected