blob: 42f7ab55f2c1e803b669b28a83369802c039e1fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// token.cpp
#include "token.h"
#include <assert.h>
namespace Slang {
Name* Token::getName() const
{
return getNameOrNull();
}
Name* Token::getNameOrNull() const
{
switch (type)
{
default:
return nullptr;
case TokenType::Identifier:
return (Name*) ptrValue;
}
}
char const* TokenTypeToString(TokenType type)
{
switch( type )
{
default:
SLANG_ASSERT(!"unexpected");
return "<uknown>";
#define TOKEN(NAME, DESC) case TokenType::NAME: return DESC;
#include "token-defs.h"
}
}
} // namespace Slang
|