101 std::vector<Token> res;
102 for (
int i = 0; i < start_ptr; ++i) {
105 for (
int i = 0; i < s.size(); ++i) {
108 for (
int i = fin_ind + 1; i < f.size(); ++i) {
111 fin_ind = s.size() + start_ptr;
117 std::ifstream file(
"ServiceWords.txt");
119 while (std::getline(file, str)) {
120 if (str.empty())
continue;
121 service_trie->
add(str.begin(), str.end());
125 file = std::ifstream(path);
129 std::string buffer =
"";
132 bool prev_quotation =
false, prev_single =
false;
133 while (file >> std::noskipws >> c) {
134 if (c ==
'\t') c =
' ';
137 prev_quotation =
true;
141 if (c ==
' ' && !prev_quotation && !prev_single || c ==
'\n' || buffer.empty() && (
is_punctuation(std::string(1, c)) ||
142 c ==
',' || c ==
'(' || c ==
')')) {
143 if (buffer.empty() && (
is_punctuation(std::string(1, c)) || c ==
',' || c ==
'(' || c ==
')'))
145 if (c ==
'\n') prev_quotation = prev_single =
false;
150 if (c ==
'\n') ++
line_;
157 if (prev_quotation || prev_single)
continue;
163 buffer = std::string(1, c);
168 buffer = std::string(1, c);
171 prev_quotation = !prev_quotation;
172 }
else if (c ==
'\'') {
173 prev_single = !prev_single;
175 if (prev_quotation || prev_single)
continue;
179 }
else if (prev_quotation || prev_single) {
180 prev_quotation = prev_single =
false;
195 std::string lib_buff =
"";
198 if (
tokens_[ptr].value ==
"using") {
201 state_line =
tokens_[ptr].line;
205 }
else if (state == 1) {
206 if (
tokens_[ptr].line != state_line)
207 throw std::exception((
"Invalid token: ';' expected (" + std::to_string(
tokens_[ptr].line) +
" line)").c_str());
208 if (
tokens_[ptr].value !=
";") {
209 lib_buff +=
tokens_[ptr].value;
211 bool need_to_parse = lib_parser.
add_lib(lib_buff);
213 std::string lib_path = lib_parser.
name_to_path(lib_buff);
224 throw std::exception((
"Invalid token: ';' expected (" + std::to_string(
tokens_[
tokens_.size() - 1].line) +
" line)").c_str());