mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
handle junk in argument lists (Fixes #2206)
This commit is contained in:
parent
5cb94da9c5
commit
b951251572
8 changed files with 106 additions and 6 deletions
|
@ -17,6 +17,7 @@
|
|||
#include "extensions.hpp"
|
||||
#include "context.hpp"
|
||||
#include "discardparser.hpp"
|
||||
#include "junkparser.hpp"
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
|
@ -752,7 +753,7 @@ namespace Compiler
|
|||
}
|
||||
|
||||
int ExprParser::parseArguments (const std::string& arguments, Scanner& scanner,
|
||||
std::vector<Interpreter::Type_Code>& code)
|
||||
std::vector<Interpreter::Type_Code>& code, int ignoreKeyword)
|
||||
{
|
||||
bool optional = false;
|
||||
int optionalCount = 0;
|
||||
|
@ -760,6 +761,7 @@ namespace Compiler
|
|||
ExprParser parser (getErrorHandler(), getContext(), mLocals, mLiterals, true);
|
||||
StringParser stringParser (getErrorHandler(), getContext(), mLiterals);
|
||||
DiscardParser discardParser (getErrorHandler(), getContext());
|
||||
JunkParser junkParser (getErrorHandler(), getContext(), ignoreKeyword);
|
||||
|
||||
std::stack<std::vector<Interpreter::Type_Code> > stack;
|
||||
|
||||
|
@ -815,6 +817,13 @@ namespace Compiler
|
|||
if (discardParser.isEmpty())
|
||||
break;
|
||||
}
|
||||
else if (*iter=='j')
|
||||
{
|
||||
/// \todo disable this when operating in strict mode
|
||||
junkParser.reset();
|
||||
|
||||
scanner.scan (junkParser);
|
||||
}
|
||||
else
|
||||
{
|
||||
parser.reset();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue