This change adds structures for saving TokenLocations in the Storage and improves the location derival in the ASTVisitor: * TokenLocation saves an Id of a Token. For each Token two TokenLocations are created for both start- and endpoint. They keep a reference to each other and know whether they are start or end. * TokenLocationLine saves all TokenLocations in a line and the lineNumber. * TokenLocationFile saves all TokenLocationLines of a specific file and the filePath. * TokenLocationCollection saves multiple TokenLocationFiles. * TokenLocation can derive it's lineNumber and filePath through references to first TokenLocationLine and from there to TokenLocationFile.
21 lines
450 B
C++
21 lines
450 B
C++
#ifndef PARSE_LOCATION_H
|
|
#define PARSE_LOCATION_H
|
|
|
|
#include <string>
|
|
|
|
struct ParseLocation
|
|
{
|
|
ParseLocation(
|
|
const std::string& filePath,
|
|
unsigned int startLineNumber, unsigned int startColumnNumber,
|
|
unsigned int endLineNumber, unsigned int endColumnNumber);
|
|
|
|
const std::string filePath;
|
|
unsigned int startLineNumber;
|
|
unsigned int startColumnNumber;
|
|
unsigned int endLineNumber;
|
|
unsigned int endColumnNumber;
|
|
};
|
|
|
|
#endif // PARSE_LOCATION_H
|