data: Saving TokenLocations of scopes separately

This change parses the TokenLocations of scopes of classes, structs, functions, methods, namespaces and enums and
saves them in Storage with type LOCATION_SCOPE. The TokenLocations of these nodes are just their name declarations now.
Scope locations are displayed in blue color in the code view.
This commit is contained in:
Eberhard Graether
2014-07-28 17:54:36 +02:00
parent 182e18840e
commit 96df63055a
18 changed files with 261 additions and 114 deletions
+23 -1
View File
@@ -56,11 +56,33 @@ std::string ParserClient::addConstPrefix(const std::string& str, bool isConst, b
std::string ParserClient::addLocationSuffix(const std::string& str, const ParseLocation& location)
{
std::stringstream ss;
ss << str << " <" << location.startLineNumber << ":" << location.startColumnNumber << " ";
ss << str;
ss << " <" << location.startLineNumber << ":" << location.startColumnNumber << " ";
ss << location.endLineNumber << ":" << location.endColumnNumber << ">";
return ss.str();
}
std::string ParserClient::addLocationSuffix(
const std::string& str, const ParseLocation& location, const ParseLocation& scopeLocation
){
if (!location.isValid())
{
return addLocationSuffix(str, scopeLocation);
}
else if (!scopeLocation.isValid())
{
return addLocationSuffix(str, location);
}
std::stringstream ss;
ss << str;
ss << " <" << scopeLocation.startLineNumber << ":" << scopeLocation.startColumnNumber;
ss << " <" << location.startLineNumber << ":" << location.startColumnNumber << " ";
ss << location.endLineNumber << ":" << location.endColumnNumber << "> ";
ss << scopeLocation.endLineNumber << ":" << scopeLocation.endColumnNumber << ">";
return ss.str();
}
std::string ParserClient::variableStr(const ParseVariable& variable)
{
std::string str = variable.type.dataType.getFullTypeName() + " " + variable.fullName;