JoeStrout / miniscript

source code of both C# and C++ implementations of the MiniScript scripting language
MIT License
282 stars 64 forks source link

compiler error: 'else' skips expected 'break' #2

Closed JoeStrout closed 5 years ago

JoeStrout commented 5 years ago

There seems to be a parsing issue when break appears inside an if block before an else or else if section. The compiler reports Compiler Error: 'else' skips expected 'break', which doesn't make much sense. Sample code (tested both in Try-It! and in command-line MiniScript):

for x in range(1,10)
    if x > 5 then
        print "A"
        break
    else
        print "B"
    end if
end for
print "Done"
JoeStrout commented 5 years ago

Also occurs in the C# version (tested with classic Unity demo).

JoeStrout commented 5 years ago

Fixed.

JoeStrout commented 4 years ago

Vitalis11 wrote:

Still meet this error in Greyhack game...

Then you should ask the Greyhack developer to update his copy of MiniScript.

Best,