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
|
struct STerm;
class Hole
{
public:
Hole() = default;
Hole( StringId name );
template< typename K >
Hole( StringId name, K&& kind ) :
m_name( name ),
m_kind( make_shared< STerm >( STerm{ forward< K >( kind ) } ) )
{}
const auto& name() const { return m_name; }
const auto& kind() const;
bool operator<( const Hole& rhs ) const;
bool operator==( const Hole& rhs ) const;
private:
StringId m_name;
ptr< STerm > m_kind = make_shared< STerm >();
};
using Term = variant
<
uint64_t,
LocationId,
string,
|
|
<
<
<
|
>
>
>
|
>
|
>
|
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
|
struct STerm;
class Hole
{
public:
Hole() = default;
Hole( StringId name, StringId kind = ""_sid, uint32_t repetitionDepth = 0 ) :
m_name( name ),
m_kind( kind ),
m_repetitionDepth( repetitionDepth )
{}
static constexpr uint32_t AnyRepetitionDepth = ~0;
const auto& name() const { return m_name; }
const auto& kind() const { return m_kind; }
uint32_t repetitionDepth() const{ return m_repetitionDepth; }
bool operator<( const Hole& rhs ) const;
bool operator==( const Hole& rhs ) const;
private:
StringId m_name;
StringId m_kind;
uint32_t m_repetitionDepth = 0;
};
using Term = variant
<
uint64_t,
LocationId,
string,
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
ptr< void >,
void*
>;
extern bool operator==( const Term& lhs, const Term& rhs );
extern bool operator!=( const Term& lhs, const Term& rhs );
struct STerm
{
Term content;
};
inline Hole::Hole( StringId name ) : Hole( name, Term( "anykind"_sid ) ) {}
inline const auto& Hole::kind() const { return m_kind->content; }
extern ostream& operator<<( ostream& out, const Term& t );
// A term associated with a location id.
// Used to represent tokens and tokens/values coming out of the resolver.
using TermLoc = pair< eir::Term, LocationId >;
}
|
<
<
<
<
<
<
<
<
<
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
ptr< void >,
void*
>;
extern bool operator==( const Term& lhs, const Term& rhs );
extern bool operator!=( const Term& lhs, const Term& rhs );
extern ostream& operator<<( ostream& out, const Term& t );
// A term associated with a location id.
// Used to represent tokens and tokens/values coming out of the resolver.
using TermLoc = pair< eir::Term, LocationId >;
}
|