From 31bab456b0bf066576eafaf9b98b4e8c1d4bdb40 Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Fri, 2 Apr 2021 16:05:22 +0200 Subject: [PATCH] Add support for comments --- lib/Minilisp.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Minilisp.pm b/lib/Minilisp.pm index dbd3b3c..50515b8 100644 --- a/lib/Minilisp.pm +++ b/lib/Minilisp.pm @@ -21,7 +21,11 @@ sub tokenize { while ($str) { - if ($str =~ s/^\(//) + if ($str =~ s/^;.*\n//) + { + # Comment. do nothing + } + elsif ($str =~ s/^\(//) { push @tokens, { type => LPAREN }; }