2022-03-08 06:16:27 +00:00
|
|
|
{ open Parser }
|
|
|
|
|
|
|
|
rule f = parse
|
2022-03-08 08:52:20 +00:00
|
|
|
| '\n' { Lexing.new_line lexbuf; f lexbuf }
|
|
|
|
| [' ' '\t'] { f lexbuf }
|
2022-03-08 09:20:19 +00:00
|
|
|
|
|
|
|
| "extern" { KWD_EXTERN }
|
2022-03-08 06:16:27 +00:00
|
|
|
| "fn" { KWD_FN }
|
2022-03-08 08:52:20 +00:00
|
|
|
| "return" { KWD_RETURN }
|
2022-03-08 09:20:19 +00:00
|
|
|
|
2022-03-08 08:52:20 +00:00
|
|
|
| "(" { PUNCT_LPAREN }
|
|
|
|
| ")" { PUNCT_RPAREN }
|
|
|
|
| "->" { PUNCT_RARROW }
|
|
|
|
| ":" { PUNCT_COLON }
|
|
|
|
| ";" { PUNCT_SEMI }
|
2022-03-08 09:20:19 +00:00
|
|
|
| "{" { PUNCT_LBRACE }
|
|
|
|
| "}" { PUNCT_RBRACE }
|
|
|
|
|
2022-03-08 08:52:20 +00:00
|
|
|
| "-" ['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 }
|