/
thomas-king
/
IdentifierParser
Обзор
Документация
Войти
/
thomas-king
/
IdentifierParser
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
include/Parser.h
49 строк
1 KB
AceRodstin
Replace Node with ListNode.
30 дек 2022, 17:23
30 дек 2022, 17:23
f8a3286
Код
Авторство
О чём код?
// // Parser.h // IdentifierParser // // Created by Ace Rodstin on 27 Dec 2022. // #ifndef PARSER_HEADER_FILE #define PARSER_HEADER_FILE #include <string> #include <memory> #include <sstream> #include "lib/ListNode.h" #include "lib/CharacterSet.h" using namespace std; namespace Identifier { class Parser { public: class Error; string parse(string identifier); private: using Node = ListNode<char>; char backtick = '`'; CharacterSet identifier_head_characters { { '_' }, { 'A', 'Z' }, { 'a', 'z' } }; unique_ptr<Node> create_list(string identifier); unique_ptr<Node> create_enclosed_identifier(string identifier); unique_ptr<Node> create_identifier(stringstream& buffer); unique_ptr<Node> create_identifier_head(char character); unique_ptr<Node> create_identifier_characters(stringstream& buffer); unique_ptr<Node> create_identifier_character(char character); string to_string(unique_ptr<Node> head); }; } #endif