1 | //===- TokenKinds.def - MLIR Token Description ------------------*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | // |
9 | // This file is intended to be #include'd multiple times to extract information |
10 | // about tokens for various clients in the lexer. |
11 | // |
12 | //===----------------------------------------------------------------------===// |
13 | |
14 | #if !defined(TOK_MARKER) && !defined(TOK_IDENTIFIER) && \ |
15 | !defined(TOK_LITERAL) && !defined(TOK_PUNCTUATION) && \ |
16 | !defined(TOK_KEYWORD) |
17 | #error Must define one of the TOK_ macros. |
18 | #endif |
19 | |
20 | #ifndef TOK_MARKER |
21 | #define TOK_MARKER(X) |
22 | #endif |
23 | #ifndef TOK_IDENTIFIER |
24 | #define TOK_IDENTIFIER(NAME) |
25 | #endif |
26 | #ifndef TOK_LITERAL |
27 | #define TOK_LITERAL(NAME) |
28 | #endif |
29 | #ifndef TOK_PUNCTUATION |
30 | #define TOK_PUNCTUATION(NAME, SPELLING) |
31 | #endif |
32 | #ifndef TOK_KEYWORD |
33 | #define TOK_KEYWORD(SPELLING) |
34 | #endif |
35 | |
36 | // Markers |
37 | TOK_MARKER(eof) |
38 | TOK_MARKER(error) |
39 | TOK_MARKER(code_complete) |
40 | |
41 | // Identifiers. |
42 | TOK_IDENTIFIER(bare_identifier) // foo |
43 | TOK_IDENTIFIER(at_identifier) // @foo |
44 | TOK_IDENTIFIER(hash_identifier) // #foo |
45 | TOK_IDENTIFIER(percent_identifier) // %foo |
46 | TOK_IDENTIFIER(caret_identifier) // ^foo |
47 | TOK_IDENTIFIER(exclamation_identifier) // !foo |
48 | |
49 | // Literals |
50 | TOK_LITERAL(floatliteral) // 2.0 |
51 | TOK_LITERAL(integer) // 42 |
52 | TOK_LITERAL(string) // "foo" |
53 | TOK_LITERAL(inttype) // i4, si8, ui16 |
54 | |
55 | // Punctuation. |
56 | TOK_PUNCTUATION(arrow, "->" ) |
57 | TOK_PUNCTUATION(at, "@" ) |
58 | TOK_PUNCTUATION(colon, ":" ) |
59 | TOK_PUNCTUATION(comma, "," ) |
60 | TOK_PUNCTUATION(ellipsis, "..." ) |
61 | TOK_PUNCTUATION(equal, "=" ) |
62 | TOK_PUNCTUATION(greater, ">" ) |
63 | TOK_PUNCTUATION(l_brace, "{" ) |
64 | TOK_PUNCTUATION(l_paren, "(" ) |
65 | TOK_PUNCTUATION(l_square, "[" ) |
66 | TOK_PUNCTUATION(less, "<" ) |
67 | TOK_PUNCTUATION(minus, "-" ) |
68 | TOK_PUNCTUATION(plus, "+" ) |
69 | TOK_PUNCTUATION(question, "?" ) |
70 | TOK_PUNCTUATION(r_brace, "}" ) |
71 | TOK_PUNCTUATION(r_paren, ")" ) |
72 | TOK_PUNCTUATION(r_square, "]" ) |
73 | TOK_PUNCTUATION(star, "*" ) |
74 | TOK_PUNCTUATION(vertical_bar, "|" ) |
75 | |
76 | TOK_PUNCTUATION(file_metadata_begin, "{-#" ) |
77 | TOK_PUNCTUATION(file_metadata_end, "#-}" ) |
78 | |
79 | // Keywords. These turn "foo" into Token::kw_foo enums. |
80 | |
81 | // NOTE: Please key these alphabetized to make it easier to find something in |
82 | // this list and to cater to OCD. |
83 | TOK_KEYWORD(affine_map) |
84 | TOK_KEYWORD(affine_set) |
85 | TOK_KEYWORD(array) |
86 | TOK_KEYWORD(attributes) |
87 | TOK_KEYWORD(bf16) |
88 | TOK_KEYWORD(ceildiv) |
89 | TOK_KEYWORD(complex) |
90 | TOK_KEYWORD(dense) |
91 | TOK_KEYWORD(dense_resource) |
92 | TOK_KEYWORD(distinct) |
93 | TOK_KEYWORD(f16) |
94 | TOK_KEYWORD(f32) |
95 | TOK_KEYWORD(f64) |
96 | TOK_KEYWORD(f80) |
97 | TOK_KEYWORD(f8E5M2) |
98 | TOK_KEYWORD(f8E4M3FN) |
99 | TOK_KEYWORD(f8E5M2FNUZ) |
100 | TOK_KEYWORD(f8E4M3FNUZ) |
101 | TOK_KEYWORD(f8E4M3B11FNUZ) |
102 | TOK_KEYWORD(f128) |
103 | TOK_KEYWORD(false) |
104 | TOK_KEYWORD(floordiv) |
105 | TOK_KEYWORD(for) |
106 | TOK_KEYWORD(func) |
107 | TOK_KEYWORD(index) |
108 | TOK_KEYWORD(loc) |
109 | TOK_KEYWORD(max) |
110 | TOK_KEYWORD(memref) |
111 | TOK_KEYWORD(min) |
112 | TOK_KEYWORD(mod) |
113 | TOK_KEYWORD(none) |
114 | TOK_KEYWORD(offset) |
115 | TOK_KEYWORD(size) |
116 | TOK_KEYWORD(sparse) |
117 | TOK_KEYWORD(step) |
118 | TOK_KEYWORD(strided) |
119 | TOK_KEYWORD(symbol) |
120 | TOK_KEYWORD(tensor) |
121 | TOK_KEYWORD(tf32) |
122 | TOK_KEYWORD(to) |
123 | TOK_KEYWORD(true) |
124 | TOK_KEYWORD(tuple) |
125 | TOK_KEYWORD(type) |
126 | TOK_KEYWORD(unit) |
127 | TOK_KEYWORD(vector) |
128 | |
129 | #undef TOK_MARKER |
130 | #undef TOK_IDENTIFIER |
131 | #undef TOK_LITERAL |
132 | #undef TOK_PUNCTUATION |
133 | #undef TOK_KEYWORD |
134 | |