Tweaks to script parser messages and pathgrid warnings

pull/1907/head
Capostrophic 6 years ago
parent 5a86554f97
commit 95aa05e41b

@ -56,8 +56,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
if (pointList[pathgrid.mEdges[i].mV0].mOtherIndex[j] == pathgrid.mEdges[i].mV1) if (pointList[pathgrid.mEdges[i].mV0].mOtherIndex[j] == pathgrid.mEdges[i].mV1)
{ {
std::ostringstream ss; std::ostringstream ss;
ss << "Duplicate edge between points" ss << "Duplicate edge between points #" << pathgrid.mEdges[i].mV0 << " and #" << pathgrid.mEdges[i].mV1;
<< pathgrid.mEdges[i].mV0 << " and " << pathgrid.mEdges[i].mV1;
messages.add (id, ss.str(), "", CSMDoc::Message::Severity_Error); messages.add (id, ss.str(), "", CSMDoc::Message::Severity_Error);
break; break;
} }
@ -70,7 +69,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
else else
{ {
std::ostringstream ss; std::ostringstream ss;
ss << "An edge is connected to a non-existent point " << pathgrid.mEdges[i].mV0; ss << "An edge is connected to a non-existent point #" << pathgrid.mEdges[i].mV0;
messages.add (id, ss.str(), "", CSMDoc::Message::Severity_Error); messages.add (id, ss.str(), "", CSMDoc::Message::Severity_Error);
} }
} }
@ -93,7 +92,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
if (!foundReverse) if (!foundReverse)
{ {
std::ostringstream ss; std::ostringstream ss;
ss << "Missing edge between points " << i << " and " << pointList[i].mOtherIndex[j]; ss << "Missing edge between points #" << i << " and #" << pointList[i].mOtherIndex[j];
messages.add (id, ss.str(), "", CSMDoc::Message::Severity_Error); messages.add (id, ss.str(), "", CSMDoc::Message::Severity_Error);
} }
} }
@ -110,7 +109,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
if (it == duplList.end()) if (it == duplList.end())
{ {
std::ostringstream ss; std::ostringstream ss;
ss << "Point " << i << " duplicates point " << j ss << "Point #" << i << " duplicates point #" << j
<< " (" << pathgrid.mPoints[i].mX << ", " << pathgrid.mPoints[i].mY << ", " << pathgrid.mPoints[i].mZ << ")"; << " (" << pathgrid.mPoints[i].mX << ", " << pathgrid.mPoints[i].mY << ", " << pathgrid.mPoints[i].mZ << ")";
messages.add (id, ss.str(), "", CSMDoc::Message::Severity_Warning); messages.add (id, ss.str(), "", CSMDoc::Message::Severity_Warning);
@ -127,11 +126,10 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
if (pointList[i].mConnectionNum == 0) if (pointList[i].mConnectionNum == 0)
{ {
std::ostringstream ss; std::ostringstream ss;
ss << "Point " << i << " (" ss << "Point #" << i << " ("
<< pathgrid.mPoints[i].mX << ", " << pathgrid.mPoints[i].mX << ", "
<< pathgrid.mPoints[i].mY << ", " << pathgrid.mPoints[i].mY << ", "
<< pathgrid.mPoints[i].mZ << ") " << pathgrid.mPoints[i].mZ << ") is disconnected from other points";
<< "is disconnected from other points";
messages.add (id, ss.str(), "", CSMDoc::Message::Severity_Warning); messages.add (id, ss.str(), "", CSMDoc::Message::Severity_Warning);
} }
} }

@ -30,7 +30,7 @@ void CSMTools::ScriptCheckStage::report (const std::string& message, const Compi
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Script, mId); CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Script, mId);
stream << "Line " << loc.mLine << ", column " << loc.mColumn << " (" << loc.mLiteral << "): " << message; stream << "line " << loc.mLine << ", column " << loc.mColumn << ": " << message << " (" << loc.mLiteral << ")";
std::ostringstream hintStream; std::ostringstream hintStream;

