[style]
This commit is contained in:
parent
936e9ea07d
commit
e9bc9a4107
|
|
@ -64,7 +64,6 @@ enum class WordType {
|
||||||
|
|
||||||
UNKOWN
|
UNKOWN
|
||||||
};
|
};
|
||||||
extern std::unordered_map<WordType, std::string> WordTypeNames;
|
|
||||||
|
|
||||||
// 定义输入的字符类别
|
// 定义输入的字符类别
|
||||||
enum class InputCharType {
|
enum class InputCharType {
|
||||||
|
|
@ -95,8 +94,6 @@ enum class InputCharType {
|
||||||
EPSILON, // 空字符 21
|
EPSILON, // 空字符 21
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::unordered_map<InputCharType, std::string> CharTypeNames;
|
|
||||||
|
|
||||||
// 定义 token类型
|
// 定义 token类型
|
||||||
enum class TokenType {
|
enum class TokenType {
|
||||||
KW = 0,
|
KW = 0,
|
||||||
|
|
@ -114,12 +111,13 @@ class Token {
|
||||||
TokenType type;
|
TokenType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 定义与名称映射
|
||||||
|
extern std::unordered_map<InputCharType, std::string> CharTypeNames;
|
||||||
|
extern std::unordered_map<WordType, std::string> WordTypeNames;
|
||||||
|
|
||||||
string getWordTypeName(WordType type);
|
string getWordTypeName(WordType type);
|
||||||
string getInputChartypeName(InputCharType type);
|
string getInputChartypeName(InputCharType type);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 定义函数判断输入的字符类别
|
// 定义函数判断输入的字符类别
|
||||||
InputCharType getInputCharType(char c);
|
InputCharType getInputCharType(char c);
|
||||||
string getWordTypeName(WordType type,string buffer);
|
string getWordTypeName(WordType type,string buffer);
|
||||||
|
|
@ -192,6 +190,8 @@ void removeUnreachableStates(DFA& dfa);
|
||||||
void printDFA(const DFA& dfa);
|
void printDFA(const DFA& dfa);
|
||||||
DFA nfaToDFA(const NFA& nfa);
|
DFA nfaToDFA(const NFA& nfa);
|
||||||
void printDFA(const DFA& dfa);
|
void printDFA(const DFA& dfa);
|
||||||
|
|
||||||
|
|
||||||
struct SetComparator {
|
struct SetComparator {
|
||||||
bool operator()(const set<State*, StatePtrCompare>& a, const set<State*, StatePtrCompare>& b) const {
|
bool operator()(const set<State*, StatePtrCompare>& a, const set<State*, StatePtrCompare>& b) const {
|
||||||
if (a.size() != b.size()) {
|
if (a.size() != b.size()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue