Skip to content

Commit

Permalink
BREAK_LOOP and RETURN_EXPR are now compiled
Browse files Browse the repository at this point in the history
  • Loading branch information
Maiori44 committed Feb 27, 2022
1 parent 39bc8e4 commit a0a3fbd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,15 @@ pub fn CompileTokens(scope: usize, ctokens: Vec<ComplexToken>) -> String {
CALL(args) => {
format!("({}){}", CompileExpressions(scope, None, args), IndentateIf(ctokens, scope))
}
RETURN_EXPR(expr) => {
format!("return {};", CompileExpression(scope, None, expr))
}
CONTINUE_LOOP => {
String::from("goto continue;") + &IndentateIf(ctokens, scope)
}
BREAK_LOOP => {
String::from("break;") + &IndentateIf(ctokens, scope)
}
_ => {panic!("Unexpected ComplexToken found")}
}
}
Expand Down

0 comments on commit a0a3fbd

Please sign in to comment.