Source

OCamlRuby / lexer.ml

Full commit
open Util
let lexer =
  let l = Genlex.make_lexer ["`"; "def"; "end"; "if"; "then"; "else"; "class"; "return"; "("; ")"; "."; ","; "+"; "-"; "*"; "/"; "=="; "<="; ">="; "<"; ">"; "="; "&&"; "||"; "@"; "&"; "do"; "{"; "}"; "|"; ":"]
  in
  l $ stream_map (function
    | '\n' -> '`'
    | '\'' -> '"'
    | c -> c)