use semver::Version;
/// `LanguageFacts` provides metadata about Slang's `{{ model.language_name }}` language support.
pub struct LanguageFacts;
impl LanguageFacts {
/// All the versions of `{{ model.language_name }}` supported by Slang.
pub const ALL_VERSIONS: &'static [Version] = &[
{% for version in model.all_language_versions %}
Version::new({{ version | split(pat=".") | join(sep=", ") }}),
{% endfor %}
];
/// The earliest version of `{{ model.language_name }}` supported by Slang.
pub const EARLIEST_VERSION: Version = Version::new(
{{ model.all_language_versions | first() | split(pat=".") | join(sep=", ") }}
);
/// The latest version of `{{ model.language_name }}` supported by Slang.
pub const LATEST_VERSION: Version = Version::new(
{{ model.all_language_versions | last() | split(pat=".") | join(sep=", ") }}
);
/// Infer the language versions that are compatible with the provided `{{ model.language_name }}`
/// source code. The returned iterator will produce all compatible versions in order, starting with
/// the earliest one.
pub fn infer_language_versions(input: &str) -> impl Iterator<Item = &'static Version> {
crate::utils::infer_language_versions(input)
}
}