VM2D 1.14
Vortex methods for 2D flows simulation
Loading...
Searching...
No Matches
Preprocessor.h
Go to the documentation of this file.
1/*--------------------------------*- VM2D -*-----------------*---------------*\
2| ## ## ## ## #### ##### | | Version 1.14 |
3| ## ## ### ### ## ## ## ## | VM2D: Vortex Method | 2026/03/06 |
4| ## ## ## # ## ## ## ## | for 2D Flow Simulation *----------------*
5| #### ## ## ## ## ## | Open Source Code |
6| ## ## ## ###### ##### | https://www.github.com/vortexmethods/VM2D |
7| |
8| Copyright (C) 2017-2026 I. Marchevsky, K. Sokol, E. Ryatina, A. Kolganova |
9*-----------------------------------------------------------------------------*
10| File name: Preprocessor.h |
11| Info: Source code of VM2D |
12| |
13| This file is part of VM2D. |
14| VM2D is free software: you can redistribute it and/or modify it |
15| under the terms of the GNU General Public License as published by |
16| the Free Software Foundation, either version 3 of the License, or |
17| (at your option) any later version. |
18| |
19| VM2D is distributed in the hope that it will be useful, but WITHOUT |
20| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
21| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
22| for more details. |
23| |
24| You should have received a copy of the GNU General Public License |
25| along with VM2D. If not, see <http://www.gnu.org/licenses/>. |
26\*---------------------------------------------------------------------------*/
27
28
40#ifndef PREPROCESSOR_H
41#define PREPROCESSOR_H
42
43#include <string>
44#include <sstream>
45
46namespace VMlib
47{
48
63 {
64 private:
67
70
73
76
78 void(Preprocessor::*currentParser)(char ch, std::string& str);
79
87 void normalParser(char ch, std::string& str);
88
95 void inStringParser(char ch, std::string& str);
96
103 void inCharParser(char ch, std::string& str);
104
113 void afterSlashParser(char ch, std::string& str);
114
122 void inInlineCommentParser(char ch, std::string& str);
123
132 void inMultilineCommentParser(char ch, std::string& str);
133
142 char processSymbol(char ch);
143
144 public:
146 std::string initialInput;
147
150
151
152
159 Preprocessor(const std::string& fileName);
160
163
165 std::string resultString;
166 std::stringstream resultStream;
167
168 };
169
170}//namespace VMlib
171
172#endif
Класс, позволяющий выполнять предварительную обработку файлов
std::string intermediateOutput
Строка, содержащая результат промежуточной обработки файла
void afterSlashParser(char ch, std::string &str)
Обработчик символа в режиме парсера выражения после слэша
void inStringParser(char ch, std::string &str)
Обработчик символа в режиме парсера строки (внутри двойных кавычек)
void(Preprocessor::* currentParser)(char ch, std::string &str)
Опредедение currentParser как указателя на функцию-члена класса
void inMultilineCommentParser(char ch, std::string &str)
Обработчик символа в режиме парсера многострочного комментария
std::string initialInput
Строка, содержащая исходный файл в первоначальном виде
bool inInlineLastEscape
Признак встречи слэша внутри однострочного комментария (после //)
void normalParser(char ch, std::string &str)
Обработчик символа в режиме обычного состояния парcера
~Preprocessor()
Деструктор
bool inMultilineLastStar
Признак встречи звездочки внутри многострочного комментария (после '/*')
char processSymbol(char ch)
Базовая функция обработки символа В зависимости от входого символа возвращает на выход:
bool inCharLastEscape
Признак встречи слэша внутри символа (внутри одинарных кавычек)
void inInlineCommentParser(char ch, std::string &str)
Обработчик символа в режиме парсера однострочного комментария (после //)
std::string resultString
Строка, содержащая окончательный результат обработки файла
bool inStringLastEscape
Признак встречи слэша внутри строки (внутри двойных кавычек)
std::stringstream resultStream
void inCharParser(char ch, std::string &str)
Обработчик символа в режиме парсера символа (внутри одинарных кавычек)