Browse Source

get rid of lexer debugging

main
zseri 2 years ago
parent
commit
0027d9cf2c
1 changed files with 9 additions and 21 deletions
  1. +9
    -21
      lex.ml

+ 9
- 21
lex.ml View File

@ -8,25 +8,13 @@ let lexeme = Sedlexing.Utf8.lexeme
exception SyntaxError of string
let rec token_inner buf =
let rec token buf =
match%sedlex buf with
| eof -> Parser.EOF
| nls -> Parser.NL
| "table" -> Parser.TABLE
| "relat" -> Parser.RELAT
| ":" -> Parser.DCOLON
| white_space -> token_inner buf
| ident -> Parser.ID (lexeme buf)
| _ -> raise (SyntaxError ("Unexpected char: " ^ lexeme buf))
let token buf =
let r = token_inner buf in
let tst = match r with
| Parser.EOF -> "."
| Parser.NL -> "\\n"
| Parser.TABLE -> "table"
| Parser.RELAT -> "relat"
| Parser.DCOLON -> ":"
| Parser.ID x -> Printf.sprintf "id(%s)" x
in
Printf.printf "got token %s\n" tst; r
| eof -> Parser.EOF
| nls -> Parser.NL
| "table" -> Parser.TABLE
| "relat" -> Parser.RELAT
| ":" -> Parser.DCOLON
| white_space -> token buf
| ident -> Parser.ID (lexeme buf)
| _ -> raise (SyntaxError ("Unexpected char: " ^ lexeme buf))