-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathannotation.hpp
79 lines (67 loc) · 1.62 KB
/
annotation.hpp
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include <stdinc.h>
#include "commands.hpp"
struct TextLabelAnnotation
{
bool is_varlen;
bool preserve_case;
std::string string;
};
struct String128Annotation
{
std::string string;
};
// not used
struct VarAnnotation
{
shared_ptr<Var> base;
optional<variant<int32_t, shared_ptr<Var>>> index; // int32_t index is 0-based
};
struct ArrayAnnotation
{
shared_ptr<Var> base;
variant<int32_t, shared_ptr<Var>> index; // int32_t index is 0-based
};
struct ModelAnnotation
{
weak_ptr<const Script> where; // weak to avoid circular reference
uint32_t id;
};
struct RepeatAnnotation
{
const Command& set_var_to_zero;
const Command& add_var_with_one;
const Command& is_var_geq_times;
// numbers compatible with set_var_to_times and add_var_with_int
Commands::MatchArgument number_zero;
Commands::MatchArgument number_one;
};
struct SwitchAnnotation
{
size_t num_cases;
bool has_default;
};
struct SwitchCaseAnnotation
{
const Command* is_var_eq_int; // may be `nullptr` for SWITCH_START/CONTINUED instead.
};
struct IncDecAnnotation
{
const Command& op_var_with_one;
Commands::MatchArgument number_one;
};
// Instead of a const Command&, annotate this on commands that do not compile to anything.
struct DummyCommandAnnotation
{
};
// When a command is replaced by another command.
struct ReplacedCommandAnnotation
{
const Command& command;
std::vector<any> params;
};
// Assigned to the node during parse.
struct DumpAnnotation
{
std::vector<uint8_t> bytes;
};