-
Notifications
You must be signed in to change notification settings - Fork 1
/
L11.fs
63 lines (42 loc) · 1.3 KB
/
L11.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
module BrandX.L11
open System
open System.Collections.Generic
open System.IO
open BrandX.Structures
open FParsec
type RefId =
| RefId of string
let pRefId : Parser<RefId> = manyMinMaxSatisfy 1 30 (isNoneOf "*~**:***") |>> RefId .>> pFSep
type RefQual =
| RefQual of string
let pRefQual : Parser<RefQual> = manyMinMaxSatisfy 2 3 (isNoneOf "*~**:***") |>> RefQual .>> pFSep
type BusInstruct =
{ referenceId : RefId
referenceQual : RefQual}
let pBus =
pipe2 pRefId pRefQual (fun i q -> {referenceId = i; referenceQual = q})
type Description =
| Description of string
let pDesc : Parser<Description> = manyMinMaxSatisfy 1 80 (isNoneOf "*~**:***") |>> Description .>> pRSep
type L11 =
| L11 of BusInstruct * Description
let pL11Record =
pBus
>>= fun x ->
pDesc
>>= fun y ->
preturn (L11(x, y))
let pL11 =
skipString "L11" >>. pFSep >>. pL11Record
(*
type L11Short =
| L11Short of string
let pL11Short : Parser<L11Short> = anyString 3 |>> L11Short .>> pFSep
type State =
| State of string
let pState : Parser<State> = anyString 2 |>> State .>> pRSep
type L11Shorty =
| L11Shorty of L11Short * State
let pPartialL11 :Parser<L11Shorty> =
skipString "L11" >>. pFSep >>. tuple2 pL11Short pState |>> L11Shorty
*)