mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Skip extra text after variable declaration (bug #4867)
This commit is contained in:
parent
5e12073b47
commit
af47ec7756
@ -37,6 +37,7 @@
|
|||||||
Bug #4828: Potion looping effects VFX are not shown for NPCs
|
Bug #4828: Potion looping effects VFX are not shown for NPCs
|
||||||
Bug #4837: CTD when a mesh with NiLODNode root node with particles is loaded
|
Bug #4837: CTD when a mesh with NiLODNode root node with particles is loaded
|
||||||
Bug #4860: Actors outside of processing range visible for one frame after spawning
|
Bug #4860: Actors outside of processing range visible for one frame after spawning
|
||||||
|
Bug #4867: Arbitrary text after local variable declarations breaks script compilation
|
||||||
Bug #4876: AI ratings handling inconsistencies
|
Bug #4876: AI ratings handling inconsistencies
|
||||||
Bug #4877: Startup script executes only on a new game start
|
Bug #4877: Startup script executes only on a new game start
|
||||||
Bug #4888: Global variable stray explicit reference calls break script compilation
|
Bug #4888: Global variable stray explicit reference calls break script compilation
|
||||||
|
@ -22,20 +22,20 @@ bool Compiler::DeclarationParser::parseName (const std::string& name, const Toke
|
|||||||
char type = mLocals.getType (name2);
|
char type = mLocals.getType (name2);
|
||||||
|
|
||||||
if (type!=' ')
|
if (type!=' ')
|
||||||
{
|
getErrorHandler().warning ("ignoring local variable re-declaration", loc);
|
||||||
/// \todo add option to make re-declared local variables an error
|
else
|
||||||
getErrorHandler().warning ("ignoring local variable re-declaration",
|
mLocals.declare (mType, name2);
|
||||||
loc);
|
|
||||||
|
|
||||||
mState = State_End;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
mLocals.declare (mType, name2);
|
|
||||||
|
|
||||||
mState = State_End;
|
mState = State_End;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (mState==State_End)
|
||||||
|
{
|
||||||
|
getErrorHandler().warning ("Ignoring extra text after local variable declaration", loc);
|
||||||
|
SkipParser skip (getErrorHandler(), getContext());
|
||||||
|
scanner.scan (skip);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return Parser::parseName (name, loc, scanner);
|
return Parser::parseName (name, loc, scanner);
|
||||||
}
|
}
|
||||||
@ -61,17 +61,31 @@ bool Compiler::DeclarationParser::parseKeyword (int keyword, const TokenLoc& loc
|
|||||||
else if (mState==State_Name)
|
else if (mState==State_Name)
|
||||||
{
|
{
|
||||||
// allow keywords to be used as local variable names. MW script compiler, you suck!
|
// allow keywords to be used as local variable names. MW script compiler, you suck!
|
||||||
/// \todo option to disable this atrocity.
|
|
||||||
return parseName (loc.mLiteral, loc, scanner);
|
return parseName (loc.mLiteral, loc, scanner);
|
||||||
}
|
}
|
||||||
|
else if (mState==State_End)
|
||||||
|
{
|
||||||
|
getErrorHandler().warning ("Ignoring extra text after local variable declaration", loc);
|
||||||
|
SkipParser skip (getErrorHandler(), getContext());
|
||||||
|
scanner.scan (skip);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return Parser::parseKeyword (keyword, loc, scanner);
|
return Parser::parseKeyword (keyword, loc, scanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Compiler::DeclarationParser::parseSpecial (int code, const TokenLoc& loc, Scanner& scanner)
|
bool Compiler::DeclarationParser::parseSpecial (int code, const TokenLoc& loc, Scanner& scanner)
|
||||||
{
|
{
|
||||||
if (code==Scanner::S_newline && mState==State_End)
|
if (mState==State_End)
|
||||||
|
{
|
||||||
|
if (code!=Scanner::S_newline)
|
||||||
|
{
|
||||||
|
getErrorHandler().warning ("Ignoring extra text after local variable declaration", loc);
|
||||||
|
SkipParser skip (getErrorHandler(), getContext());
|
||||||
|
scanner.scan (skip);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return Parser::parseSpecial (code, loc, scanner);
|
return Parser::parseSpecial (code, loc, scanner);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user