summaryrefslogtreecommitdiffabout
path: root/include/sitecing/sitecing_enflesher.h
blob: ad57fb5ac7e99350a2e1fc465dfd4fc207887cdb (plain)
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
#ifndef __SITECING_SITECING_ENFLESHER_H
#define __SITECING_SITECING_ENFLESHER_H

#include <fstream>
#include <string>
using namespace std;

/**
 * @file
 * @brief The preprocessed source builder.
 */

#ifndef sitecing_enflesher_flexlexer_once
#define sitecing_enflesher_flexlexer_once
#undef yyFlexLexer
#define yyFlexLexer sitecing_enflesherFlexLexer
#include <FlexLexer.h>
#undef yyFlexLexerOnce
#endif

class sitecing_parser;
/**
 * The enfleshing of the skeleton file according to the in-memory parsed
 * component source.
 */
class sitecing_enflesher : public sitecing_enflesherFlexLexer {
    public:
	/**
	 * It is time to anchor output with the #line directive.
	 */
	bool anchor_time;
	/**
	 * @todo TODO: wish I could remember -- document me.
	 */
	bool anchoraged;
	/**
	 * The reference to the parser object containg the parsed source.
	 */
	sitecing_parser& parser;
	/**
	 * The output stream.
	 */
	ofstream outs;

	/**
	 * @param p The parser object containing preparsed data.
	 */
	sitecing_enflesher(sitecing_parser& p)
	    : parser(p), anchor_time(true) { }

	/**
	 * Do the job.
	 */
	void enflesh();

	virtual void LexerOutput(const char *buf,int size);
	virtual int yylex();

	/**
	 * Put a #line anchor into output.
	 */
	void anchor();
};

#endif /* __SITECING_SITECING_ENFLESHER_H */