diff --git a/src/ast.rs b/src/ast.rs index 95df4728..16b7c861 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -75,6 +75,7 @@ pub enum StmtKind { Print(Expr), Melo(Iden), Rlyeh, + Rickroll, } impl Stmt { diff --git a/src/interpret.rs b/src/interpret.rs index eb6bb2e4..f47b33ad 100644 --- a/src/interpret.rs +++ b/src/interpret.rs @@ -305,6 +305,9 @@ impl ExecEnv { // here at some point. ~~Alex exit(random()); } + StmtKind::Rickroll => { + stdout().write_all(include_str!("rickroll").as_bytes()).expect("Failed to write to stdout") + } } Ok(HaltStatus::Finished) diff --git a/src/lexer.rs b/src/lexer.rs index 143aa6f3..3f686c07 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -111,6 +111,9 @@ pub enum Token { #[token("rlyeh")] Rlyeh, + #[token("rickroll")] + Rickroll, + // Literals /// True, False #[regex("true|false", get_bool)] diff --git a/src/parser.rs b/src/parser.rs index f7b7b9b1..59f10120 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -78,6 +78,10 @@ impl<'source> Parser<'source> { self.semi_terminated(StmtKind::Rlyeh)?, start..self.lexer.span().end, )), + Token::Rickroll => Ok(Stmt::new( + self.semi_terminated(StmtKind::Rickroll)?, + start..self.lexer.span().end + )), Token::Identifier(_) | Token::Char diff --git a/src/rickroll b/src/rickroll new file mode 100644 index 00000000..447419bd --- /dev/null +++ b/src/rickroll @@ -0,0 +1,67 @@ +b"We're no strangers to love +You know the rules and so do I +A full commitments what I'm thinking of +You wouldn't get this from another guy + +I just wanna tell you how I'm feeling +Gotta make you understand + +Never gonna give you up +Never gonna let you down +Never gonna run around and desert you +Never gonna make you cry +Never gonna say goodbye +Never gonna tell a lie and hurt you + +We've known each other for so long +Your heart's been aching but you're too shy to say it +Inside we both know what's been going on +We know the game and we're gonna play it + +And if you ask me how I'm feeling +Don't tell me you're too blind to see + +Never gonna give you up +Never gonna let you down +Never gonna run around and desert you +Never gonna make you cry +Never gonna say goodbye +Never gonna tell a lie and hurt you + +Never gonna give you up +Never gonna let you down +Never gonna run around and desert you +Never gonna make you cry +Never gonna say goodbye +Never gonna tell a lie and hurt you + +Never gonna give, never gonna give +(Give you up) + +We've known each other for so long +Your heart's been aching but you're too shy to say it +Inside we both know what's been going on +We know the game and we're gonna play it + +I just wanna tell you how I'm feeling +Gotta make you understand + +Never gonna give you up +Never gonna let you down +Never gonna run around and desert you +Never gonna make you cry +Never gonna say goodbye +Never gonna tell a lie and hurt you + +Never gonna give you up +Never gonna let you down +Never gonna run around and desert you +Never gonna make you cry +Never gonna say goodbye +Never gonna tell a lie and hurt you + +Never gonna give you up +Never gonna let you down +Never gonna run around and desert you +Never gonna make you cry +Never gonna say goodbye"