Skip to content

Commit

Permalink
Issue #3 bug fix localisation
Browse files Browse the repository at this point in the history
  • Loading branch information
epatrizio committed Sep 9, 2022
1 parent 6ec388d commit b0efd9d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

exception Lexing_error of string
let error message = raise (Lexing_error message)

let newline lexbuf =
let pos = lexbuf.lex_curr_p in
lexbuf.lex_curr_p <- {
pos with pos_lnum = pos.pos_lnum + 1; pos_bol = pos.pos_cnum; pos_cnum = 0
}
}

let letter = ['a'-'z' 'A'-'Z']
Expand Down Expand Up @@ -65,12 +71,12 @@ rule token = parse
| unit { CST Cunit }
| ident as s { IDENT(s) }
| spaces { token lexbuf }
| newline { token lexbuf }
| newline { newline lexbuf; token lexbuf }
| eof { EOF }
| _ as lxm { error ("unexpected character: " ^ (Char.escaped lxm)) }

and comment = parse
| "*)" { token lexbuf }
| newline { comment lexbuf }
| newline { newline lexbuf; comment lexbuf }
| _ { comment lexbuf }
| eof { error "unterminated comment" }

0 comments on commit b0efd9d

Please sign in to comment.