#include namespace willowc { std::optional> Parser::run() { bool failed = false; while (true) { Token t = tokenizer_.scan(); if (t.kind == TokenKind::Eof) { willow::emit(diagnostic_engine_, willow::Severity::Debug) << std::format("[ :: {} : ({}, {}) ]", t.kind, t.start, t.end); break; } willow::emit(diagnostic_engine_, willow::Severity::Debug) << std::format("[ '{}' :: {} : ({}, {}) ]", tokenizer_.buf.substr(t.start, t.end - t.start), t.kind, t.start, t.end); } return std::nullopt; } willow::DiagnosticBuilder Parser::emitParserError(Token t, willow::Severity severity) { willow::Location loc = file_.getLoc(t.start); return willow::DiagnosticBuilder(diagnostic_engine_, severity, loc); } } // namespace willowc