summaryrefslogtreecommitdiff
path: root/source/slang/token.h
diff options
context:
space:
mode:
authorTim Foley <tim.foley.is@gmail.com>2017-08-14 18:50:46 -0700
committerGitHub <noreply@github.com>2017-08-14 18:50:46 -0700
commitaeb247cdf02e4dcfc0bb6839cfd291be5128f8ad (patch)
tree7314b26e21ded966b6a4fe2430f0421c0c0970bd /source/slang/token.h
parentbb66d6eddd649d8861cecefa2d6ccb7a28a827bc (diff)
parent9885c972a6bfa6f856e505cdd90d9b71fdbdadaf (diff)
Merge pull request #159 from tfoleyNV/name-type
Name type
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; }
};