From 4711135e7f6ced616e0e6166337771cb6f6da9fc Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 18 Mar 2013 12:05:54 +0100 Subject: [PATCH] workaround for faulty endif in Morrowind scripts --- components/compiler/scriptparser.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/compiler/scriptparser.cpp b/components/compiler/scriptparser.cpp index ac0ee63f1..5b3d244b0 100644 --- a/components/compiler/scriptparser.cpp +++ b/components/compiler/scriptparser.cpp @@ -2,6 +2,8 @@ #include "scriptparser.hpp" #include "scanner.hpp" +#include "skipparser.hpp" +#include "errorhandler.hpp" namespace Compiler { @@ -41,6 +43,17 @@ namespace Compiler return true; } + /// \todo add an option to disable this nonsense + if (keyword==Scanner::K_endif) + { + // surplus endif + getErrorHandler().warning ("endif without matching if/elseif", loc); + + SkipParser skip (getErrorHandler(), getContext()); + scanner.scan (skip); + return true; + } + if (keyword==Scanner::K_end && mEnd) { return false;