@@ -29,15 +29,15 @@ type Header struct{ FieldMap }
29
29
30
30
// msgparser contains message parsing vars needed to parse a string into a message.
31
31
type msgParser struct {
32
- msg * Message
32
+ msg * Message
33
33
transportDataDictionary * datadictionary.DataDictionary
34
- appDataDictionary * datadictionary.DataDictionary
35
- rawBytes []byte
36
- fieldIndex int
37
- parsedFieldBytes * TagValue
38
- trailerBytes []byte
39
- foundBody bool
40
- foundTrailer bool
34
+ appDataDictionary * datadictionary.DataDictionary
35
+ rawBytes []byte
36
+ fieldIndex int
37
+ parsedFieldBytes * TagValue
38
+ trailerBytes []byte
39
+ foundBody bool
40
+ foundTrailer bool
41
41
}
42
42
43
43
// in the message header, the first 3 tags in the message header must be 8,9,35.
@@ -169,9 +169,9 @@ func ParseMessageWithDataDictionary(
169
169
) (err error ) {
170
170
// Create msgparser before we go any further.
171
171
mp := & msgParser {
172
- msg : msg ,
172
+ msg : msg ,
173
173
transportDataDictionary : transportDataDictionary ,
174
- appDataDictionary : appDataDictionary ,
174
+ appDataDictionary : appDataDictionary ,
175
175
}
176
176
mp .msg .rawMessage = rawMessage
177
177
mp .rawBytes = rawMessage .Bytes ()
@@ -225,7 +225,6 @@ func doParsing(mp *msgParser) (err error) {
225
225
}
226
226
mp .msg .Header .add (mp .msg .fields [mp .fieldIndex : mp .fieldIndex + 1 ])
227
227
228
-
229
228
// Start parsing.
230
229
mp .fieldIndex ++
231
230
xmlDataLen := 0
@@ -308,7 +307,7 @@ func parseGroup(mp *msgParser, tags []Tag) {
308
307
mp .foundBody = true
309
308
dm := mp .msg .fields [mp .fieldIndex : mp .fieldIndex + 1 ]
310
309
fields := getGroupFields (mp .msg , tags , mp .appDataDictionary )
311
-
310
+
312
311
for {
313
312
mp .fieldIndex ++
314
313
mp .parsedFieldBytes = & mp .msg .fields [mp .fieldIndex ]
@@ -327,7 +326,7 @@ func parseGroup(mp *msgParser, tags []Tag) {
327
326
// Add the field member to the group.
328
327
dm = append (dm , * mp .parsedFieldBytes )
329
328
} else if isHeaderField (mp .parsedFieldBytes .tag , mp .transportDataDictionary ) {
330
- // Found a header tag for some reason..
329
+ // Found a header tag for some reason..
331
330
mp .msg .Body .add (dm )
332
331
mp .msg .Header .add (mp .msg .fields [mp .fieldIndex : mp .fieldIndex + 1 ])
333
332
break
@@ -348,23 +347,23 @@ func parseGroup(mp *msgParser, tags []Tag) {
348
347
dm = mp .msg .fields [mp .fieldIndex : mp .fieldIndex + 1 ]
349
348
fields = getGroupFields (mp .msg , searchTags , mp .appDataDictionary )
350
349
continue
351
- } else {
352
- if len (tags ) > 1 {
353
- searchTags = tags [:len (tags )- 1 ]
354
- }
355
- // Did this tag occur after a nested group and belongs to the parent group.
356
- if isNumInGroupField (mp .msg , searchTags , mp .appDataDictionary ) {
357
- // Add the field member to the group.
358
- dm = append (dm , * mp .parsedFieldBytes )
359
- // Continue parsing the parent group.
360
- fields = getGroupFields (mp .msg , searchTags , mp .appDataDictionary )
361
- continue
362
- }
363
- // Add the repeating group.
364
- mp .msg .Body .add (dm )
365
- // Add the next body field.
366
- mp .msg .Body .add (mp .msg .fields [mp .fieldIndex : mp .fieldIndex + 1 ])
367
350
}
351
+ if len (tags ) > 1 {
352
+ searchTags = tags [:len (tags )- 1 ]
353
+ }
354
+ // Did this tag occur after a nested group and belongs to the parent group.
355
+ if isNumInGroupField (mp .msg , searchTags , mp .appDataDictionary ) {
356
+ // Add the field member to the group.
357
+ dm = append (dm , * mp .parsedFieldBytes )
358
+ // Continue parsing the parent group.
359
+ fields = getGroupFields (mp .msg , searchTags , mp .appDataDictionary )
360
+ continue
361
+ }
362
+ // Add the repeating group.
363
+ mp .msg .Body .add (dm )
364
+ // Add the next body field.
365
+ mp .msg .Body .add (mp .msg .fields [mp .fieldIndex : mp .fieldIndex + 1 ])
366
+
368
367
break
369
368
}
370
369
}
@@ -384,7 +383,7 @@ func isNumInGroupField(msg *Message, tags []Tag, appDataDictionary *datadictiona
384
383
for idx , tag := range tags {
385
384
fd , ok := fields [int (tag )]
386
385
if ok {
387
- if idx == len (tags ) - 1 {
386
+ if idx == len (tags )- 1 {
388
387
if len (fd .Fields ) > 0 {
389
388
return true
390
389
}
@@ -417,7 +416,7 @@ func getGroupFields(msg *Message, tags []Tag, appDataDictionary *datadictionary.
417
416
for idx , tag := range tags {
418
417
fd , ok := fields [int (tag )]
419
418
if ok {
420
- if idx == len (tags ) - 1 {
419
+ if idx == len (tags )- 1 {
421
420
if len (fd .Fields ) > 0 {
422
421
return fd .Fields
423
422
}
@@ -438,7 +437,7 @@ func getGroupFields(msg *Message, tags []Tag, appDataDictionary *datadictionary.
438
437
439
438
// isGroupMember evaluates if this tag belongs to a repeating group.
440
439
func isGroupMember (tag Tag , fields []* datadictionary.FieldDef ) bool {
441
- for _ , f := range fields {
440
+ for _ , f := range fields {
442
441
if f .Tag () == int (tag ) {
443
442
return true
444
443
}
0 commit comments