MCPcopy Create free account
hub / github.com/archlinux/alpm / shared_meta_parser

Method shared_meta_parser

alpm-srcinfo/src/source_info/parser.rs:1191–1218  ·  view source on GitHub ↗

Recognizes all keyword assignments in SRCINFO data that represent a cleared [`SharedMetaProperty`]. A cleared property is represented by a keyword that is assigned an empty value. It indicates that the keyword assignment should remain empty for a given package. Example: ```txt pkgdesc = depends = ``` The above properties would indicate that both `pkgdesc` and the `depends` array are to be clear

(input: &mut &str)

Source from the content-addressed store, hash-verified

1189
1190 Ok(property)
1191 }
1192 }
1193
1194 /// Same as [`Self::shared_meta_parser`], but for clearable [RelationProperty].
1195 ///
1196 /// # Note
1197 ///
1198 /// This function relies on the keyword already been parsed and expects it as parameter.
1199 /// The cursor should be positioned right after the keyword.
1200 fn relation_parser<'a>(
1201 keyword: RelationKeyword,
1202 ) -> impl Parser<Input<'a>, Self, ErrMode<ParseStack<'a>>> {
1203 move |input: &mut Input<'a>| -> PResult<'a, Self> {
1204 // All relations may be architecture specific.
1205 let architecture = architecture_suffix.parse_next(input)?;
1206
1207 // Now check if it's actually a clear.
1208 // This parser fails and backtracks in case there's anything but spaces and a newline
1209 // after the delimiter, which indicates that there's an actual value that is
1210 // set for this property.
1211 let _ = (" =", space0, newline).parse_next(input)?;
1212
1213 let property = match keyword {
1214 RelationKeyword::Depends => ClearableProperty::Dependencies(architecture),
1215 RelationKeyword::OptDepends => {
1216 ClearableProperty::OptionalDependencies(architecture)
1217 }
1218 RelationKeyword::Provides => ClearableProperty::Provides(architecture),
1219 RelationKeyword::Conflicts => ClearableProperty::Conflicts(architecture),
1220 RelationKeyword::Replaces => ClearableProperty::Replaces(architecture),
1221 };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected