MCPcopy Create free account
hub / github.com/dfranx/ShaderDebugger / ParseLine

Method ParseLine

libs/wgtcc/cpp.cc:467–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465
466
467 void Preprocessor::ParseLine(TokenSequence ls) {
468 auto directive = ls.Next(); // Skip directive 'line'
469 TokenSequence ts;
470 Expand(ts, ls);
471 auto tok = ts.Expect(Token::I_CONSTANT);
472
473 int line = 0;
474 size_t end = 0;
475 try {
476 line = stoi(tok->str_, &end, 10);
477 }
478 catch (const std::out_of_range & oor) {
479 Error(tok, "line number out of range");
480 }
481 if (line == 0 || end != tok->str_.size()) {
482 Error(tok, "illegal line number");
483 }
484
485 curLine_ = line;
486 lineLine_ = directive->loc_.line_;
487 if (ts.Empty())
488 return;
489 tok = ts.Expect(Token::LITERAL);
490
491 // Enusure "s-char-sequence"
492 if (tok->str_.front() != '"' || tok->str_.back() != '"') {
493 Error(tok, "expect s-char-sequence");
494 }
495 }
496
497
498 void Preprocessor::ParseIf(TokenSequence ls) {

Callers

nothing calls this directly

Calls 5

ErrorFunction · 0.85
ExpectMethod · 0.80
sizeMethod · 0.80
NextMethod · 0.45
EmptyMethod · 0.45

Tested by

no test coverage detected