LSL-PyOptimizer/lslopt
Sei Lisa ef6ed30536 Fix EParseCantChangeState so that it is always properly reported.
Still somewhat messy, but still reported as soon as it can be detected.

If an ELSE token is detected at the top level, for example, the error position will be rewound to the state change and reported there.

This means that in this situation:

x()
{
    if (1)
    {
        state default;
        x(2);
    }
    else ;
}
default{timer(){}}

an error will be reported in x(2), because the ELSE hasn't been found at that point, therefore the state change statement isn't found to be at fault yet.

However, in this case:

x()
{
    if (1)
        state default;
    else
        x(2);
}
default{timer(){}}

the error WILL be reported at the state change statement.

This commit also changes the position where the exception is reported, to be at the STATE token. As an inconsequential side effect, EParseCantChangeState takes precedence over undefined identifiers, in case the state change is to an undefined state, but only in cases where it can be immediately detected.
2017-11-02 13:45:01 +01:00
..
__init__.py Initial commit. Status so far: 2014-07-26 02:43:44 +02:00
lslbasefuncs.py Fix compare and llListSort for LSO. 2017-10-21 12:32:41 +02:00
lslcommon.py Internal code reorganization. 2017-10-20 18:19:48 +02:00
lsldeadcode.py Remove "magic names" where possible, using new data from fndata.txt 2017-10-27 23:39:26 +02:00
lslextrafuncs.py Remove "magic names" where possible, using new data from fndata.txt 2017-10-27 23:39:26 +02:00
lslfoldconst.py Optimize 'if' statements better. 2017-10-30 19:23:01 +01:00
lslfuncopt.py Comment fix. 2017-10-20 10:18:44 +02:00
lslfuncs.py Bump copyright year. 2017-08-09 19:45:46 +02:00
lsljson.py Change strategy for the checking of function input types. 2017-10-12 17:16:16 +02:00
lsllastpass.py Minor cleanups; no functional changes. 2017-09-22 15:42:42 +02:00
lslloadlib.py Implement flags aimed at removing "magic names" in the code. 2017-10-27 18:49:58 +02:00
lsloptimizer.py Remove "magic names" where possible, using new data from fndata.txt 2017-10-27 23:39:26 +02:00
lsloutput.py Add a space between a minus sign and a negative constant. 2017-10-27 21:02:00 +02:00
lslparse.py Fix EParseCantChangeState so that it is always properly reported. 2017-11-02 13:45:01 +01:00
lslrenamer.py Reuse state names for function parameters; restart UsedNames. 2017-10-28 23:39:25 +02:00