toujours plus

This commit is contained in:
Benjamin Bouvier 2021-09-11 15:59:40 +02:00
parent 66718968a4
commit 67b763f20f
3 changed files with 29 additions and 3 deletions

View File

@ -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.

View File

@ -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
}
}

View File

@ -4,9 +4,6 @@ fn replace_ident(ident: Ident) -> Option<TokenTree> {
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<TokenTree> {
"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<TokenTree> {
"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<TokenTree> {
"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<TokenTree> {
"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<TokenTree> {
"suppose" => "expect",
"tant" => "while",
"utilisons" => "use",
"vers" => "into",
"vrai" => "true",
"énumération" => "enum",