#ifndef WILLOWC_INCLUDE_PARSER_HPP #define WILLOWC_INCLUDE_PARSER_HPP #include #include #include #include #include #include #include namespace willowc { class Parser { public: Parser(SourceManager::File &f, willow::DiagnosticEngine &diagnostic_engine) : file_(f), tokenizer_(f.buf.get()), diagnostic_engine_(diagnostic_engine) {} std::optional> run(); TokenKind kind() const { return kinds_[pos_]; } std::size_t start() const { return starts_[pos_]; } private: willow::DiagnosticBuilder emitParserError(Token t, willow::Severity severity); SourceManager::File &file_; std::vector kinds_; std::vector starts_; Tokenizer tokenizer_; std::size_t pos_; willow::DiagnosticEngine &diagnostic_engine_; }; } // namespace willowc #endif // WILLOWC_INCLUDE_PARSER_HPP