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
66
67
68
69
70
|
// file : libbuild2/cc/parser.hxx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
#ifndef LIBBUILD2_CC_PARSER_HXX
#define LIBBUILD2_CC_PARSER_HXX
#include <libbuild2/types.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/diagnostics.hxx>
#include <libbuild2/cc/types.hxx>
#include <libbuild2/cc/guess.hxx> // compiler_id
namespace build2
{
namespace cc
{
// Extract translation unit information from a preprocessed C/C++ source.
//
struct token;
class lexer;
class parser
{
public:
// The compiler_id argument should identify the compiler that has done
// the preprocessing.
//
unit
parse (ifdstream& is, const path_name& n, const compiler_id& cid)
{
unit r;
parse (is, n, r, cid);
return r;
}
void
parse (ifdstream&, const path_name&, unit&, const compiler_id&);
private:
void
parse_module (token&, bool, location_value);
void
parse_import (token&, bool);
pair<string, bool>
parse_module_name (token&, bool);
void
parse_module_part (token&, string&);
string
parse_header_name (token&);
public:
string checksum; // Translation unit checksum.
private:
const compiler_id* cid_;
lexer* l_;
unit* u_;
optional<location_value> module_marker_;
};
}
}
#endif // LIBBUILD2_CC_PARSER_HXX
|