Bug: pre-processor ranges which should be empty are not
Posted: Thu Apr 29, 2010 4:21 pm
The range 2:1 should be empty. Instead, the pre-processor treats it as equal to the range 1:2. This is a real problem for nested for loops, as in the snippet below.
Pre-processor input:
Pre-processor output:
Pre-processor input:
- Code: Select all
shocks;
@#for index in 0:subdivisions
var scripte@{index} = 1;
@#for index2 in ( index + 1 ):subdivisions
var scripte@{index}, scripte@{index2} = exp( -varrho * abs( @{index} - @{index2} ) / @{subdivisions} );
@#endfor
@#endfor
end;
Pre-processor output:
- Code: Select all
shocks;
@#line "dseg1.mod" 221
var scripte0 = 1;
@#line "dseg1.mod" 224
var scripte0, scripte1 = exp( -varrho * abs( 0 - 1 ) / 2 );
@#line "dseg1.mod" 224
var scripte0, scripte2 = exp( -varrho * abs( 0 - 2 ) / 2 );
@#line "dseg1.mod" 226
@#line "dseg1.mod" 221
var scripte1 = 1;
@#line "dseg1.mod" 224
var scripte1, scripte2 = exp( -varrho * abs( 1 - 2 ) / 2 );
@#line "dseg1.mod" 226
@#line "dseg1.mod" 221
var scripte2 = 1;
@#line "dseg1.mod" 224
var scripte2, scripte2 = exp( -varrho * abs( 2 - 2 ) / 2 );
@#line "dseg1.mod" 224
var scripte2, scripte3 = exp( -varrho * abs( 2 - 3 ) / 2 );
@#line "dseg1.mod" 226
@#line "dseg1.mod" 227
end;