mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-11 13:38:43 -05:00
- continue Drup checker - create sidekick-bin.lib to share parsers - parse problem+proof for sidekick-check
20 lines
692 B
OCaml
20 lines
692 B
OCaml
|
|
{
|
|
type token = EOF | ZERO | LIT of int | D
|
|
}
|
|
|
|
let number = ['1' - '9'] ['0' - '9']*
|
|
|
|
rule token = parse
|
|
| eof { EOF }
|
|
| "c" { comment lexbuf }
|
|
| [' ' '\t' '\r'] { token lexbuf }
|
|
| "d" { D }
|
|
| '\n' { Lexing.new_line lexbuf; token lexbuf }
|
|
| '0' { ZERO }
|
|
| '-'? number { LIT (int_of_string (Lexing.lexeme lexbuf)) }
|
|
| _ { Error.errorf "dimacs.lexer: unexpected char `%s`" (Lexing.lexeme lexbuf) }
|
|
|
|
and comment = parse
|
|
| '\n' { Lexing.new_line lexbuf; token lexbuf }
|
|
| [^'\n'] { comment lexbuf }
|