|
@@ -15,11 +15,12 @@ namespace zp
|
|
struct UnionBlock;
|
|
struct UnionBlock;
|
|
struct Loop;
|
|
struct Loop;
|
|
|
|
|
|
- // forward declaration
|
|
|
|
- class AstVisitor;
|
|
|
|
-
|
|
|
|
class Parser;
|
|
class Parser;
|
|
class ParserException;
|
|
class ParserException;
|
|
|
|
+
|
|
|
|
+ // forward declarations
|
|
|
|
+ class AstVisitor;
|
|
|
|
+ struct BlockInstruction;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -38,7 +39,7 @@ struct zp::Block
|
|
{
|
|
{
|
|
virtual ~Block(void) = default;
|
|
virtual ~Block(void) = default;
|
|
|
|
|
|
- virtual void accept(AstVisitor& v) = 0;
|
|
|
|
|
|
+ virtual std::unique_ptr<BlockInstruction> accept(AstVisitor& v) = 0;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -50,7 +51,7 @@ struct zp::InstructionBlock :
|
|
inline void addInstruction(Instruction i) { instructions.push_back(i); }
|
|
inline void addInstruction(Instruction i) { instructions.push_back(i); }
|
|
inline bool isEmpty(void) const { return instructions.empty(); }
|
|
inline bool isEmpty(void) const { return instructions.empty(); }
|
|
|
|
|
|
- void accept(AstVisitor& v);
|
|
|
|
|
|
+ std::unique_ptr<BlockInstruction> accept(AstVisitor& v);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -59,15 +60,15 @@ struct zp::UnionBlock :
|
|
{
|
|
{
|
|
std::vector<std::unique_ptr<Block>> instructions;
|
|
std::vector<std::unique_ptr<Block>> instructions;
|
|
inline void addBlock(std::unique_ptr<Block>&& block) { instructions.push_back(std::move(block)); }
|
|
inline void addBlock(std::unique_ptr<Block>&& block) { instructions.push_back(std::move(block)); }
|
|
-
|
|
|
|
- void accept(AstVisitor& v);
|
|
|
|
|
|
+
|
|
|
|
+ std::unique_ptr<BlockInstruction> accept(AstVisitor& v);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
struct zp::Loop :
|
|
struct zp::Loop :
|
|
public UnionBlock
|
|
public UnionBlock
|
|
{
|
|
{
|
|
- void accept(AstVisitor& v);
|
|
|
|
|
|
+ std::unique_ptr<BlockInstruction> accept(AstVisitor& v);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|