1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-05 23:28:14 +02:00

Interactive mode for ERM interpreter.

This commit is contained in:
Michał W. Urbańczyk
2011-06-23 21:42:30 +00:00
parent 3f85ca4504
commit d88b6b1bb3
5 changed files with 40 additions and 5 deletions

View File

@@ -479,6 +479,19 @@ namespace ERM
};
ERM::TLine ERMParser::parseLine( const std::string & line, int realLineNo )
{
try
{
return parseLine(line);
}
catch(...)
{
tlog1 << "\tParse error occurred in file " << srcFile << " (line " << realLineNo << ") :\n" << line << std::endl;
throw;
}
}
ERM::TLine ERMParser::parseLine(const std::string & line)
{
std::string::const_iterator beg = line.begin(),
end = line.end();
@@ -489,8 +502,7 @@ ERM::TLine ERMParser::parseLine( const std::string & line, int realLineNo )
bool r = qi::phrase_parse(beg, end, ERMgrammar, ascii::space, AST);
if(!r || beg != end)
{
tlog1 << "Parse error in file " << srcFile << " (line " << realLineNo << ") :\n" << line << std::endl;
tlog1 << "\tCannot parse: " << std::string(beg, end) << std::endl;
tlog1 << "Parse error: cannot parse: " << std::string(beg, end) << std::endl;
throw ParseErrorException();
}
return AST;