gedcom - options.go
1 package gedcom
2
3 type options struct {
4 allowUnknownTags bool
5 allowWrongLength bool
6 allowMissingRequired bool
7 allowMoreThanAllowed bool
8 ignoreInvalidValue bool
9 allowUnknownCharset bool
10 allowTerminatorsInValue bool
11 allowInvalidEscape bool
12 allowInvalidChars bool
13 }
14
15 // Option type for turning off generated errors
16 type Option func(o *options)
17
18 // AllowUnknownTags turns off error reporting when an unknown tag is read
19 func AllowUnknownTags(o *options) {
20 o.allowUnknownTags = true
21 }
22
23 // AllowWrongLength turns off error reporting when a base type has an incorrect
24 // length
25 func AllowWrongLength(o *options) {
26 o.allowWrongLength = true
27 }
28
29 // AllowMissingRequired turns off error reporting for a missing required field
30 func AllowMissingRequired(o *options) {
31 o.allowMissingRequired = true
32 }
33
34 // AllowMoreThanAllowed turns off error reporting when more than the maxumum
35 // number of a certain item are read
36 func AllowMoreThanAllowed(o *options) {
37 o.allowMoreThanAllowed = true
38 }
39
40 // IgnoreInvalidValue turns off error reporting when a non-valid value if read
41 func IgnoreInvalidValue(o *options) {
42 o.ignoreInvalidValue = true
43 }
44
45 // AllowUnknownCharset allows the parser to read any character, not just those
46 // within ANSEL
47 func AllowUnknownCharset(o *options) {
48 o.allowUnknownCharset = true
49 }
50
51 // AllowTerminatorsInValue allows a line_value to contain newlines
52 func AllowTerminatorsInValue(o *options) {
53 o.allowTerminatorsInValue = true
54 }
55
56 // AllowInvalidEscape turns off error reporting for invalid escape sequences
57 func AllowInvalidEscape(o *options) {
58 o.allowInvalidEscape = true
59 }
60
61 // AllowInvalidChars allows control characters (<32) in line_values
62 func AllowInvalidChars(o *options) {
63 o.allowInvalidChars = true
64 }
65