ArgScript::ISpecialBlock class

This is a special kind of block that can process every line individually, and that uses its own end keywords.

Unlike IBlock objects, ISpecialBlock cannot have its own parsers. Also, ISpecialBlock does not end when the 'end' keyword is reached; instead, the end keyword must be specified in the FormatParser::AddSpecialBlock() method.

A good example of the use of special blocks are conditionals: in the ISpecialBlock::OnLine() event, we can decide which lines get parsed and executed (the ones inside the condition met), and which don't, as well as detect special lines (for example, 'else').

Base classes

class IParser
This interface represents a command or block that can be parsed in ArgScript.

Constructors, destructors, conversion operators

~ISpecialBlock() virtual

Public functions

auto SetData(FormatParser* pFormatParser, void* pData) -> void override
Sets the data and FormatParser of this parser.
auto OnLine(LexerString& lineText) -> bool pure virtual
A method caled every time a line is read inside this block.
auto OnEndReached(int) -> void pure virtual
Method called when an end keyword is reached.

Function documentation

void ArgScript::ISpecialBlock::SetData(FormatParser* pFormatParser, void* pData) override

Sets the data and FormatParser of this parser.

This method is called when FormatParser::AddParser() or IBlock::AddParser() are used.

bool ArgScript::ISpecialBlock::OnLine(LexerString& lineText) pure virtual

A method caled every time a line is read inside this block.

Parameters
lineText The text of the line.
Returns Whether the line was processed or not.

If the method returns true, the line will be considered processed and it won't be parsed like it normally would.

void ArgScript::ISpecialBlock::OnEndReached(int) pure virtual

Method called when an end keyword is reached.

For special blocks, end keywords are not 'end'; instead, they must be explictly specified using the FormatParser::AddSpecialBlock() method.