fixed problem with parsing optional string arguments

actorid
Marc Zinnschlag 13 years ago
parent 100c6a42a5
commit d9677cb33e

@ -650,7 +650,7 @@ namespace MWDialogue
locals = mEnvironment.mScriptManager->getLocals (actorScript); locals = mEnvironment.mScriptManager->getLocals (actorScript);
} }
Compiler::ScriptParser parser(mErrorHandler,mCompilerContext, locals); Compiler::ScriptParser parser(mErrorHandler,mCompilerContext, locals, false);
scanner.scan (parser); scanner.scan (parser);
if(mErrorHandler.isGood()) if(mErrorHandler.isGood())
@ -712,7 +712,7 @@ namespace MWDialogue
win->addText(it->response); win->addText(it->response);
executeScript(script); executeScript(script);
mLastTopic = keyword; mLastTopic = keyword;
mLastDialogue = dial; mLastDialogue = dial;
break; break;
@ -756,7 +756,7 @@ namespace MWDialogue
mLastDialogue = *it; mLastDialogue = *it;
break; break;
} }
} }
} }
} }

@ -24,7 +24,7 @@ namespace Compiler
mLineParser.reset(); mLineParser.reset();
if (mLineParser.parseName (name, loc, scanner)) if (mLineParser.parseName (name, loc, scanner))
scanner.scan (mLineParser); scanner.scan (mLineParser);
return true; return true;
} }
@ -34,22 +34,22 @@ namespace Compiler
{ {
mControlParser.reset(); mControlParser.reset();
if (mControlParser.parseKeyword (keyword, loc, scanner)) if (mControlParser.parseKeyword (keyword, loc, scanner))
scanner.scan (mControlParser); scanner.scan (mControlParser);
mControlParser.appendCode (mOutput.getCode()); mControlParser.appendCode (mOutput.getCode());
return true; return true;
} }
if (keyword==Scanner::K_end && mEnd) if (keyword==Scanner::K_end && mEnd)
{ {
return false; return false;
} }
mLineParser.reset(); mLineParser.reset();
if (mLineParser.parseKeyword (keyword, loc, scanner)) if (mLineParser.parseKeyword (keyword, loc, scanner))
scanner.scan (mLineParser); scanner.scan (mLineParser);
return true; return true;
} }
@ -57,11 +57,11 @@ namespace Compiler
{ {
if (code==Scanner::S_newline) // empty line if (code==Scanner::S_newline) // empty line
return true; return true;
mLineParser.reset(); mLineParser.reset();
if (mLineParser.parseSpecial (code, loc, scanner)) if (mLineParser.parseSpecial (code, loc, scanner))
scanner.scan (mLineParser); scanner.scan (mLineParser);
return true; return true;
} }
@ -77,4 +77,3 @@ namespace Compiler
mOutput.clear(); mOutput.clear();
} }
} }

@ -39,6 +39,11 @@ namespace Compiler
mState = CommaState; mState = CommaState;
return true; return true;
} }
else if (code==Scanner::S_newline && mState==StartState)
{
scanner.putbackSpecial (code, loc);
return false;
}
return Parser::parseSpecial (code, loc, scanner); return Parser::parseSpecial (code, loc, scanner);
} }

Loading…
Cancel
Save