allow (and discard) explicit reference on instructions that do not accept explicit references

This commit is contained in:
Marc Zinnschlag 2014-02-11 14:55:31 +01:00
parent 9de2922d22
commit 697bda6371
3 changed files with 21 additions and 4 deletions

View file

@ -234,8 +234,15 @@ namespace Compiler
{
std::string argumentType;
if (extensions->isInstruction (keyword, argumentType, mState==ExplicitState))
bool hasExplicit = mState==ExplicitState;
if (extensions->isInstruction (keyword, argumentType, hasExplicit))
{
if (!hasExplicit && mState==ExplicitState)
{
getErrorHandler().warning ("stray explicit reference (ignoring it)", loc);
mExplicit.clear();
}
int optionals = mExprParser.parseArguments (argumentType, scanner, mCode, true);
extensions->generateInstructionCode (keyword, mCode, mLiterals, mExplicit, optionals);
@ -271,6 +278,14 @@ namespace Compiler
}
}
if (mState==ExplicitState)
{
// drop stray explicit reference
getErrorHandler().warning ("stray explicit reference (ignoring it)", loc);
mState = BeginState;
mExplicit.clear();
}
if (mState==BeginState)
{
switch (keyword)