11import { MINode } from './mi_parse' ;
22
3- const resultRegex = / ^ ( [ a - z A - Z _ \ -] [ a - z A - Z 0 - 9 _ \ -] * | \[ \d + \] ) \s * = \s * / ;
4- const variableRegex = / ^ [ a - z A - Z _ \ -] [ a - z A - Z 0 - 9 _ \ -] * / ;
5- const errorRegex = / ^ \ < .+ ?\ >/ ;
3+ const resultRegex = / ^ ( [ a - z A - Z _ - ] [ a - z A - Z 0 - 9 _ - ] * | \[ \d + \] ) \s * = \s * / ;
4+ const variableRegex = / ^ [ a - z A - Z _ - ] [ a - z A - Z 0 - 9 _ - ] * / ;
5+ const errorRegex = / ^ < .+ ?> / ;
66const referenceStringRegex = / ^ ( 0 x [ 0 - 9 a - f A - F ] + \s * ) " / ;
77const referenceRegex = / ^ 0 x [ 0 - 9 a - f A - F ] + / ;
88const nullpointerRegex = / ^ 0 x 0 + \b / ;
@@ -18,13 +18,13 @@ export function isExpandable(value: string): number {
1818 if ( value [ 0 ] === '{' ) { return 1 ; } // object
1919 if ( value . startsWith ( 'true' ) ) { return 0 ; }
2020 if ( value . startsWith ( 'false' ) ) { return 0 ; }
21- if ( match = nullpointerRegex . exec ( value ) ) { return 0 ; }
22- if ( match = referenceStringRegex . exec ( value ) ) { return 0 ; }
23- if ( match = referenceRegex . exec ( value ) ) { return 2 ; } // reference
24- if ( match = charRegex . exec ( value ) ) { return 0 ; }
25- if ( match = numberRegex . exec ( value ) ) { return 0 ; }
26- if ( match = variableRegex . exec ( value ) ) { return 0 ; }
27- if ( match = errorRegex . exec ( value ) ) { return 0 ; }
21+ if ( ( match = nullpointerRegex . exec ( value ) ) ) { return 0 ; }
22+ if ( ( match = referenceStringRegex . exec ( value ) ) ) { return 0 ; }
23+ if ( ( match = referenceRegex . exec ( value ) ) ) { return 2 ; } // reference
24+ if ( ( match = charRegex . exec ( value ) ) ) { return 0 ; }
25+ if ( ( match = numberRegex . exec ( value ) ) ) { return 0 ; }
26+ if ( ( match = variableRegex . exec ( value ) ) ) { return 0 ; }
27+ if ( ( match = errorRegex . exec ( value ) ) ) { return 0 ; }
2828 return 0 ;
2929}
3030
@@ -86,7 +86,7 @@ export function expandValue(variableCreate: (value: string | object, opts?: { ar
8686 return prefix + namespace ;
8787 } ;
8888
89- function parseTupleOrList ( ) {
89+ function parseTupleOrList ( ) : unknown {
9090 value = value . trim ( ) ;
9191 if ( value [ 0 ] !== '{' ) {
9292 return undefined ;
@@ -101,7 +101,7 @@ export function expandValue(variableCreate: (value: string | object, opts?: { ar
101101 value = value . substr ( 3 ) . trim ( ) ;
102102 if ( value [ 0 ] === '}' ) {
103103 value = value . substr ( 1 ) . trim ( ) ;
104- return '<...>' as any ;
104+ return '<...>' ;
105105 }
106106 }
107107 const eqPos = value . indexOf ( '=' ) ;
@@ -136,7 +136,7 @@ export function expandValue(variableCreate: (value: string | object, opts?: { ar
136136 if ( result ) {
137137 const results = [ ] ;
138138 results . push ( result ) ;
139- while ( result = parseCommaResult ( true ) ) {
139+ while ( ( result = parseCommaResult ( true ) ) ) {
140140 results . push ( result ) ;
141141 }
142142 value = value . substr ( 1 ) . trim ( ) ; // }
@@ -146,7 +146,7 @@ export function expandValue(variableCreate: (value: string | object, opts?: { ar
146146 return undefined ;
147147 } ;
148148
149- function parsePrimitive ( ) {
149+ function parsePrimitive ( ) : unknown {
150150 let primitive : any ;
151151 let match ;
152152 value = value . trim ( ) ;
@@ -158,26 +158,26 @@ export function expandValue(variableCreate: (value: string | object, opts?: { ar
158158 } else if ( value . startsWith ( 'false' ) ) {
159159 primitive = 'false' ;
160160 value = value . substr ( 5 ) . trim ( ) ;
161- } else if ( match = nullpointerRegex . exec ( value ) ) {
161+ } else if ( ( match = nullpointerRegex . exec ( value ) ) ) {
162162 primitive = '<nullptr>' ;
163163 value = value . substr ( match [ 0 ] . length ) . trim ( ) ;
164- } else if ( match = referenceStringRegex . exec ( value ) ) {
164+ } else if ( ( match = referenceStringRegex . exec ( value ) ) ) {
165165 value = value . substr ( match [ 1 ] . length ) . trim ( ) ;
166166 primitive = parseCString ( ) ;
167- } else if ( match = referenceRegex . exec ( value ) ) {
167+ } else if ( ( match = referenceRegex . exec ( value ) ) ) {
168168 primitive = '*' + match [ 0 ] ;
169169 value = value . substr ( match [ 0 ] . length ) . trim ( ) ;
170- } else if ( match = charRegex . exec ( value ) ) {
170+ } else if ( ( match = charRegex . exec ( value ) ) ) {
171171 primitive = match [ 1 ] ;
172172 value = value . substr ( match [ 0 ] . length - 1 ) ;
173173 primitive += ' ' + parseCString ( ) ;
174- } else if ( match = numberRegex . exec ( value ) ) {
174+ } else if ( ( match = numberRegex . exec ( value ) ) ) {
175175 primitive = match [ 0 ] ;
176176 value = value . substr ( match [ 0 ] . length ) . trim ( ) ;
177- } else if ( match = variableRegex . exec ( value ) ) {
177+ } else if ( ( match = variableRegex . exec ( value ) ) ) {
178178 primitive = match [ 0 ] ;
179179 value = value . substr ( match [ 0 ] . length ) . trim ( ) ;
180- } else if ( match = errorRegex . exec ( value ) ) {
180+ } else if ( ( match = errorRegex . exec ( value ) ) ) {
181181 primitive = match [ 0 ] ;
182182 value = value . substr ( match [ 0 ] . length ) . trim ( ) ;
183183 } else {
0 commit comments