xtask/codegen/
parsers_dep.rs1use std::fs;
2
3use anyhow::Result;
4
5use crate::schema::Group;
6
7pub fn write() -> Result<()> {
8 let toml_path = crate::WORKSPACE_DIR.join("syntastica-parsers/Cargo.toml");
9 let mut toml = fs::read_to_string(&toml_path)?;
10
11 if let Some((preserve, _)) = toml.split_once(super::TOML_AUTOGEN_HEADER) {
12 toml.truncate(preserve.len());
13 }
14 toml += super::TOML_AUTOGEN_HEADER;
15
16 toml += super::TOML_FEATURES_HEAD;
17 toml += &super::parsers_toml_feature(Group::Some);
18 toml += super::TOML_FEATURES_MOST;
19 toml += &super::parsers_toml_feature(Group::Most);
20 toml += super::TOML_FEATURES_ALL;
21 toml += &super::parsers_toml_feature(Group::All);
22
23 toml += super::TOML_FEATURES_DOCS;
24
25 toml += &super::parsers_toml_lang_features(super::ParserCollection::Dep);
26
27 super::parsers_toml_deps(&mut toml, false);
28
29 fs::write(&toml_path, toml)?;
30
31 Ok(())
32}