/
thomas-king
/
IntegerParser
Обзор
Документация
Войти
/
thomas-king
/
IntegerParser
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
include/Builder.h
55 строк
1 KB
AceRodstin
Refactor parser.
02 янв 2023, 17:39
02 янв 2023, 17:39
e53dbcf
Код
Авторство
О чём код?
// // Builder.h // IntegerParser // // Created by Ace Rodstin on 30 Dec 2022. // #ifndef BUILDER_HEADER_FILE #define BUILDER_HEADER_FILE #include <string> #include <memory> #include <sstream> #include <map> #include <optional> #include "lib/ListNode.h" #include "lib/CharacterSet.h" #include "Literal.h" using namespace std; namespace Integer { class Builder { public: using Node = ListNode<char>; void configure(string literal); Literal build(); private: stringstream buffer; optional<string> head; Base base; const map<string, Base> literals_head { { "0x", Base::hexadecimal }, { "0o", Base::octal }, { "0b", Base::binary } }; void define_head(); void define_base(); unique_ptr<Node> create_literal(); unique_ptr<Node> create_head(); unique_ptr<Node> create_literal_characters(); unique_ptr<Node> create_literal_character(char character); unique_ptr<Node> create_digit(char character); CharacterSet allowed_characters(); }; } #endif