MCPcopy Create free account
hub / github.com/covscript/covscript / preprocessor

Method preprocessor

sources/compiler/lexer.cpp:441–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439
440 public:
441 explicit preprocessor(const context_t &context, compiler_type &compiler, const std::deque<char> &char_buff,
442 std::deque<token_base *> &tokens, charset encoding)
443 {
444 for (auto &ch : char_buff) {
445 if (ch == '\n') {
446 process_endline(context, compiler, tokens, encoding);
447 continue;
448 }
449 if (is_annotation)
450 continue;
451 if (is_command) {
452 if (!std::isspace(ch))
453 command.push_back(ch);
454 continue;
455 }
456 if (empty_line && !std::isspace(ch)) {
457 switch (ch) {
458 case '#':
459 is_annotation = true;
460 continue;
461 case '@':
462 is_command = true;
463 continue;
464 default:
465 empty_buff = false;
466 empty_line = false;
467 break;
468 }
469 }
470 if (!empty_buff) {
471 buff.push_back(ch);
472 line.push_back(ch);
473 }
474 }
475 process_endline(context, compiler, tokens, encoding);
476 if (multi_line)
477 throw compile_error("Lack of the @end command.");
478 }
479 };
480
481 void

Callers

nothing calls this directly

Calls 2

isspaceFunction · 0.85
compile_errorClass · 0.85

Tested by

no test coverage detected