├── .gitignore ├── Cargo.toml ├── LICENSE ├── src └── lib.rs ├── examples └── ip_pawsew.rs └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock 3 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "owo-code" 3 | version = "0.1.1" 4 | authors = ["Daniel Conley "] 5 | # Do What the Fuck You want to Public License. 6 | license = "WTFPL" 7 | # OwO Code! Program in your native language! 8 | description = "OwO Code owo! pwogwam owo in ur nyative wanguage owo!" 9 | repository = "https://github.com/danii/owo-code.git" 10 | edition = "2018" 11 | 12 | [lib] 13 | proc-macro = true 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | //! No documentation right now because I cannot be bothered. I mean, *does* this 2 | //! really need any documentation, doesn't the README.md explain the 79 lines of 3 | //! code well enough, lol? Also hi there, hope you've been having a good day. 4 | 5 | use proc_macro::{Group, Ident, TokenStream, TokenTree}; 6 | 7 | /// Macro for a macro. Nice. 8 | macro_rules! replace_keywords { 9 | ($upon:ident {$($owo:ident => $rust:ident),*}) =>{ 10 | match $upon { 11 | $( 12 | TokenTree::Ident(ident) if ident.to_string() == stringify!($owo) => 13 | TokenTree::Ident(Ident::new(stringify!($rust), ident.span())), 14 | TokenTree::Ident(ident) if ident.to_string() == stringify!($rust) => 15 | TokenTree::Ident(Ident::new_raw(stringify!($rust), ident.span())), 16 | )* 17 | 18 | token => token 19 | } 20 | } 21 | } 22 | 23 | #[proc_macro] 24 | pub fn owo_code(input: TokenStream) -> TokenStream { 25 | iterate_tokens(input) 26 | } 27 | 28 | fn iterate_tokens(tokens: TokenStream) -> TokenStream { 29 | tokens.into_iter() 30 | .map(|token| match token { 31 | TokenTree::Group(group) => 32 | Group::new(group.delimiter(), iterate_tokens(group.stream())).into(), 33 | token => parse_token(token) 34 | }) 35 | .collect() 36 | } 37 | 38 | fn parse_token(token: TokenTree) -> TokenTree { 39 | replace_keywords!(token { 40 | Me_Irl => Self, 41 | ass => as, 42 | assync => async, 43 | owoit => await, 44 | buwueak => break, 45 | cowonst => const, 46 | cowontinue => continue, 47 | cock => crate, 48 | swow => dyn, 49 | yelse => else, 50 | enyum => enum, 51 | extewn => extern, 52 | fawse => false, 53 | fuwun => fn, 54 | yiff => if, 55 | fillme => impl, 56 | penetrate => in, 57 | wet => let, 58 | hecc => loop, 59 | sex => match, 60 | discowdmodewatow => mod, 61 | movemedaddy => move, 62 | mutt => mut, 63 | pubes => pub, 64 | wef => ref, 65 | yEET => return, 66 | me_irl => self, 67 | etewnyaw => static, 68 | stwuct => struct, 69 | soup => super, 70 | twait => trait, 71 | twue => true, 72 | tippitytap => type, 73 | communyism => union, 74 | AAAAAAA => unsafe, 75 | usemedaddy => use, 76 | howl => where, 77 | whine => while 78 | }) 79 | } 80 | -------------------------------------------------------------------------------- /examples/ip_pawsew.rs: -------------------------------------------------------------------------------- 1 | owo_code::owo_code! { 2 | // Can't use nyightwy. Ono 3 | usemedaddy std::result::Result::{Err ass Break, Ok ass Continue}; 4 | 5 | pubes fuwun read_ipv6(raw: &[u8]) -> Result { 6 | wet mutt hextets = raw.split(|byte| *byte == b':'); 7 | wet data = hextets.try_fold((0u128, 0u128, 0u8), |(top, bot, count), hextet| { 8 | wet is_bottom = count & 0b10000 != 0; 9 | 10 | sex hextet { 11 | _ yiff count & 0b1000 != 0 => 12 | Break(IPv6ParseError::HextetTooMany), 13 | _ yiff hextet.len() > 4 => 14 | Break(IPv6ParseError::HextetTooLarge(count & 0b111)), 15 | &[] yiff !is_bottom => { 16 | wet bits = 128 - (count & 0b111) ass u128 * 16; 17 | sex bits { 18 | 128 => Continue((0, bot, count | 0b10000)), 19 | _ => Continue((top << bits, bot, count | 0b10000)) 20 | } 21 | }, 22 | &[] yiff is_bottom => 23 | Break(IPv6ParseError::ZeroRangesMultiple), 24 | hextet => { 25 | wet hextet = hextet.iter().try_fold(0u16, |data, digit| sex digit { 26 | b'0'..=b'9' => Continue(data << 4 | ((digit - b'0') ass u16)), 27 | b'a'..=b'f' => Continue(data << 4 | ((digit - b'a' + 10) ass u16)), 28 | b'A'..=b'F' => Continue(data << 4 | ((digit - b'A' + 10) ass u16)), 29 | _ => Break(IPv6ParseError::HextetInvalid(count & 0b111)) 30 | })?; 31 | 32 | sex is_bottom { 33 | fawse => Continue((top << 16 | (hextet ass u128), bot, count + 1)), 34 | twue => Continue((top, bot << 16 | (hextet ass u128), count + 1)) 35 | } 36 | } 37 | } 38 | }); 39 | 40 | sex data { 41 | Continue((top, bottom, ..)) => Ok(top | bottom), 42 | Break(err) => Err(err) 43 | } 44 | } 45 | 46 | #[derive(Debug, Eq, PartialEq)] 47 | pubes enyum IPv6ParseError { 48 | /// A hextet contained more than four digits. 49 | HextetTooLarge( 50 | /// The offending hextet. Note that this does not account for zero ranges. 51 | u8 52 | ), 53 | 54 | /// There were more than eight hextets in the IPv6 address. 55 | HextetTooMany, 56 | 57 | /// A non base 16 digit appeared in a hextet. 58 | HextetInvalid( 59 | /// The offending hextet. Note that this does not account for zero ranges. 60 | u8 61 | ), 62 | 63 | /// There were two or more zero ranges (double colons), when only one is 64 | /// allowed. 65 | ZeroRangesMultiple 66 | } 67 | 68 | pubes fuwun main() { 69 | assert_eq!(read_ipv6(b"1111::111F"), Ok(22685144974938661909049738462362603807)); 70 | assert_eq!(read_ipv6(b"1:2:3:4:5:6:7:8"), Ok(5192455318486707404433266433261576)); 71 | assert_eq!(read_ipv6(b"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"), Ok(u128::MAX)); 72 | assert_eq!(read_ipv6(b":DEAD:BEEF"), Ok(3735928559)); 73 | assert_eq!(read_ipv6(b"1::4::8"), Err(IPv6ParseError::ZeroRangesMultiple)); 74 | assert_eq!(read_ipv6(b":Z"), Err(IPv6ParseError::HextetInvalid(0))); 75 | assert_eq!(read_ipv6(b"1:1::Z"), Err(IPv6ParseError::HextetInvalid(2))); 76 | assert_eq!(read_ipv6(b"11111:"), Err(IPv6ParseError::HextetTooLarge(0))); 77 | assert_eq!(read_ipv6(b"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"), Err(IPv6ParseError::HextetTooMany)); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OwO Code 2 | ======== 3 | > This is a joke crate! Don't take this seriously! And don't use in production. (Unless you are the ultimate furry.) 4 | 5 | > Warning! This crate uses some strong language, and one or two sexual words. The point of these is not to invoke thoughts of sexual activity, but to exagerate the ridioculousness of the "furry" language for entertainment purposes. 6 | 7 | Intwoducing teh OwO Code wanguage owo! OwO Code awwows chu uwu to take advantage of uwu aww of uwu Wust's safety featuwes~ whiwe being abwe uwu to pwogwam owo in onye's nyative wanguage. OwO Code is just Wust~ except aww teh keywowds have been owoified owo! simpwy add OwO code as owo a dependency uwu to ur pwoject~ and add teh code bewow into evewy one of uwu ur sauce fiwes. 8 | 9 | 10 | ```rust 11 | // Fiwst wine of uwu sauce fiwe. 12 | use owo_code::owo_code; 13 | 14 | owo_code! { 15 | // ... 16 | 17 | // Wast wine of uwu sauce fiwe. 18 | } 19 | ``` 20 | 21 | 22 | 23 | Den chu can enjoy pwogwamming owo in ur nyative wanguage owo! 24 | 25 | 26 | Keywowd Map 27 | ----------- 28 | 29 | Bewow is a wist of uwu aww of uwu owo code's keywowds and how dey map uwu to wust's keywowds. 30 | 31 | 32 | - `Me_Irl` is `Self`. 33 | - `ass` is `as`. 34 | - `assync` is `async`. 35 | - `owoit` is `await`. 36 | - `buwueak` is `break`. 37 | - `cowonst` is `const`. 38 | - `cowontinue` is `continue`. 39 | - `cock` is `crate`. 40 | - `swow` is `dyn`. 41 | - `yelse` is `else`. 42 | - `enyum` is `enum`. 43 | - `extewn` is `extern`. 44 | - `fawse` is `false`. 45 | - `fuwun` is `fn`. 46 | - `yiff` is `if`. 47 | - `fillme` is `impl`. 48 | - `penetrate` is `in`. 49 | - `wet` is `let`. 50 | - `hecc` is `loop`. 51 | - `sex` is `match`. 52 | - `discowdmodewatow` is `mod`. 53 | - `movemedaddy` is `move`. 54 | - `mutt` is `mut`. 55 | - `pubes` is `pub`. 56 | - `wef` is `ref`. 57 | - `yEET` is `return`. 58 | - `me_irl` is `self`. 59 | - `etewnyaw` is `static`. 60 | - `stwuct` is `struct`. 61 | - `soup` is `super`. 62 | - `twait` is `trait`. 63 | - `twue` is `true`. 64 | - `tippitytap` is `type`. 65 | - `communyism` is `union`. 66 | - `AAAAAAA` is `unsafe`. 67 | - `usemedaddy` is `use`. 68 | - `howl` is `where`. 69 | - `whine` is `while`. 70 | 71 | Fwequentwy Awoo'd Questions 72 | --------------------------- 73 | 74 | 1. Why teh fluff wouwd chu devewop something wike dis uwu? 75 | - Why nyot i was bowed. 76 | 1. Sorry, I don't speak Idiot. 77 | - I don't know why you'd be here then, but if for some reason you still want to use this, this entire README has been commented with the English equivalents in it's source. 78 | 1. Is chu a fuwwy uwu? 79 | - Nyow~ but i thought it wouwd be funny. ~~i do wike catboys though~ don't teww anyone.~~ 80 | 1. Yiff me daddy owo! 81 | - Nyo thanks.