summaryrefslogtreecommitdiff
path: root/source/slang/token.h
diff options
context:
space:
mode:
authorTim Foley <tim.foley.is@gmail.com>2017-08-10 15:25:04 -0700
committerGitHub <noreply@github.com>2017-08-10 15:25:04 -0700
commitdb4079f7e3635a6a61b8725643b1d7ecf68b97d8 (patch)
tree224c16ad374c5ed533a497beeb75753e7ce2d771 /source/slang/token.h
parent6e4830f4d74adef0a47c6503d84dc114240fafa3 (diff)
parenta5a436c4783fb75a0d089a6483219c06db91f593 (diff)
Merge pull request #156 from tfoleyNV/source-file-cleanup
Make source location lightweight
Diffstat (limited to 'source/slang/token.h')
-rw-r--r--source/slang/token.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/slang/token.h b/source/slang/token.h
index f29f2b4c6..306d4a2f2 100644
--- a/source/slang/token.h
+++ b/source/slang/token.h
@@ -18,8 +18,9 @@ char const* TokenTypeToString(TokenType type);
enum TokenFlag : unsigned int
{
- AtStartOfLine = 1 << 0,
- AfterWhitespace = 1 << 1,
+ AtStartOfLine = 1 << 0,
+ AfterWhitespace = 1 << 1,
+ SuppressMacroExpansion = 1 << 2,
};
typedef unsigned int TokenFlags;
@@ -28,15 +29,21 @@ class Token
public:
TokenType type = TokenType::Unknown;
String Content;
- CodePosition Position;
+ SourceLoc Position;
TokenFlags flags = 0;
+
Token() = default;
- Token(TokenType type, const String & content, int line, int col, int pos, String fileName, TokenFlags flags = 0)
+
+ Token(
+ TokenType type,
+ const String & content,
+ SourceLoc loc,
+ TokenFlags flags = 0)
: flags(flags)
{
type = type;
Content = content;
- Position = CodePosition(line, col, pos, fileName);
+ Position = loc;
}
};