[sldev] Verified the lexxing bug in indra.l

Argent Stonecutter secret.argent at gmail.com
Tue Jan 23 14:17:39 PST 2007


This script parses successfuly in LSL and produces an obviously  
incorrect result.

default
{
     state_entry()
     {
         llSay(0, (string)(3.-4));
     }
}

[14:09]  Object: 3.000000

This is what I suggested would happen in my previous article with the  
constant folding patched for indra.l and indra.y.

What's happening is that floating point numbers match an expression  
that begins with {D}+"."{D}*, and {D} expands to [-]?[0-9], which -4  
matches...

This could be fixed in indra.l, but really folding '-' FP_CONSTANT  
into FP_CONSTANT should be done in indra.y, because it keeps "a-1"  
from matching this rule:

expression : expression '-' expression ;

Since "a-1" lexes to IDENTIFIER INTEGER_CONSTANT, not IDENTIFIER '-'  
INTEGER_CONSTANT.

See my previous post for the patch.


More information about the SLDev mailing list