data: showing local symbols

- added local symbols to storage
- added tests for local symbol parsing
- added MessageActivateLocalSymbols to activate local symbols in code view
- TokenLocations now store their LocationType instead of a plain bool "isScope"
- moved LocationType from TokenLocation to separate file, since it is also used in Annotations now.
- added local_symbol in stylesheet to define a style for hovering and activating these elements
- renamed location to token in stylesheet
This commit is contained in:
malte_langkabel
2016-04-12 13:28:37 +02:00
parent a448485b35
commit b9c4bd05cd
38 changed files with 767 additions and 299 deletions
+27
View File
@@ -0,0 +1,27 @@
#include "data/location/LocationType.h"
int locationTypeToInt(LocationType type)
{
switch (type)
{
case LOCATION_TOKEN:
return 0;
case LOCATION_SCOPE:
return 1;
case LOCATION_LOCAL_SYMBOL:
return 2;
}
}
LocationType intToLocationType(int value)
{
switch (value)
{
case 0:
return LOCATION_TOKEN;
case 1:
return LOCATION_SCOPE;
case 2:
return LOCATION_LOCAL_SYMBOL;
}
}
+14
View File
@@ -0,0 +1,14 @@
#ifndef LOCATION_TYPE_H
#define LOCATION_TYPE_H
enum LocationType
{
LOCATION_TOKEN,
LOCATION_SCOPE,
LOCATION_LOCAL_SYMBOL
};
int locationTypeToInt(LocationType type);
LocationType intToLocationType(int value);
#endif // LOCATION_TYPE_H
+1 -1
View File
@@ -69,7 +69,7 @@ Id TokenLocation::getTokenId() const
return m_tokenId;
}
TokenLocation::LocationType TokenLocation::getType() const
LocationType TokenLocation::getType() const
{
return m_type;
}
+1 -7
View File
@@ -5,6 +5,7 @@
#include <ostream>
#include <string>
#include "data/location/LocationType.h"
#include "utility/file/FilePath.h"
#include "utility/types.h"
@@ -15,13 +16,6 @@ class TokenLocationLine;
class TokenLocation
{
public:
enum LocationType
{
LOCATION_TOKEN,
LOCATION_SCOPE
};
TokenLocation(Id tokenId, TokenLocationLine* line, unsigned int columnNumber, bool isStart);
TokenLocation(Id locationId, Id tokenId, TokenLocationLine* line, unsigned int columnNumber, bool isStart);
TokenLocation(TokenLocation* other, TokenLocationLine* line, unsigned int columnNumber, bool isStart);
TokenLocation(const TokenLocation& other, TokenLocationLine* line);