/
thomas-king
/
SyntacticAnalyzer
Обзор
Документация
Войти
/
thomas-king
/
SyntacticAnalyzer
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
include/Models/Operator.h
61 строка
970 B
Ace Rodstin
Implement SyntacticAnalyzer.
06 апр 2023, 09:52
06 апр 2023, 09:52
2d58f4b
Код
Авторство
О чём код?
// // Operator.h // Constants // // Created by Ace Rodstin on 3/7/23. // Copyright © 2023 Ace Rodstin. All rights reserved. // #ifndef OPERATOR_HEADER_FILE #define OPERATOR_HEADER_FILE #include <string> #include <map> using namespace std; namespace ace { enum class Operator { plus, minus, multiply, divide, assign }; static const map<Operator, string> operators = { { Operator::plus, "+" }, { Operator::minus, "-" }, { Operator::multiply, "*" }, { Operator::divide, "/" }, { Operator::assign, "=" } }; static string description(Operator op) { string description; switch (op) { case Operator::plus: description = "plus"; break; case Operator::minus: description = "minus"; break; case Operator::multiply: description = "multiply"; break; case Operator::divide: description = "divide"; break; case Operator::assign: description = "assign"; break; } return description; }; } #endif