-
Notifications
You must be signed in to change notification settings - Fork 7
/
emit.h
45 lines (38 loc) · 800 Bytes
/
emit.h
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
#ifndef INCLUDE_EMIT_H
#define INCLUDE_EMIT_H
// emit.h
// Revision 8-sep-2011
#include "token.h"
#include <ostream>
class Emit
{
public:
Emit (std::ostream &out);
void omit_annotations();
void comment(const std::string &msg);
void boxedcomment(const std::string &msg);
void annotate(const Token &t);
std::ostream & get() { return o; }
template <typename T>
friend Emit & operator << (Emit &e, const T &t);
void setDebug();
bool getDebug() const;
private:
void preemit();
std::ostream &o;
bool debug;
bool with_an;
bool pendingf;
bool pendingl;
std::string file;
unsigned int line;
};
template <typename T>
Emit & operator << (Emit &e, const T &t)
{
e.preemit();
e.o << t;
return e;
}
#endif
// End of emit.h