polserver/pol-core/bscript/compiler/analyzer/FlowControlScope.h
Eric Swanson 1a3619b231
Add support for while loops (#268)
Adds:
- analyzer/FlowControlScope: Registers a break/continue scope
- analyzer/FlowControlScopes: Registry for break/continue scopes
- ast/LabelableStatement: Base class for AST nodes that can be labelled (loops and case)
- ast/LoopStatement: Base class for AST nodes for loops (have a break and continue label)
- ast/WhileLoop: AST node for a while loop
2020-09-03 19:46:27 -07:00

34 lines
887 B
C++

#ifndef POLSERVER_FLOWCONTROLSCOPE_H
#define POLSERVER_FLOWCONTROLSCOPE_H
#include <memory>
#include <string>
namespace Pol::Bscript::Compiler
{
class FlowControlLabel;
class FlowControlScopes;
class SourceLocation;
class FlowControlScope
{
public:
FlowControlScope( FlowControlScopes&, const SourceLocation&, std::string name,
std::shared_ptr<FlowControlLabel> );
~FlowControlScope();
FlowControlScope( const FlowControlScope& ) = delete;
FlowControlScope& operator=( const FlowControlScope& ) = delete;
const SourceLocation& source_location;
const std::string name;
const std::shared_ptr<FlowControlLabel> flow_control_label;
const unsigned local_variables_size;
const FlowControlScope* const parent_scope;
private:
FlowControlScopes& flow_control_scopes;
};
} // namespace Pol::Bscript::Compiler
#endif // POLSERVER_FLOWCONTROLSCOPE_H