From b06572a5ca863d8e84049fc7fa0e1f426afeab46 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 25 Oct 2023 10:01:23 +0200 Subject: [PATCH] remove debugging related code --- flap/src/hopix/hopixLexer.mll | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/flap/src/hopix/hopixLexer.mll b/flap/src/hopix/hopixLexer.mll index f220a5b..32b9bcd 100644 --- a/flap/src/hopix/hopixLexer.mll +++ b/flap/src/hopix/hopixLexer.mll @@ -9,13 +9,8 @@ f lexbuf ;; - let error lexbuf c = - let msg = - "during lexing" - ^ - match c with - | Some c -> Printf.sprintf " at `%c`" c - | None -> "" + let error lexbuf = + let msg = "during lexing" in error msg (lex_join lexbuf.lex_start_p lexbuf.lex_curr_p) ;; @@ -43,7 +38,7 @@ let ascii_code = int_of_string caractere in Char.chr ascii_code with - | _ -> error lexbuf None err_msg)) + | _ -> error lexbuf err_msg)) ;; } @@ -190,21 +185,21 @@ rule token = parse (** Lexing errors *) (* Erreur qui advient quand un code ASCII est trop grand *) - | "'" ascii_trop_grand "'" { error lexbuf None "" } - | _ as _c { error lexbuf None (* (Some _c) *) err_msg } + | "'" ascii_trop_grand "'" { error lexbuf "" } + | _ { error lexbuf err_msg } and commentary nest = parse (* Support nesting *) | close_comment { if nest = 1 then token lexbuf - else commentary (nest - 1) lexbuf } - | open_comment { commentary (nest + 1) lexbuf } + else commentary (nest - 1) lexbuf } + | open_comment { commentary (nest + 1) lexbuf } (** Error *) - | eof { error lexbuf None "unclosed commentary." } + | eof { error lexbuf "unclosed commentary." } (** Commentary content *) - | newline { next_line_and (commentary nest) lexbuf } - | _ { commentary nest lexbuf } + | newline { next_line_and (commentary nest) lexbuf } + | _ { commentary nest lexbuf } and commentary_line = parse | newline { next_line_and token lexbuf } @@ -213,16 +208,16 @@ and commentary_line = parse and read_string buffer = parse (** End of string *) - | '"' { STRING (Buffer.contents buffer) } + | '"' { STRING (Buffer.contents buffer) } (** Escape *) | "\\\"" { Buffer.add_char buffer '\"' - ; read_string buffer lexbuf } + ; read_string buffer lexbuf } (** String characters *) | str_char as s { let c = recup_char s lexbuf in Buffer.add_char buffer c - ; read_string buffer lexbuf } + ; read_string buffer lexbuf } (** Error *) - | eof { error lexbuf None "Unterminated string." } + | eof { error lexbuf "Unterminated string." }