forked from mirror/openmw-tes3mp
ignore conditions after an else (only works if condition is put in parentheses)
This commit is contained in:
parent
e17af4231a
commit
fd665a1994
2 changed files with 14 additions and 4 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include "scanner.hpp"
|
#include "scanner.hpp"
|
||||||
#include "generator.hpp"
|
#include "generator.hpp"
|
||||||
#include "errorhandler.hpp"
|
#include "errorhandler.hpp"
|
||||||
|
#include "skipparser.hpp"
|
||||||
|
|
||||||
namespace Compiler
|
namespace Compiler
|
||||||
{
|
{
|
||||||
|
@ -71,7 +72,7 @@ namespace Compiler
|
||||||
}
|
}
|
||||||
else if (keyword==Scanner::K_else)
|
else if (keyword==Scanner::K_else)
|
||||||
{
|
{
|
||||||
mState = IfElseBodyState; /// \todo should be IfElseEndState; add an option for that
|
mState = IfElseJunkState; /// \todo should be IfElseEndState; add an option for that
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -207,7 +208,8 @@ namespace Compiler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mState==IfBodyState || mState==IfElseifBodyState || mState==IfElseBodyState)
|
else if (mState==IfBodyState || mState==IfElseifBodyState || mState==IfElseBodyState ||
|
||||||
|
mState==IfElseJunkState)
|
||||||
{
|
{
|
||||||
if (parseIfBody (keyword, loc, scanner))
|
if (parseIfBody (keyword, loc, scanner))
|
||||||
return true;
|
return true;
|
||||||
|
@ -230,6 +232,7 @@ namespace Compiler
|
||||||
case IfEndState: mState = IfBodyState; return true;
|
case IfEndState: mState = IfBodyState; return true;
|
||||||
case IfElseifEndState: mState = IfElseifBodyState; return true;
|
case IfElseifEndState: mState = IfElseifBodyState; return true;
|
||||||
case IfElseEndState: mState = IfElseBodyState; return true;
|
case IfElseEndState: mState = IfElseBodyState; return true;
|
||||||
|
case IfElseJunkState: mState = IfElseBodyState; return true;
|
||||||
|
|
||||||
case WhileEndState: mState = WhileBodyState; return true;
|
case WhileEndState: mState = WhileBodyState; return true;
|
||||||
|
|
||||||
|
@ -247,7 +250,13 @@ namespace Compiler
|
||||||
|
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (code==Scanner::S_open && mState==IfElseJunkState)
|
||||||
|
{
|
||||||
|
SkipParser skip (getErrorHandler(), getContext());
|
||||||
|
scanner.scan (skip);
|
||||||
|
mState = IfElseBodyState;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Parser::parseSpecial (code, loc, scanner);
|
return Parser::parseSpecial (code, loc, scanner);
|
||||||
|
|
|
@ -26,7 +26,8 @@ namespace Compiler
|
||||||
IfElseEndState, IfElseBodyState,
|
IfElseEndState, IfElseBodyState,
|
||||||
IfEndifState,
|
IfEndifState,
|
||||||
WhileEndState, WhileBodyState,
|
WhileEndState, WhileBodyState,
|
||||||
WhileEndwhileState
|
WhileEndwhileState,
|
||||||
|
IfElseJunkState
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Interpreter::Type_Code> Codes;
|
typedef std::vector<Interpreter::Type_Code> Codes;
|
||||||
|
|
Loading…
Reference in a new issue