43 lines
939 B
C
43 lines
939 B
C
|
#ifndef PARSECONTEXT_H
|
||
|
#define PARSECONTEXT_H
|
||
|
|
||
|
|
||
|
#include "sourceerror.h"
|
||
|
|
||
|
#include <string>
|
||
|
#include <vector>
|
||
|
|
||
|
|
||
|
class SourceFile {
|
||
|
std::string fileName;
|
||
|
std::string source;
|
||
|
std::vector<unsigned> lineOffsets;
|
||
|
|
||
|
public:
|
||
|
// qqq source je CIJELI comdel fajl,
|
||
|
// za inicijalizaciju source se koristi std::move, a možda treba biti referenca???
|
||
|
SourceFile(std::string fileName, std::string source);
|
||
|
|
||
|
const std::string& getFileName() const;
|
||
|
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
|