-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcompiler_p.h
More file actions
52 lines (39 loc) · 1.2 KB
/
compiler_p.h
File metadata and controls
52 lines (39 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <memory>
#include <vector>
#include <unordered_set>
namespace libscratchcpp
{
class CompilerContext;
class IEngine;
class Target;
class Block;
class CompilerValue;
class ICodeBuilderFactory;
class ICodeBuilder;
struct CompilerPrivate
{
enum class SubstackType
{
Loop,
IfStatement
};
CompilerPrivate(CompilerContext *ctx);
CompilerPrivate(IEngine *engine, Target *target);
static void initBuilderFactory();
void substackEnd();
std::shared_ptr<CompilerContext> ctxPtr; // for self-managed contexts
CompilerContext *ctx = nullptr;
std::shared_ptr<Block> block;
int customIfStatementCount = 0;
int customLoopCount = 0;
std::vector<std::pair<std::pair<std::shared_ptr<Block>, std::shared_ptr<Block>>, SubstackType>> substackTree;
bool substackHit = false;
bool emptySubstack = false;
bool warp = false;
static inline ICodeBuilderFactory *builderFactory = nullptr;
std::shared_ptr<ICodeBuilder> builder;
std::unordered_set<std::string> unsupportedBlocks;
};
} // namespace libscratchcpp