#include <command.h>
Public Member Functions | |
virtual bool | parse (const Common::String &line, ScriptParseContext &parseCtx, Command *&command)=0 |
virtual void | transition (ScriptParseContext &parseCtx, Command *oldCommand, Command *newCommand, CommandParser *newCommandParser) |
virtual void | finish (ScriptParseContext &parseCtx) |
Base class for command parsers.
The parser's main job is to create a Command instance from input line.
|
pure virtual |
Parses the specified line and possibly returns a Command instance.
line | Line to parse. |
parseCtx | Parse context. |
command | Output parameter for newly created command. |
Implemented in MutationOfJB::ChangeSceneCommandParser, MutationOfJB::ChangeStaticCommandParser, MutationOfJB::ChangeDoorCommandParser, MutationOfJB::ChangeObjectCommandParser, MutationOfJB::RandomBlockStartParser, MutationOfJB::EndBlockCommandParser, MutationOfJB::LoadPlayerCommandParser, MutationOfJB::GotoCommandParser, MutationOfJB::CallMacroCommandParser, MutationOfJB::IfItemCommandParser, MutationOfJB::IfPiggyCommandParser, MutationOfJB::NewRoomCommandParser, MutationOfJB::RandomCommandParser, MutationOfJB::TalkCommandParser, MutationOfJB::AddItemCommandParser, MutationOfJB::BitmapVisibilityCommandParser, MutationOfJB::IfCommandParser, MutationOfJB::LabelCommandParser, MutationOfJB::PlayAnimationCommandParser, MutationOfJB::RemoveItemCommandParser, MutationOfJB::SayCommandParser, MutationOfJB::SetObjectFrameCommandParser, MutationOfJB::SwitchPartCommandParser, MutationOfJB::CameFromCommandParser, MutationOfJB::RemoveAllItemsCommandParser, MutationOfJB::SetColorCommandParser, MutationOfJB::RenameCommandParser, MutationOfJB::SpecialShowCommandParser, and MutationOfJB::DefineStructCommandParser.
|
virtual |
Called when transitioning parsing between two commands.
For example, cmdParserA->transition(parseCtx, cmdA, cmdB, cmdParserB) is called after command B is done parsing to notify command A parser about the transition from command A to command B. This is useful for sequential commands, because at the time command A is being parsed, we don't have any information about command B, so we cannot set the next pointer. Transition method can be used to set the next pointer after command B is available.
parseCtx | Parse context. |
oldCommand | Old command (created by this parser). |
newCommand | New command (created by newCommandParser). |
newCommandParser | Command parser which created the new command. |
Reimplemented in MutationOfJB::RandomBlockStartParser, MutationOfJB::EndBlockCommandParser, MutationOfJB::CallMacroCommandParser, MutationOfJB::ConditionalCommandParser, and MutationOfJB::SeqCommandParser.
|
virtual |
Called after the whole script is parsed.
Can be used for cleanup.
parseCtx | Parse context. |
Reimplemented in MutationOfJB::EndBlockCommandParser, and MutationOfJB::ConditionalCommandParser.