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
37TOK_MARKER(eof)
38TOK_MARKER(error)
39TOK_MARKER(code_complete)
40
41// Identifiers.
42TOK_IDENTIFIER(bare_identifier) // foo
43TOK_IDENTIFIER(at_identifier) // @foo
44TOK_IDENTIFIER(hash_identifier) // #foo
45TOK_IDENTIFIER(percent_identifier) // %foo
46TOK_IDENTIFIER(caret_identifier) // ^foo
47TOK_IDENTIFIER(exclamation_identifier) // !foo
48
49// Literals
50TOK_LITERAL(floatliteral) // 2.0
51TOK_LITERAL(integer) // 42
52TOK_LITERAL(string) // "foo"
53TOK_LITERAL(inttype) // i4, si8, ui16
54
55// Punctuation.
56TOK_PUNCTUATION(arrow, "->")
57TOK_PUNCTUATION(at, "@")
58TOK_PUNCTUATION(colon, ":")
59TOK_PUNCTUATION(comma, ",")
60TOK_PUNCTUATION(ellipsis, "...")
61TOK_PUNCTUATION(equal, "=")
62TOK_PUNCTUATION(greater, ">")
63TOK_PUNCTUATION(l_brace, "{")
64TOK_PUNCTUATION(l_paren, "(")
65TOK_PUNCTUATION(l_square, "[")
66TOK_PUNCTUATION(less, "<")
67TOK_PUNCTUATION(minus, "-")
68TOK_PUNCTUATION(plus, "+")
69TOK_PUNCTUATION(question, "?")
70TOK_PUNCTUATION(r_brace, "}")
71TOK_PUNCTUATION(r_paren, ")")
72TOK_PUNCTUATION(r_square, "]")
73TOK_PUNCTUATION(star, "*")
74TOK_PUNCTUATION(vertical_bar, "|")
75
76TOK_PUNCTUATION(file_metadata_begin, "{-#")
77TOK_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.
83TOK_KEYWORD(affine_map)
84TOK_KEYWORD(affine_set)
85TOK_KEYWORD(array)
86TOK_KEYWORD(attributes)
87TOK_KEYWORD(bf16)
88TOK_KEYWORD(ceildiv)
89TOK_KEYWORD(complex)
90TOK_KEYWORD(dense)
91TOK_KEYWORD(dense_resource)
92TOK_KEYWORD(distinct)
93TOK_KEYWORD(f16)
94TOK_KEYWORD(f32)
95TOK_KEYWORD(f64)
96TOK_KEYWORD(f80)
97TOK_KEYWORD(f8E5M2)
98TOK_KEYWORD(f8E4M3FN)
99TOK_KEYWORD(f8E5M2FNUZ)
100TOK_KEYWORD(f8E4M3FNUZ)
101TOK_KEYWORD(f8E4M3B11FNUZ)
102TOK_KEYWORD(f128)
103TOK_KEYWORD(false)
104TOK_KEYWORD(floordiv)
105TOK_KEYWORD(for)
106TOK_KEYWORD(func)
107TOK_KEYWORD(index)
108TOK_KEYWORD(loc)
109TOK_KEYWORD(max)
110TOK_KEYWORD(memref)
111TOK_KEYWORD(min)
112TOK_KEYWORD(mod)
113TOK_KEYWORD(none)
114TOK_KEYWORD(offset)
115TOK_KEYWORD(size)
116TOK_KEYWORD(sparse)
117TOK_KEYWORD(step)
118TOK_KEYWORD(strided)
119TOK_KEYWORD(symbol)
120TOK_KEYWORD(tensor)
121TOK_KEYWORD(tf32)
122TOK_KEYWORD(to)
123TOK_KEYWORD(true)
124TOK_KEYWORD(tuple)
125TOK_KEYWORD(type)
126TOK_KEYWORD(unit)
127TOK_KEYWORD(vector)
128
129#undef TOK_MARKER
130#undef TOK_IDENTIFIER
131#undef TOK_LITERAL
132#undef TOK_PUNCTUATION
133#undef TOK_KEYWORD
134

source code of mlir/lib/AsmParser/TokenKinds.def