-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCombatlogToken.fs
47 lines (38 loc) · 1.15 KB
/
CombatlogToken.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
namespace WowLogScan
module CombatlogToken =
open System
open CombatlogType
type CLDate = CLDate of string
// A parsed item in combat log line: string, number or a structure
type CLToken =
| Time of DateTime
| EventName of string
| String of string
| UnitId of string
| Player of string
| Version of string // version string 1.13.2
| Int64 of int64
| Float of float
| Nil
| List of CLToken list
| Environmental of EnvDamageType
type CLEvent =
{ Time: DateTime
Name: string
Args: CLToken [] }
let extractString (t: CLToken): string =
match t with
| CLToken.String s -> s
| _ -> failwithf "String token expected, instead got %A" t
let extractInt (t: CLToken): int64 =
match t with
| CLToken.Int64 i -> i
| _ -> failwithf "Int64 token expected, instead got %A" t
let extractFloat (t: CLToken): float =
match t with
| CLToken.Float f -> f
| _ -> failwithf "Float token expected, instead got %A" t
let extractList (t: CLToken): CLToken list =
match t with
| CLToken.List t -> t
| _ -> failwithf "CLToken.List token expected, instead got %A" t