// Copyright (C) 2022, Alex Badics
// This file is part of peginator
// Licensed under the MIT license. See LICENSE file in the project root for details.
use super::{BUILD_TIME, VERSION};
pub fn generate_source_header(grammar: &str) -> String {
let crc32 = crc::Crc::<u32>::new(&crc::CRC_32_ISO_HDLC).checksum(grammar.as_bytes());
format!(
"// This file was generated by Peginator v{VERSION} built at {BUILD_TIME}\n\
// CRC-32/ISO-HDLC of the grammar file: {crc32:08x}\n\
// Any changes to it will be lost on regeneration\n",
)
}