diff --git a/nfa/include/nfa.h b/nfa/include/nfa.h index 5b05fa2..d1a5739 100644 --- a/nfa/include/nfa.h +++ b/nfa/include/nfa.h @@ -64,7 +64,6 @@ enum class WordType { UNKOWN }; -extern std::unordered_map WordTypeNames; // 定义输入的字符类别 enum class InputCharType { @@ -95,8 +94,6 @@ enum class InputCharType { EPSILON, // 空字符 21 }; -extern std::unordered_map CharTypeNames; - // 定义 token类型 enum class TokenType { KW = 0, @@ -114,12 +111,13 @@ class Token { TokenType type; }; +// 定义与名称映射 +extern std::unordered_map CharTypeNames; +extern std::unordered_map WordTypeNames; + string getWordTypeName(WordType type); string getInputChartypeName(InputCharType type); - - - // 定义函数判断输入的字符类别 InputCharType getInputCharType(char c); string getWordTypeName(WordType type,string buffer); @@ -192,6 +190,8 @@ void removeUnreachableStates(DFA& dfa); void printDFA(const DFA& dfa); DFA nfaToDFA(const NFA& nfa); void printDFA(const DFA& dfa); + + struct SetComparator { bool operator()(const set& a, const set& b) const { if (a.size() != b.size()) {