summaryrefslogtreecommitdiff
path: root/source/slang/token.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/token.h')
-rw-r--r--source/slang/token.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/source/slang/token.h b/source/slang/token.h
index 306d4a2f2..5967ac49a 100644
--- a/source/slang/token.h
+++ b/source/slang/token.h
@@ -8,6 +8,8 @@
namespace Slang {
+class Name;
+
enum class TokenType
{
#define TOKEN(NAME, DESC) NAME,
@@ -21,18 +23,22 @@ enum TokenFlag : unsigned int
AtStartOfLine = 1 << 0,
AfterWhitespace = 1 << 1,
SuppressMacroExpansion = 1 << 2,
+ ScrubbingNeeded = 1 << 3,
};
typedef unsigned int TokenFlags;
class Token
{
public:
- TokenType type = TokenType::Unknown;
- String Content;
- SourceLoc Position;
- TokenFlags flags = 0;
+ TokenType type = TokenType::Unknown;
+ TokenFlags flags = 0;
+
+ SourceLoc loc;
+ void* ptrValue;
+
+ String Content;
- Token() = default;
+ Token() = default;
Token(
TokenType type,
@@ -43,8 +49,15 @@ public:
{
type = type;
Content = content;
- Position = loc;
+ loc = loc;
+ ptrValue = nullptr;
}
+
+ Name* getName() const;
+
+ Name* getNameOrNull() const;
+
+ SourceLoc getLoc() const { return loc; }
};