data: Saving TokenLocations in Storage
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.
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
#include <vector>
|
||||
|
||||
#include "data/graph/Graph.h"
|
||||
#include "data/location/TokenLocationCollection.h"
|
||||
#include "data/parser/ParserClient.h"
|
||||
#include "data/TextLocationFile.h"
|
||||
|
||||
class Storage: public ParserClient
|
||||
{
|
||||
@@ -38,14 +38,16 @@ public:
|
||||
virtual void onEnumFieldParsed(const ParseLocation& location, const std::string& fullName);
|
||||
|
||||
void logGraph() const;
|
||||
void logLocations() const;
|
||||
|
||||
private:
|
||||
void log(std::string type, std::string str, const ParseLocation& location) const;
|
||||
Edge::AccessType convertAccessType(ParserClient::AccessType access) const;
|
||||
TokenLocation* addTokenLocation(Token* token, const ParseLocation& location);
|
||||
|
||||
void log(std::string type, std::string str, const ParseLocation& location) const;
|
||||
|
||||
Graph m_graph;
|
||||
|
||||
std::vector<std::shared_ptr<TextLocationFile> > m_textLocationFiles;
|
||||
TokenLocationCollection m_locationCollection;
|
||||
};
|
||||
|
||||
#endif // STORAGE_H
|
||||
|
||||
Reference in New Issue
Block a user