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,