-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathS5.fs
35 lines (27 loc) · 838 Bytes
/
S5.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module BrandX.S5
open System
open System.Collections.Generic
open System.IO
open FParsec
open BrandX.Structures
type StopSeqNo =
| StopSeqNo of uint16
let pStopSeqNo : Parser<StopSeqNo> = manyMinMaxSatisfy 1 3 isDigit |>> (fun c -> UInt16.Parse(c) |> StopSeqNo) .>> pFSep
type StopReason =
| Complete
| CompleteUnload
| PartLoad
| PartUnload
let pStopReason : Parser<StopReason> =
((skipString "CL" >>? preturn Complete)
<|> (skipString "CU" >>? preturn CompleteUnload)
<|> (skipString "PL" >>? preturn PartLoad)
<|> (skipString "PU" >>? preturn PartUnload)) .>> pRSep
type S5 =
| S5 of StopSeqNo * StopReason
let pS5 : Parser<S5> =
skipString "S5" .>> pFSep >>. pStopSeqNo
>>= fun x ->
pStopReason
>>= fun y ->
preturn (S5(x, y))