schema_editor/comdel/parser/parse_context.h

42 lines
809 B
C++

#ifndef PARSE_CONTEXT_H
#define PARSE_CONTEXT_H
#include "source_error.h"
#include <string>
#include <vector>
class SourceFile {
std::string fileName;
std::string source;
std::vector<unsigned> lineOffsets;
public:
SourceFile(std::string fileName, std::string source);
const std::string &getFileName() const;
std::string getLine(unsigned line) const;
void addLineOffset(unsigned offset);
};
class ParseContext {
std::string applicationDir;
std::vector<SourceFile> 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