Coverage Report

Created: 2026-06-05 03:56

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/Users/runner/work/slang/slang/source/compiler-core/slang-token-defs.h
Line
Count
Source
1
// slang-token-defs.h
2
3
// This file is meant to be included multiple times, to produce different
4
// pieces of code related to tokens
5
//
6
// Each token is declared here with:
7
//
8
//      TOKEN(id, desc)
9
//
10
// where `id` is the identifier that will be used for the token in
11
// ordinary code, while `desc` is name we should print when
12
// referring to this token in diagnostic messages.
13
14
15
#ifndef TOKEN
16
#error Need to define TOKEN(ID, DESC) before including "token-defs.h"
17
#endif
18
19
0
TOKEN(Unknown, "<unknown>")
20
17
TOKEN(EndOfFile, "end of file")
21
0
TOKEN(Invalid, "invalid character")
22
77
TOKEN(Identifier, "identifier")
23
10
TOKEN(IntegerLiteral, "integer literal")
24
0
TOKEN(FloatingPointLiteral, "floating-point literal")
25
3
TOKEN(StringLiteral, "string literal")
26
0
TOKEN(CharLiteral, "character literal")
27
0
TOKEN(WhiteSpace, "whitespace")
28
0
TOKEN(NewLine, "end of line")
29
0
TOKEN(LineComment, "line comment")
30
0
TOKEN(BlockComment, "block comment")
31
32
109
#define PUNCTUATION(id, text) TOKEN(id, "'" text "'")
33
34
33
PUNCTUATION(Semicolon, ";")
35
7
PUNCTUATION(Comma, ",")
36
0
PUNCTUATION(Dot, ".")
37
0
PUNCTUATION(DotDot, "..")
38
0
PUNCTUATION(Ellipsis, "...")
39
40
5
PUNCTUATION(LBrace, "{")
41
11
PUNCTUATION(RBrace, "}")
42
0
PUNCTUATION(LBracket, "[")
43
2
PUNCTUATION(RBracket, "]")
44
5
PUNCTUATION(LParent, "(")
45
10
PUNCTUATION(RParent, ")")
46
47
3
PUNCTUATION(OpAssign, "=")
48
0
PUNCTUATION(OpAdd, "+")
49
0
PUNCTUATION(OpSub, "-")
50
1
PUNCTUATION(OpMul, "*")
51
0
PUNCTUATION(OpDiv, "/")
52
1
PUNCTUATION(OpMod, "%")
53
0
PUNCTUATION(OpNot, "!")
54
0
PUNCTUATION(OpBitNot, "~")
55
0
PUNCTUATION(OpLsh, "<<")
56
0
PUNCTUATION(OpRsh, ">>")
57
0
PUNCTUATION(OpEql, "==")
58
0
PUNCTUATION(OpNeq, "!=")
59
4
PUNCTUATION(OpGreater, ">")
60
1
PUNCTUATION(OpLess, "<")
61
0
PUNCTUATION(OpGeq, ">=")
62
0
PUNCTUATION(OpLeq, "<=")
63
0
PUNCTUATION(OpAnd, "&&")
64
0
PUNCTUATION(OpOr, "||")
65
0
PUNCTUATION(OpBitAnd, "&")
66
1
PUNCTUATION(OpBitOr, "|")
67
0
PUNCTUATION(OpBitXor, "^")
68
1
PUNCTUATION(OpInc, "++")
69
0
PUNCTUATION(OpDec, "--")
70
71
0
PUNCTUATION(OpAddAssign, "+=")
72
0
PUNCTUATION(OpSubAssign, "-=")
73
0
PUNCTUATION(OpMulAssign, "*=")
74
0
PUNCTUATION(OpDivAssign, "/=")
75
0
PUNCTUATION(OpModAssign, "%=")
76
0
PUNCTUATION(OpShlAssign, "<<=")
77
0
PUNCTUATION(OpShrAssign, ">>=")
78
0
PUNCTUATION(OpAndAssign, "&=")
79
0
PUNCTUATION(OpOrAssign, "|=")
80
0
PUNCTUATION(OpXorAssign, "^=")
81
82
0
PUNCTUATION(QuestionMark, "?")
83
1
PUNCTUATION(Colon, ":")
84
0
PUNCTUATION(RightArrow, "->")
85
0
PUNCTUATION(DoubleRightArrow, "=>")
86
2
PUNCTUATION(At, "@")
87
0
PUNCTUATION(Dollar, "$")
88
1
PUNCTUATION(DollarDollar, "$$")
89
0
PUNCTUATION(Pound, "#")
90
0
PUNCTUATION(PoundPound, "##")
91
92
0
PUNCTUATION(Scope, "::")
93
94
20
PUNCTUATION(CompletionRequest, "#?")
95
96
20
#undef PUNCTUATION
97
98
// Un-define the `TOKEN` macro so that client doesn't have to
99
20
#undef TOKEN