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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user