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
|
// file : cli/semantics/expression.hxx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#ifndef CLI_SEMANTICS_EXPRESSION_HXX
#define CLI_SEMANTICS_EXPRESSION_HXX
#include <string>
#include <semantics/elements.hxx>
namespace semantics
{
//
//
class initialized;
//
//
class expression: public node
{
public:
enum expression_type
{
string_lit,
char_lit,
bool_lit,
int_lit,
float_lit,
call_expr,
identifier
};
expression_type
type () const
{
return type_;
}
std::string const&
value () const
{
return value_;
}
public:
initialized&
initializes () const
{
return *initializes_;
}
public:
expression (path const& file,
size_t line,
size_t column,
expression_type type,
std::string const& value)
: node (file, line, column), type_ (type), value_ (value)
{
}
void
add_edge_right (initialized& e)
{
initializes_ = &e;
}
private:
initialized* initializes_;
expression_type type_;
std::string value_;
};
}
#endif // CLI_SEMANTICS_EXPRESSION_HXX
|