//Token 转 Operator Operator API::Token2Operator(Token token) { if (token.Token_GetText() == "+") return Plus; if (token.Token_GetText() == "-") return Minus; }
//Token 转 Data_Type Data_Type API::Token2Type(Token token) { if (token.Token_GetText() == "int") return Int; if (token.Token_GetText() == "char") return Char; if (token.Token_GetText() == "float") return Float; if (token.Token_GetText() == "void") return Void; if (token.Token_GetText() == "string") return String; }
//Token 转 Ex_Statement Ex_Statement API::Token2Statement(Token token) { if (token.Token_GetText() == "{") return Statement_Start; if (token.Token_GetText() == "if") return If_Statement; if (token.Token_GetText() == "for") return For_Statement; if (token.Token_GetText() == "while") return While_Statement; if (token.Token_GetText() == "break") return Break_Statement; if (token.Token_GetText() == "continue") return Continue_Statement; if (token.Token_GetText() == "return") return Return_Statement; }