1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

patch from KroArtem

This commit is contained in:
Ivan Savenko
2013-11-03 12:51:25 +00:00
parent c4716d0a9a
commit 0e3eae3095
15 changed files with 42 additions and 84 deletions

View File

@@ -488,34 +488,6 @@ ERM::TLine ERMParser::parseLine(const std::string & line)
return AST;
}
ERMParser::ELineType ERMParser::classifyLine( const std::string & line, bool inString ) const
{
ERMParser::ELineType ret;
if(line[0] == '!')
{
if(countHatsBeforeSemicolon(line) % 2 == 1)
ret = ERMParser::UNFINISHED;
else
ret = ERMParser::COMMAND_FULL;
}
else
{
if(inString)
{
if(countHatsBeforeSemicolon(line) % 2 == 1)
ret = ERMParser::END_OF;
else
ret = ERMParser::UNFINISHED;
}
else
{
ret = ERMParser::COMMENT;
}
}
return ret;
}
int ERMParser::countHatsBeforeSemicolon( const std::string & line ) const
{
//CHECK: omit macros? or anything else?
@@ -543,4 +515,4 @@ void ERMParser::repairEncoding( char * str, int len ) const
for(int g=0; g<len; ++g)
if(str[g] & 0x80)
str[g] = '|';
}
}

View File

@@ -268,7 +268,6 @@ private:
void repairEncoding(std::string & str) const; //removes nonstandard ascii characters from string
enum ELineType{COMMAND_FULL, COMMENT, UNFINISHED, END_OF};
int countHatsBeforeSemicolon(const std::string & line) const;
ELineType classifyLine(const std::string & line, bool inString) const;
ERM::TLine parseLine(const std::string & line, int realLineNo);