@ -24,7 +24,7 @@ bool Compiler::DeclarationParser::parseName (const std::string& name, const Toke
if (type!=' ') if (type!=' ')
{ {
/// \todo add option to make re-declared local variables an error /// \todo add option to make re-declared local variables an error
getErrorHandler().warning ("can't re-declare local variable (ignoring declaration)", getErrorHandler().warning ("ignoring local variable re-declaration",
loc); loc);
mState = State_End; mState = State_End;

@ -422,7 +422,7 @@ namespace Compiler
{ {
if (!hasExplicit) if (!hasExplicit)
{ {
getErrorHandler().warning ("stray explicit reference (ignoring it)", loc); getErrorHandler().warning ("ignoring stray explicit reference", loc);
mExplicit.clear(); mExplicit.clear();
} }
@ -791,7 +791,7 @@ namespace Compiler
++optionalCount; ++optionalCount;
} }
else else
getErrorHandler().warning ("Ignoring extra argument", getErrorHandler().warning ("ignoring extra argument",
stringParser.getTokenLoc()); stringParser.getTokenLoc());
} }
else if (*iter=='X') else if (*iter=='X')
@ -805,7 +805,7 @@ namespace Compiler
if (parser.isEmpty()) if (parser.isEmpty())
break; break;
else else
getErrorHandler().warning("Ignoring extra argument", parser.getTokenLoc()); getErrorHandler().warning("ignoring extra argument", parser.getTokenLoc());
} }
else if (*iter=='z') else if (*iter=='z')
{ {
@ -817,7 +817,7 @@ namespace Compiler
if (discardParser.isEmpty()) if (discardParser.isEmpty())
break; break;
else else
getErrorHandler().warning("Ignoring extra argument", discardParser.getTokenLoc()); getErrorHandler().warning("ignoring extra argument", discardParser.getTokenLoc());
} }
else if (*iter=='j') else if (*iter=='j')
{ {

@ -29,7 +29,7 @@ bool Compiler::JunkParser::parseName (const std::string& name, const TokenLoc& l
bool Compiler::JunkParser::parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner) bool Compiler::JunkParser::parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner)
{ {
if (keyword==mIgnoreKeyword) if (keyword==mIgnoreKeyword)
reportWarning ("found junk (ignoring it)", loc); reportWarning ("ignoring found junk", loc);
else else
scanner.putbackKeyword (keyword, loc); scanner.putbackKeyword (keyword, loc);
@ -39,7 +39,7 @@ bool Compiler::JunkParser::parseKeyword (int keyword, const TokenLoc& loc, Scann
bool Compiler::JunkParser::parseSpecial (int code, const TokenLoc& loc, Scanner& scanner) bool Compiler::JunkParser::parseSpecial (int code, const TokenLoc& loc, Scanner& scanner)
{ {
if (code==Scanner::S_member) if (code==Scanner::S_member)
reportWarning ("found junk (ignoring it)", loc); reportWarning ("ignoring found junk", loc);
else else
scanner.putbackSpecial (code, loc); scanner.putbackSpecial (code, loc);

@ -88,7 +88,7 @@ namespace Compiler
{ {
if (mState==PotentialEndState) if (mState==PotentialEndState)
{ {
getErrorHandler().warning ("stray string argument (ignoring it)", loc); getErrorHandler().warning ("ignoring stray string argument", loc);
mState = EndState; mState = EndState;
return true; return true;
} }
@ -233,7 +233,7 @@ namespace Compiler
if (mState==SetPotentialMemberVarState && keyword==Scanner::K_to) if (mState==SetPotentialMemberVarState && keyword==Scanner::K_to)
{ {
getErrorHandler().warning ("unknown variable (ignoring set instruction)", loc); getErrorHandler().warning ("unknown variable, ignoring set instruction", loc);
SkipParser skip (getErrorHandler(), getContext()); SkipParser skip (getErrorHandler(), getContext());
scanner.scan (skip); scanner.scan (skip);
return false; return false;
@ -286,7 +286,7 @@ namespace Compiler
{ {
if (!hasExplicit && mState==ExplicitState) if (!hasExplicit && mState==ExplicitState)
{ {
getErrorHandler().warning ("stray explicit reference (ignoring it)", loc); getErrorHandler().warning ("ignoring stray explicit reference", loc);
mExplicit.clear(); mExplicit.clear();
} }
@ -344,7 +344,7 @@ namespace Compiler
{ {
if (!hasExplicit && !mExplicit.empty()) if (!hasExplicit && !mExplicit.empty())
{ {
getErrorHandler().warning ("stray explicit reference (ignoring it)", loc); getErrorHandler().warning ("ignoring stray explicit reference", loc);
mExplicit.clear(); mExplicit.clear();
} }
@ -360,7 +360,7 @@ namespace Compiler
if (mState==ExplicitState) if (mState==ExplicitState)
{ {
// drop stray explicit reference // drop stray explicit reference
getErrorHandler().warning ("stray explicit reference (ignoring it)", loc); getErrorHandler().warning ("ignoring stray explicit reference", loc);
mState = BeginState; mState = BeginState;
mExplicit.clear(); mExplicit.clear();
} }
@ -412,19 +412,19 @@ namespace Compiler
case Scanner::K_else: case Scanner::K_else:
getErrorHandler().warning ("stray else (ignoring it)", loc); getErrorHandler().warning ("ignoring stray else", loc);
mState = EndState; mState = EndState;
return true; return true;
case Scanner::K_endif: case Scanner::K_endif:
getErrorHandler().warning ("stray endif (ignoring it)", loc); getErrorHandler().warning ("ignoring stray endif", loc);
mState = EndState; mState = EndState;
return true; return true;
case Scanner::K_begin: case Scanner::K_begin:
getErrorHandler().warning ("stray begin (ignoring it)", loc); getErrorHandler().warning ("ignoring stray begin", loc);
mState = EndState; mState = EndState;
return true; return true;
} }
@ -491,7 +491,7 @@ namespace Compiler
{ {
if (mState==EndState && code==Scanner::S_open) if (mState==EndState && code==Scanner::S_open)
{ {
getErrorHandler().warning ("stray '[' or '(' at the end of the line (ignoring it)", getErrorHandler().warning ("ignoring stray '[' or '(' at the end of the line",
loc); loc);
return true; return true;
} }

Loading…
Cancel
Save