mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-15 01:45:02 +01:00
print and more
This commit is contained in:
parent
ebbc675ffd
commit
9e643b8acd
9 changed files with 150 additions and 54 deletions
|
|
@ -292,6 +292,28 @@ mod r#if {
|
|||
}
|
||||
}
|
||||
|
||||
mod print {
|
||||
use super::prelude::*;
|
||||
|
||||
fn parse_print(tokens: Vec<Token>) -> Stmt {
|
||||
let mut parser = parser(tokens);
|
||||
parser.print_stmt().unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn print_true() {
|
||||
let tokens = [Print, True].map(token).into();
|
||||
let ast = parse_print(tokens);
|
||||
assert_eq!(
|
||||
Stmt::Print(
|
||||
Expr::Literal(Literal::Boolean(true, Span::dummy())),
|
||||
Span::dummy()
|
||||
),
|
||||
ast
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
mod r#while {
|
||||
use super::prelude::*;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue