package nmea

  1. Overview
  2. Docs

Source file parse.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
open Sentence;;

let parse s = 
  try 
    Parser.sentence Lexer.token (Lexing.from_string s)
  with | _ -> raise Invalid_sentence
;;

let parse_opt s = try Some(parse s) with | _ -> None;;

let next ch = parse_opt @@ input_line ch;;

let next_coord ch = 
  match next ch with
  | Some(GGA (s)) -> Some(s.coord)
  | Some(RMC (s)) -> Some(s.coord)
  | _ -> None
;;
OCaml

Innovation. Community. Security.