-
Notifications
You must be signed in to change notification settings - Fork 0
/
preprocessor.cpp
58 lines (47 loc) · 881 Bytes
/
preprocessor.cpp
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
#include "preprocessor.h"
#include "hashed.h"
#include "source_manager.h"
namespace
{
static const hashed include_directive = hashed::literal("include");
}
sequencer::~sequencer()
{}
file_sequencer::file_sequencer(char const* start, char const* end)
: lex(start, end)
{
fetch();
}
token_type file_sequencer::tt()
{
return tok.tok_type;
}
void file_sequencer::next()
{
tok = lex.fetch(false);
fetch();
}
void file_sequencer::fetch()
{
again:
token_type tt = tok.tok_type;
if (tt != token_type::hash)
{
tok.tok_type = tt;
return;
}
//lex.skip_until_eoln();
goto again;
}
xxx::xxx(file_record* file_rec)
{
seqs.push_back(std::make_unique<file_sequencer>(file_rec->text_begin(), file_rec->text_end()));
}
token_type xxx::tt()
{
return seqs.back()->tt();
}
void xxx::next()
{
seqs.back()->next();
}