Snippets

orbitzN sedlex tokenizing

Created by orbitzN
let rec token buf =
  let open Token in
  match%sedlex buf with
    | "@@" -> Escaped_at::token buf
    | "@" -> At::token buf
    | Star (Sub (any, "@")) ->
      Printf.printf "length = %d\n" (Sedlexing.lexeme_length buf);
      Printf.printf "array length = %d\n" (Array.length (Sedlexing.lexeme buf));
      String (Sedlexing.Utf8.lexeme buf)::token buf
    | eof -> []
    | _ -> failwith "nyi"

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.