@@ -29,15 +29,15 @@ type Header struct{ FieldMap }
2929
3030// msgparser contains message parsing vars needed to parse a string into a message. 
3131type  msgParser  struct  {
32- 	msg  * Message 
32+ 	msg                       * Message 
3333	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 
4141}
4242
4343// in the message header, the first 3 tags in the message header must be 8,9,35. 
@@ -169,9 +169,9 @@ func ParseMessageWithDataDictionary(
169169) (err  error ) {
170170	// Create msgparser before we go any further. 
171171	mp  :=  & msgParser {
172- 		msg : msg ,
172+ 		msg :                      msg ,
173173		transportDataDictionary : transportDataDictionary ,
174- 		appDataDictionary : appDataDictionary ,
174+ 		appDataDictionary :        appDataDictionary ,
175175	}
176176	mp .msg .rawMessage  =  rawMessage 
177177	mp .rawBytes  =  rawMessage .Bytes ()
@@ -225,7 +225,6 @@ func doParsing(mp *msgParser) (err error) {
225225	}
226226	mp .msg .Header .add (mp .msg .fields [mp .fieldIndex  : mp .fieldIndex + 1 ])
227227
228- 
229228	// Start parsing. 
230229	mp .fieldIndex ++ 
231230	xmlDataLen  :=  0 
@@ -308,7 +307,7 @@ func parseGroup(mp *msgParser, tags []Tag) {
308307	mp .foundBody  =  true 
309308	dm  :=  mp .msg .fields [mp .fieldIndex  : mp .fieldIndex + 1 ]
310309	fields  :=  getGroupFields (mp .msg , tags , mp .appDataDictionary )
311- 	 
310+ 
312311	for  {
313312		mp .fieldIndex ++ 
314313		mp .parsedFieldBytes  =  & mp .msg .fields [mp .fieldIndex ]
@@ -327,7 +326,7 @@ func parseGroup(mp *msgParser, tags []Tag) {
327326			// Add the field member to the group. 
328327			dm  =  append (dm , * mp .parsedFieldBytes )
329328		} else  if  isHeaderField (mp .parsedFieldBytes .tag , mp .transportDataDictionary ) {
330- 			// Found a header tag for some reason..   
329+ 			// Found a header tag for some reason.. 
331330			mp .msg .Body .add (dm )
332331			mp .msg .Header .add (mp .msg .fields [mp .fieldIndex  : mp .fieldIndex + 1 ])
333332			break 
@@ -348,23 +347,23 @@ func parseGroup(mp *msgParser, tags []Tag) {
348347				dm  =  mp .msg .fields [mp .fieldIndex  : mp .fieldIndex + 1 ]
349348				fields  =  getGroupFields (mp .msg , searchTags , mp .appDataDictionary )
350349				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 ])
367350			}
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+ 
368367			break 
369368		}
370369	}
@@ -384,7 +383,7 @@ func isNumInGroupField(msg *Message, tags []Tag, appDataDictionary *datadictiona
384383			for  idx , tag  :=  range  tags  {
385384				fd , ok  :=  fields [int (tag )]
386385				if  ok  {
387- 					if  idx  ==  len (tags )  -   1  {
386+ 					if  idx  ==  len (tags )- 1  {
388387						if  len (fd .Fields ) >  0  {
389388							return  true 
390389						}
@@ -417,7 +416,7 @@ func getGroupFields(msg *Message, tags []Tag, appDataDictionary *datadictionary.
417416			for  idx , tag  :=  range  tags  {
418417				fd , ok  :=  fields [int (tag )]
419418				if  ok  {
420- 					if  idx  ==  len (tags )  -   1  {
419+ 					if  idx  ==  len (tags )- 1  {
421420						if  len (fd .Fields ) >  0  {
422421							return  fd .Fields 
423422						}
@@ -438,7 +437,7 @@ func getGroupFields(msg *Message, tags []Tag, appDataDictionary *datadictionary.
438437
439438// isGroupMember evaluates if this tag belongs to a repeating group. 
440439func  isGroupMember (tag  Tag , fields  []* datadictionary.FieldDef ) bool  {
441- 	for  _ , f  :=  range  fields {
440+ 	for  _ , f  :=  range  fields   {
442441		if  f .Tag () ==  int (tag ) {
443442			return  true 
444443		}
0 commit comments