18 lines
465 B
OCaml
18 lines
465 B
OCaml
{ open Parser }
|
|
|
|
rule f = parse
|
|
| '\n' { Lexing.new_line lexbuf; f lexbuf }
|
|
| [' ' '\t'] { f lexbuf }
|
|
| "fn" { KWD_FN }
|
|
| "return" { KWD_RETURN }
|
|
| "(" { PUNCT_LPAREN }
|
|
| ")" { PUNCT_RPAREN }
|
|
| "->" { PUNCT_RARROW }
|
|
| "{" { PUNCT_LBRACE }
|
|
| "}" { PUNCT_RBRACE }
|
|
| ":" { PUNCT_COLON }
|
|
| ";" { PUNCT_SEMI }
|
|
| "-" ['0'-'9']+ as i { LIT_NEG_INT (- (int_of_string i)) }
|
|
| ['0'-'9']+ as i { LIT_INT (int_of_string i) }
|
|
| ['a'-'z' 'A'-'Z']* as i { IDENT i }
|
|
| eof { EOF }
|