handle junk in argument lists (Fixes #2206)

This commit is contained in:
Marc Zinnschlag 2014-12-17 15:03:05 +01:00
parent 5cb94da9c5
commit b951251572
8 changed files with 106 additions and 6 deletions

View file

@ -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();