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
|
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
|
-
+
-
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
|
static inline ostream& operator<<( ostream& out, const Term& t )
{
return ToString( out, t );
}
// A term associated with a location id.
// Used to represent tokens and tokens/values coming out of the resolver.
using TermLoc = pair< ir::Term, uint32_t >;
using TermLoc = pair< eir::Term, uint32_t >;
}
namespace std
{
template<> struct hash< goose::ir::Hole >
template<> struct hash< goose::eir::Hole >
{
size_t operator()( const goose::ir::Hole& x ) const
size_t operator()( const goose::eir::Hole& x ) const
{
return hash< goose::util::StringId >()( x.name );
}
};
}
#define TERM( x ) ir::Term( x )
#define TERM( x ) eir::Term( x )
#define TSTR( x ) TERM( string( x ) )
#define TSID( x ) TERM( #x##_sid )
#define HOLE( x ) TERM( ir::Hole{ x } )
#define ANYTERM( x ) TERM( ir::AnyTerm( #x##_sid ) )
#define VECOFLENGTH( x ) TERM( ir::VecOfLength( #x##_sid ) )
#define VEC( ... ) TERM( ir::Vector::Make( __VA_ARGS__ ) )
#define REPEAT( x ) ir::Repetition( x )
#define HOLE( x ) TERM( eir::Hole{ x } )
#define ANYTERM( x ) TERM( eir::AnyTerm( #x##_sid ) )
#define VECOFLENGTH( x ) TERM( eir::VecOfLength( #x##_sid ) )
#define VEC( ... ) TERM( eir::Vector::Make( __VA_ARGS__ ) )
#define REPEAT( x ) eir::Repetition( x )
#endif
|