mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
Adds: - ast/Block: a block scope that allows declaring local variables - ast/IfThenElseStatement: AST node for if..elseif..else..endif statements - model/FlowControlLabel: provides an anchor for jumps or calls. - Function calls, break statements, continue statements, and loops will all use these.
31 lines
653 B
C++
31 lines
653 B
C++
#ifndef POLSERVER_FLOWCONTROLLABEL_H
|
|
#define POLSERVER_FLOWCONTROLLABEL_H
|
|
|
|
#include <vector>
|
|
|
|
#include <optional>
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
{
|
|
class InstructionEmitter;
|
|
|
|
class FlowControlLabel
|
|
{
|
|
public:
|
|
FlowControlLabel();
|
|
|
|
bool has_address() const;
|
|
unsigned address() const;
|
|
const std::vector<unsigned>& get_referencing_instruction_addresses() const;
|
|
|
|
void assign_address( unsigned );
|
|
void add_referencing_instruction_address( unsigned );
|
|
|
|
private:
|
|
std::optional<unsigned> maybe_address;
|
|
std::vector<unsigned> referencing_instruction_addresses;
|
|
};
|
|
|
|
} // namespace Pol::Bscript::Compiler
|
|
|
|
#endif // POLSERVER_FLOWCONTROLLABEL_H
|