use crate::parser::token_stream::TokenStream;
pub struct AnchorErrors;
impl AnchorErrors {
pub fn invalid_anchored_alias(stream: &mut TokenStream) -> crate::error::YamlError {
crate::parser::utils::error_builder::mapping_key_error_yaml(
stream.source_mut(),
"Invalid anchored alias: anchors cannot be applied to alias nodes",
)
}
pub fn anchor_cannot_precede_dash_same_line(
stream: &mut TokenStream,
) -> crate::error::YamlError {
crate::parser::utils::error_builder::syntax_error(
stream.source_mut(),
"Invalid anchor usage: anchor cannot directly precede a sequence indicator on the same line; attach the anchor to the node (e.g., '- &name value')",
)
}
pub fn anchor_cannot_precede_dash_block(stream: &mut TokenStream) -> crate::error::YamlError {
crate::parser::utils::error_builder::syntax_error(
stream.source_mut(),
"Invalid anchor usage: anchor cannot directly precede a sequence indicator; attach the anchor to the node (e.g., '- &name value')",
)
}
pub fn multiple_anchors(stream: &mut TokenStream) -> crate::error::YamlError {
crate::parser::utils::error_builder::mapping_key_error_yaml(
stream.source_mut(),
"A node cannot have multiple anchors",
)
}
}