This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathexpress.h
More file actions
132 lines (116 loc) · 4.18 KB
/
express.h
File metadata and controls
132 lines (116 loc) · 4.18 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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* Copyright (C) 2003-2015 LiveCode Ltd.
This file is part of LiveCode.
LiveCode is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License v3 as published by the Free
Software Foundation.
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
//
// MCExpression class declarations
//
#ifndef EXPRESSION_H
#define EXPRESSION_H
#define MAX_EXP 7
class MCExpression
{
protected:
uint2 line;
uint2 pos;
Factor_rank rank;
MCExpression *root;
MCExpression *left;
MCExpression *right;
public:
MCExpression();
virtual ~MCExpression();
virtual Parse_stat parse(MCScriptPoint &, Boolean the);
// Evaluate the exoression as a value, and place its value into ep.
virtual Exec_stat eval(MCExecPoint &ep);
// Evaluate the expression as a container, and place the reference to
// the container's value in r_ref.
virtual Exec_stat evalcontainer(MCExecPoint& ep, MCVariable*& r_var, MCVariableValue*& r_ref);
// Return the variable to which this expression refers in the context of
// ep, or NULL if it is not just a variable expression.
virtual MCVariable *evalvar(MCExecPoint& ep);
// Return the var-ref which lies at the root of this expression.
// A return value of NULL means that there is no root variable.
// The purpose of this call is to analyze (after parsing) whether the
// left and right hand side of an variable mutation command share the
// same variable. It is designed to be used at parse-time, not exec-time.
virtual MCVarref *getrootvarref(void);
void setrank(Factor_rank newrank)
{
rank = newrank;
}
void setroot(MCExpression *newroot)
{
root = newroot;
}
void setleft(MCExpression *newleft)
{
left = newleft;
}
void setright(MCExpression *newright)
{
right = newright;
}
Factor_rank getrank()
{
return rank;
}
MCExpression *getroot()
{
return root;
}
MCExpression *getleft()
{
return left;
}
MCExpression *getright()
{
return right;
}
Parse_stat getexps(MCScriptPoint &sp, MCExpression *earray[], uint2 &ecount);
void freeexps(MCExpression *earray[], uint2 ecount);
Parse_stat get0params(MCScriptPoint &);
Parse_stat get0or1param(MCScriptPoint &sp, MCExpression **exp, Boolean the);
Parse_stat get1param(MCScriptPoint &, MCExpression **exp, Boolean the);
Parse_stat get1or2params(MCScriptPoint &, MCExpression **e1,
MCExpression **e2, Boolean the);
Parse_stat get2params(MCScriptPoint &, MCExpression **e1, MCExpression **e2);
Parse_stat get2or3params(MCScriptPoint &, MCExpression **exp1,
MCExpression **exp2, MCExpression **exp3);
Parse_stat get3params(MCScriptPoint &, MCExpression **exp1,
MCExpression **exp2, MCExpression **exp3);
Parse_stat get4or5params(MCScriptPoint &, MCExpression **exp1,
MCExpression **exp2, MCExpression **exp3,
MCExpression **exp4, MCExpression **exp5);
Parse_stat get6params(MCScriptPoint &, MCExpression **exp1,
MCExpression **exp2, MCExpression **exp3,
MCExpression **exp4, MCExpression **exp5,
MCExpression **exp6);
Parse_stat getvariableparams(MCScriptPoint &sp, uint32_t p_min_params, uint32_t p_param_count, ...);
Parse_stat getparams(MCScriptPoint &spt, MCParameter **params);
void initpoint(MCScriptPoint &);
Exec_stat compare(MCExecPoint &, int2 &i, bool p_compare_arrays = false);
static int2 compare_arrays(MCExecPoint &ep1, MCExecPoint &ep2, MCExecPoint *p_context);
static int2 compare_values(MCExecPoint &ep1, MCExecPoint &ep2, MCExecPoint *p_context, bool p_compare_arrays);
};
class MCFuncref : public MCExpression
{
MCNameRef name;
MCHandler *handler;
MCObject *parent;
MCParameter *params;
bool resolved : 1;
public:
MCFuncref(MCNameRef);
virtual ~MCFuncref();
virtual Parse_stat parse(MCScriptPoint &, Boolean the);
virtual Exec_stat eval(MCExecPoint &ep);
};
#endif