From e4f75267d0475b2f7e2b19c698d9b70e85f58e4e Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 13 Dec 2014 15:40:24 +0100 Subject: [PATCH 1/4] in case of arguments not separated with comma the fist token of the next argument was put back incorrectly --- components/compiler/exprparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/compiler/exprparser.cpp b/components/compiler/exprparser.cpp index 6dcca08df..f7c3d3ecb 100644 --- a/components/compiler/exprparser.cpp +++ b/components/compiler/exprparser.cpp @@ -660,7 +660,7 @@ namespace Compiler else { // no comma was used between arguments - scanner.putbackKeyword (code, loc); + scanner.putbackSpecial (code, loc); return false; } } From ed5387fb8c9e21aa115655e6d874b2461bc4f472 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 13 Dec 2014 15:43:40 +0100 Subject: [PATCH 2/4] replaced stay [ ignoring implementation with one that does not interfere with other workarounds (Fixes #2205) --- components/compiler/lineparser.cpp | 7 +++++++ components/compiler/scanner.cpp | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/compiler/lineparser.cpp b/components/compiler/lineparser.cpp index dc19b9a4b..37641b014 100644 --- a/components/compiler/lineparser.cpp +++ b/components/compiler/lineparser.cpp @@ -489,6 +489,13 @@ namespace Compiler bool LineParser::parseSpecial (int code, const TokenLoc& loc, Scanner& scanner) { + if (mState==EndState && code==Scanner::S_open) + { + getErrorHandler().warning ("stray '[' or '(' at the end of the line (ignoring it)", + loc); + return true; + } + if (code==Scanner::S_newline && (mState==EndState || mState==BeginState || mState==PotentialEndState)) return false; diff --git a/components/compiler/scanner.cpp b/components/compiler/scanner.cpp index 203f27e6e..59fae3ccd 100644 --- a/components/compiler/scanner.cpp +++ b/components/compiler/scanner.cpp @@ -528,8 +528,7 @@ namespace Compiler bool Scanner::isWhitespace (char c) { - return c==' ' || c=='\t' - || c=='['; ///< \todo disable this when doing more strict compiling + return c==' ' || c=='\t'; } // constructor From fc1d42a7d2d9b904092cfec7627c96f54a429022 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 18 Dec 2014 09:55:26 +0100 Subject: [PATCH 3/4] fixed exclusion for certain characters at the start of names --- components/compiler/scanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/compiler/scanner.cpp b/components/compiler/scanner.cpp index 59fae3ccd..9acba861a 100644 --- a/components/compiler/scanner.cpp +++ b/components/compiler/scanner.cpp @@ -314,7 +314,7 @@ namespace Compiler bool Scanner::scanName (char c, std::string& name) { - bool first = false; + bool first = true; bool error = false; name.clear(); From a6d30bc2e3014c77b883de9ceab40d141078f78f Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 18 Dec 2014 10:20:15 +0100 Subject: [PATCH 4/4] consider --script-warn when running with --script-all-dialogue --- apps/openmw/engine.cpp | 2 +- apps/openmw/mwdialogue/scripttest.cpp | 9 +++++---- apps/openmw/mwdialogue/scripttest.hpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 885d2bb4f..6ea09d4c9 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -436,7 +436,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) } if (mCompileAllDialogue) { - std::pair result = MWDialogue::ScriptTest::compileAll(&mExtensions); + std::pair result = MWDialogue::ScriptTest::compileAll(&mExtensions, mWarningsMode); if (result.first) std::cout << "compiled " << result.second << " of " << result.first << " dialogue script/actor combinations a(" diff --git a/apps/openmw/mwdialogue/scripttest.cpp b/apps/openmw/mwdialogue/scripttest.cpp index a8de21ef9..b2c8f536a 100644 --- a/apps/openmw/mwdialogue/scripttest.cpp +++ b/apps/openmw/mwdialogue/scripttest.cpp @@ -21,7 +21,7 @@ namespace { -void test(const MWWorld::Ptr& actor, int &compiled, int &total, const Compiler::Extensions* extensions) +void test(const MWWorld::Ptr& actor, int &compiled, int &total, const Compiler::Extensions* extensions, int warningsMode) { MWDialogue::Filter filter(actor, 0, false); @@ -29,6 +29,7 @@ void test(const MWWorld::Ptr& actor, int &compiled, int &total, const Compiler:: compilerContext.setExtensions(extensions); std::ostream errorStream(std::cout.rdbuf()); Compiler::StreamErrorHandler errorHandler(errorStream); + errorHandler.setWarningsMode (warningsMode); const MWWorld::Store& dialogues = MWBase::Environment::get().getWorld()->getStore().get(); for (MWWorld::Store::iterator it = dialogues.begin(); it != dialogues.end(); ++it) @@ -100,21 +101,21 @@ namespace MWDialogue namespace ScriptTest { - std::pair compileAll(const Compiler::Extensions *extensions) + std::pair compileAll(const Compiler::Extensions *extensions, int warningsMode) { int compiled = 0, total = 0; const MWWorld::Store& npcs = MWBase::Environment::get().getWorld()->getStore().get(); for (MWWorld::Store::iterator it = npcs.begin(); it != npcs.end(); ++it) { MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), it->mId); - test(ref.getPtr(), compiled, total, extensions); + test(ref.getPtr(), compiled, total, extensions, warningsMode); } const MWWorld::Store& creatures = MWBase::Environment::get().getWorld()->getStore().get(); for (MWWorld::Store::iterator it = creatures.begin(); it != creatures.end(); ++it) { MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), it->mId); - test(ref.getPtr(), compiled, total, extensions); + test(ref.getPtr(), compiled, total, extensions, warningsMode); } return std::make_pair(total, compiled); } diff --git a/apps/openmw/mwdialogue/scripttest.hpp b/apps/openmw/mwdialogue/scripttest.hpp index 1ed94c76a..0ac259725 100644 --- a/apps/openmw/mwdialogue/scripttest.hpp +++ b/apps/openmw/mwdialogue/scripttest.hpp @@ -11,7 +11,7 @@ namespace ScriptTest /// Attempt to compile all dialogue scripts, use for verification purposes /// @return A pair containing -std::pair compileAll(const Compiler::Extensions* extensions); +std::pair compileAll(const Compiler::Extensions* extensions, int warningsMode); }