diff --git a/lib/Minilisp.pm b/lib/Minilisp.pm index 63db6a6..463daa3 100644 --- a/lib/Minilisp.pm +++ b/lib/Minilisp.pm @@ -47,7 +47,7 @@ sub tokenize { while ($str) { - if ($str =~ s/^;.*\n//) + if ($str =~ s/^;.*(\n|$)//) { $debug->("Comment"); # Comment. do nothing diff --git a/t/comments.t b/t/comments.t index 77061f9..804cc3b 100644 --- a/t/comments.t +++ b/t/comments.t @@ -1,2 +1,6 @@ ;; This is a comment (expect "Comment does not influence code" t) +;; Another comment +(expect "Comment does not influence code pt.2" t) ;; Even after another expression +(expect "Comment does not influence code pt.3" t) +;; Last comment