#ifndef PARSE_CONTEXT_H #define PARSE_CONTEXT_H #include "source_error.h" #include #include /*** Represent source file */ class SourceFile { std::string fileName; std::string source; std::vector lineOffsets; public: SourceFile(std::string fileName, std::string source); const std::string &getFileName() const; std::string getLine(unsigned line) const; void addLineOffset(unsigned offset); }; /*** Represent parsing context */ class ParseContext { std::string applicationDir; std::vector fileMap; public: ParseContext(); unsigned addFile(const std::string &fileName, const std::string &source); SourceFile &getFile(unsigned file); void formatError(const SourceError &sourceError, std::ostream &stream, const std::string &errorOrWarning); }; #endif // PARSECONTEXT_H