| 335 | } |
| 336 | |
| 337 | Model Reader::read() { |
| 338 | // std::clog << "Reading input, tokenizing..." << std::endl; |
| 339 | this->linebufferpos = 0; |
| 340 | // read first NRAWTOKEN token |
| 341 | // if file ends early, then all remaining tokens are set to FLEND |
| 342 | for (size_t i = 0; i < NRAWTOKEN; ++i) |
| 343 | while (!readnexttoken(rawtokens[i])) |
| 344 | ; |
| 345 | |
| 346 | processtokens(); |
| 347 | |
| 348 | linebuffer.clear(); |
| 349 | linebuffer.shrink_to_fit(); |
| 350 | |
| 351 | // std::clog << "Splitting tokens..." << std::endl; |
| 352 | splittokens(); |
| 353 | |
| 354 | // std::clog << "Setting up model..." << std::endl; |
| 355 | processsections(); |
| 356 | processedtokens.clear(); |
| 357 | processedtokens.shrink_to_fit(); |
| 358 | |
| 359 | return builder.model; |
| 360 | } |
| 361 | |
| 362 | void Reader::processnonesec() { |
| 363 | lpassert(sectiontokens.count(LpSectionKeyword::NONE) == 0); |