From ab6e8c466be15e49d4df7267097e06de57d3404b Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 8 Dec 2022 21:29:42 +0100 Subject: [PATCH] add comments support --- lexer.mll | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lexer.mll b/lexer.mll index 75cbd53..1109e00 100644 --- a/lexer.mll +++ b/lexer.mll @@ -18,4 +18,10 @@ rule token = parse | '=' { Lassign } | ';' { Lsc } | ident as i { Lvar i } +| '#' { comment lexbuf } | _ as c { raise (Error c) } + +and comment = parse +| eof { Lend } +| '\n' { Lexing.new_line lexbuf; token lexbuf } +| _ { comment lexbuf }