{ open Lexing open Parser exception Syntax_error of string let next_line lexbuf = let pos = lexbuf.lex_curr_p in lexbuf.lex_curr_p <- { pos with pos_bol = lexbuf.lex_curr_pos; pos_lnum = pos.pos_lnum + 1 } } rule token = parse | ';' { SEMICOL } | '!' { EXCLAM } | '+' { PLUS } | '-' { MINUS } | '#' { HASH } | '*' { OMEGA } | '(' { LPAREN } | ')' { RPAREN } (* | '{' { LBRACE } | '}' { RBRACE } *) | ['0'-'9']+ as i { NUMBER (int_of_string i) } | ['A'-'Z'] as c { UPPER c } | ['a'-'z'] as c { LOWER c } | '\r' | '\n' | "\r\n" { next_line lexbuf; token lexbuf } | [' ''\t']+ { token lexbuf } | eof | '\000' { EOF } | _ as chr { raise (Syntax_error ("unexpected '" ^ Char.escaped chr ^ "'")) }