| 1 | use std::{env, fs, path::Path}; |
| 2 | |
| 3 | fn main() { |
| 4 | println!("cargo::rerun-if-changed=build.rs"); |
| 5 | let mut node_type_variants = String::new(); |
| 6 | let mut match_arms = String::new(); |
| 7 | for name in css_ast::NodeId::all_variants() { |
| 8 | node_type_variants.push_str(&format!("\t{},\n", name)); |
| 9 | match_arms.push_str(&format!("\t\t\tSelf::{} => Some(NodeId::{}),\n", name, name)); |
| 10 | } |
| 11 | |
| 12 | if node_type_variants.is_empty() { |
| 13 | panic!("node_type_variants is empty!"); |
| 14 | } |
| 15 | |
| 16 | let content = format!( |
| 17 | r#" |
| 18 | #[derive(AtomSet, Debug, Default, Copy, Clone, PartialEq, Eq, Hash)] |
| 19 | pub enum CsskitAtomSet {{ |
| 20 | #[default] |
| 21 | _None, |
| 22 | |
| 23 | // Vendor prefixes |
| 24 | Webkit, |
| 25 | Moz, |
| 26 | Ms, |
| 27 | O, |
| 28 | |
| 29 | // Boolean operators |
| 30 | And, |
| 31 | Or, |
| 32 | True, |
| 33 | False, |
| 34 | |
| 35 | // Stats atoms |
| 36 | Advice, |
| 37 | Attr, |
| 38 | Bytes, |
| 39 | Collect, |
| 40 | Counter, |
| 41 | Diagnostic, |
| 42 | Error, |
| 43 | Level, |
| 44 | Lines, |
| 45 | Stat, |
| 46 | Type, |
| 47 | Unique, |
| 48 | Warning, |
| 49 | When, |
| 50 | |
| 51 | // Pseudo-classes |
| 52 | Important, |
| 53 | Custom, |
| 54 | Prefixed, |
| 55 | Unknown, |
| 56 | Computed, |
| 57 | Shorthand, |
| 58 | Longhand, |
| 59 | PropertyType, |
| 60 | Empty, |