-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPPToken.cpp
More file actions
88 lines (75 loc) · 2.26 KB
/
PPToken.cpp
File metadata and controls
88 lines (75 loc) · 2.26 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "PPToken.h"
// The order of this list must be exactly the same as the enum PPTokeyType,
// defined in PPToken.h.
const std::vector<std::string> PPToken::_typeStringList = {
"header-name",
"identifier",
"pp-number",
"character-literal",
"user-defined-character-literal",
"string-literal",
"user-defined-string-literal",
"preprocessing-op-or-punc",
"non-whitespace-character",
"new-line",
"whitespace-sequence",
};
std::string PPToken::getTokenTypeUTF8String(const PPTokenType type)
{
return _typeStringList[static_cast<int>(type)];
}
std::shared_ptr<PPTokenHeaderName>
PPToken::createHeaderName(const std::string& u8str)
{
return std::make_shared<PPTokenHeaderName>(u8str);
}
std::shared_ptr<PPTokenIdentifier>
PPToken::createIdentifier(const std::string &u8str)
{
return std::make_shared<PPTokenIdentifier>(u8str);
}
std::shared_ptr<PPTokenPPNumber>
PPToken::createPPNumber(const std::string &u8str)
{
return std::make_shared<PPTokenPPNumber>(u8str);
}
std::shared_ptr<PPTokenCharacterLiteral>
PPToken::createCharacterLiteral(const std::string &u8str)
{
return std::make_shared<PPTokenCharacterLiteral>(u8str);
}
std::shared_ptr<PPTokenUserDefinedCharacterLiteral>
PPToken::createUserDefinedCharacterLiteral(const std::string &u8str)
{
return std::make_shared<PPTokenUserDefinedCharacterLiteral>(u8str);
}
std::shared_ptr<PPTokenStringLiteral>
PPToken::createStringLiteral(const std::string &u8str)
{
return std::make_shared<PPTokenStringLiteral>(u8str);
}
std::shared_ptr<PPTokenUserDefinedStringLiteral>
PPToken::createUserDefinedStringLiteral(const std::string &u8str)
{
return std::make_shared<PPTokenUserDefinedStringLiteral>(u8str);
}
std::shared_ptr<PPTokenPreprocessingOpOrPunc>
PPToken::createPreprocessingOpOrPunc(const std::string &u8str)
{
return std::make_shared<PPTokenPreprocessingOpOrPunc>(u8str);
}
std::shared_ptr<PPTokenNonWhitespaceChar>
PPToken::createNonWhitespaceChar(const std::string &u8str)
{
return std::make_shared<PPTokenNonWhitespaceChar>(u8str);
}
std::shared_ptr<PPTokenNewLine>
PPToken::createNewLine()
{
return std::make_shared<PPTokenNewLine>();
}
std::shared_ptr<PPTokenWhitespaceSequence>
PPToken::createWhitespaceSequence(const std::string &u8str)
{
return std::make_shared<PPTokenWhitespaceSequence>(u8str);
}