diff --git a/README.md b/README.md index 0c29339..600e5ce 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ convenience. Here's an example of what can be achieved with Rouille: +### struct and impl (aka convention et réalisation) + ```rust rouille::rouille! { utilisons std::collections::Dictionnaire comme Dico; @@ -53,6 +55,19 @@ rouille::rouille! { } ``` +### Support for regional languages + +```rust +#[légal(code_inaccessible)] +fonction secondaire() { + merde!("oh non"); // for the true French experience + calisse!("tabernacle"); // for friends speaking fr-ca + oups!("fetchez la vache"); // in SFW contexts +} +``` + +### Other examples + See the [examples](./examples/src/main.rs) to get a rough sense of the whole syntax. Voilà, that's it. diff --git a/examples/src/main.rs b/examples/src/main.rs index 6898cae..6a13971 100644 --- a/examples/src/main.rs +++ b/examples/src/main.rs @@ -72,5 +72,14 @@ rouille::rouille! { 12 }; } + + secondaire(); + } + + #[légal(code_inaccessible)] + fonction secondaire() { + merde!("oh non"); // for the true French experience + calisse!("tabernacle"); // for friends speaking fr-ca + oups!("fetchez la vache"); // in SFW contexts } } diff --git a/rouille_proc_macro/src/lib.rs b/rouille_proc_macro/src/lib.rs index 67e591f..36c1938 100644 --- a/rouille_proc_macro/src/lib.rs +++ b/rouille_proc_macro/src/lib.rs @@ -4,9 +4,6 @@ fn replace_ident(ident: Ident) -> Option { let ident_str = ident.to_string(); let new_str = match ident_str.as_str() { - "vers" => "into", - "réf" => "ref", - "en_réf" => "as_ref", "Arf" => "Err", "Bien" => "Ok", "Chaine" => "String", @@ -25,6 +22,7 @@ fn replace_ident(ident: Ident) -> Option { "boucle" => "loop", "bouge" => "move", "cagette" => "crate", + "code_inaccessible" => "unreachable_code", "comme" => "as", "constant" => "const", "convention" => "trait", @@ -34,6 +32,7 @@ fn replace_ident(ident: Ident) -> Option { "dynamique" => "dyn", "déballer" => "unwrap", "défaut" => "default", + "en_réf" => "as_ref", "es" => "io", "externe" => "extern", "faux" => "false", @@ -41,6 +40,7 @@ fn replace_ident(ident: Ident) -> Option { "génial" => "super", "insérer" => "insert", "lire" => "get", + "légal" => "allow", "merde" | "calisse" | "oups" => "panic", "module" => "mod", "mutable" => "mut", @@ -53,6 +53,7 @@ fn replace_ident(ident: Ident) -> Option { "que" => None?, "renvoie" => "return", "réalisation" => "impl", + "réf" => "ref", "selon" => "match", "si" => "if", "sinon" => "else", @@ -63,6 +64,7 @@ fn replace_ident(ident: Ident) -> Option { "suppose" => "expect", "tant" => "while", "utilisons" => "use", + "vers" => "into", "vrai" => "true", "énumération" => "enum",