From 5c37830ef42b396b0df44c33c57c1ef9057b197c Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Tue, 6 Apr 2021 23:34:16 +0200 Subject: [PATCH] Replace two checks with slurp_token --- lib/Minilisp.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Minilisp.pm b/lib/Minilisp.pm index d871913..77fb755 100644 --- a/lib/Minilisp.pm +++ b/lib/Minilisp.pm @@ -687,14 +687,12 @@ sub macro_cond { my @cases; while (!peek_token($ts,RPAREN)) { - die "Expected ( before case in cond" - unless (shift @$ts)->{type} == LPAREN; + slurp_token($ts, LPAREN, "Expected ( before case in cond"); my $condition = parser_expr($ts); my $work = parser_expr($ts); - die "Expected ) after case in cond" - unless (shift @$ts)->{type} == RPAREN; + slurp_token($ts, RPAREN, "Expected ) after case in cond"); push @cases, { condition => $condition,