From d9677cb33e8e7c6dc13a43a82ae3b2fcc81a61c4 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 18 Mar 2012 14:27:49 +0100 Subject: [PATCH] fixed problem with parsing optional string arguments --- apps/openmw/mwdialogue/dialoguemanager.cpp | 6 +++--- components/compiler/scriptparser.cpp | 19 +++++++++---------- components/compiler/stringparser.cpp | 5 +++++ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/apps/openmw/mwdialogue/dialoguemanager.cpp b/apps/openmw/mwdialogue/dialoguemanager.cpp index fe9cbf4ba0..d7b6bae6ab 100644 --- a/apps/openmw/mwdialogue/dialoguemanager.cpp +++ b/apps/openmw/mwdialogue/dialoguemanager.cpp @@ -650,7 +650,7 @@ namespace MWDialogue locals = mEnvironment.mScriptManager->getLocals (actorScript); } - Compiler::ScriptParser parser(mErrorHandler,mCompilerContext, locals); + Compiler::ScriptParser parser(mErrorHandler,mCompilerContext, locals, false); scanner.scan (parser); if(mErrorHandler.isGood()) @@ -712,7 +712,7 @@ namespace MWDialogue win->addText(it->response); executeScript(script); - + mLastTopic = keyword; mLastDialogue = dial; break; @@ -756,7 +756,7 @@ namespace MWDialogue mLastDialogue = *it; break; } - } + } } } diff --git a/components/compiler/scriptparser.cpp b/components/compiler/scriptparser.cpp index ce142847f5..ac0ee63f1c 100644 --- a/components/compiler/scriptparser.cpp +++ b/components/compiler/scriptparser.cpp @@ -24,7 +24,7 @@ namespace Compiler mLineParser.reset(); if (mLineParser.parseName (name, loc, scanner)) scanner.scan (mLineParser); - + return true; } @@ -34,22 +34,22 @@ namespace Compiler { mControlParser.reset(); if (mControlParser.parseKeyword (keyword, loc, scanner)) - scanner.scan (mControlParser); - + scanner.scan (mControlParser); + mControlParser.appendCode (mOutput.getCode()); - + return true; } - + if (keyword==Scanner::K_end && mEnd) { return false; } - + mLineParser.reset(); if (mLineParser.parseKeyword (keyword, loc, scanner)) scanner.scan (mLineParser); - + return true; } @@ -57,11 +57,11 @@ namespace Compiler { if (code==Scanner::S_newline) // empty line return true; - + mLineParser.reset(); if (mLineParser.parseSpecial (code, loc, scanner)) scanner.scan (mLineParser); - + return true; } @@ -77,4 +77,3 @@ namespace Compiler mOutput.clear(); } } - diff --git a/components/compiler/stringparser.cpp b/components/compiler/stringparser.cpp index 396a88c786..fe7bd30b9e 100644 --- a/components/compiler/stringparser.cpp +++ b/components/compiler/stringparser.cpp @@ -39,6 +39,11 @@ namespace Compiler mState = CommaState; return true; } + else if (code==Scanner::S_newline && mState==StartState) + { + scanner.putbackSpecial (code, loc); + return false; + } return Parser::parseSpecial (code, loc, scanner); }