File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,15 +18,31 @@ define(
1818 return parseFloat ( beginStr . substr ( "FIX." . length ) ) ;
1919 } ;
2020
21+ var splitFields = function ( str ) {
22+ var result = str . match ( / [ ^ 0 - 9 a - z A - Z : \s ] * 8 = F I X (?: [ ^ = ] { 0 , 20 } ?) \D 9 = \d + (?< delim > .* ?\D ) 3 5 = / ) ;
23+ if ( result !== null ) {
24+ return str . split ( result . groups . delim ) ;
25+ } else
26+ {
27+ return str . split ( / \| | ; | \x00 1 | \[ S O H \] | < S O H > | \^ A / ) ;
28+ }
29+ } ;
30+
2131 FixParser . prototype . parse = function ( str )
2232 {
2333 // Create a sequence of fields
24- var regex = / ( [ 0 - 9 ] + ) = ( [ ^ | ; \0 0 1 ] * ) / g ,
34+ var regex = / ( [ 0 - 9 ] + ) = ( . * ) / ,
2535 fields = [ ] , result ;
2636
2737 var fixVersion = 'unknown' ;
2838
29- while ( result = regex . exec ( str ) ) {
39+ var splits = splitFields ( str ) ;
40+ for ( var i = 0 ; i < splits . length ; ++ i ) {
41+ // cut the fields by separators before extracting field id and value
42+ result = splits [ i ] . match ( regex ) ;
43+ if ( ! result )
44+ continue ;
45+
3046 var fieldId = parseInt ( result [ 1 ] ) ,
3147 value = result [ 2 ] ,
3248 field = data . fieldById [ fieldId ] ,
You can’t perform that action at this time.
0 commit comments