some cleanup

moveref
Marc Zinnschlag 10 years ago
parent bbbf431ae3
commit ac7c2a1473

@ -270,8 +270,9 @@ namespace Compiler
bool Scanner::scanName (char c, Parser& parser, bool& cont) bool Scanner::scanName (char c, Parser& parser, bool& cont)
{ {
std::string name; std::string name;
name += c;
if (!scanName (c, name)) if (!scanName (name))
return false; return false;
TokenLoc loc (mLoc); TokenLoc loc (mLoc);
@ -312,13 +313,11 @@ namespace Compiler
return true; return true;
} }
bool Scanner::scanName (char c, std::string& name) bool Scanner::scanName (std::string& name)
{ {
char c;
bool error = false; bool error = false;
name.clear();
name += c;
while (get (c)) while (get (c))
{ {
if (!name.empty() && name[0]=='"') if (!name.empty() && name[0]=='"')
@ -333,12 +332,14 @@ namespace Compiler
// { // {
// if (!get (c)) // if (!get (c))
// { // {
// error = true;
// mErrorHandler.error ("incomplete escape sequence", mLoc); // mErrorHandler.error ("incomplete escape sequence", mLoc);
// break; // break;
// } // }
// } // }
else if (c=='\n') else if (c=='\n')
{ {
error = true;
mErrorHandler.error ("incomplete string or name", mLoc); mErrorHandler.error ("incomplete string or name", mLoc);
break; break;
} }

@ -89,7 +89,8 @@ namespace Compiler
bool scanName (char c, Parser& parser, bool& cont); bool scanName (char c, Parser& parser, bool& cont);
bool scanName (char c, std::string& name); /// \param name May contain the start of the name (one or more characters)
bool scanName (std::string& name);
bool scanSpecial (char c, Parser& parser, bool& cont); bool scanSpecial (char c, Parser& parser, bool& cont);

Loading…
Cancel
Save