1 //===- TokenKinds.def
- MLIR Token Description
------------------*- C
++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file is intended to be #include
'd multiple times to extract information
10 // about tokens for various clients in the lexer.
12 //===----------------------------------------------------------------------===//
14 #if !defined(TOK_MARKER) && !defined(TOK_IDENTIFIER) && \
15 !defined(TOK_LITERAL) && !defined(TOK_PUNCTUATION) && \
17 #error Must define one of the TOK_ macros.
23 #ifndef TOK_IDENTIFIER
24 #define TOK_IDENTIFIER(NAME)
27 #define TOK_LITERAL(NAME)
29 #ifndef TOK_PUNCTUATION
30 #define TOK_PUNCTUATION(NAME, SPELLING)
33 #define TOK_KEYWORD(SPELLING)
39 TOK_MARKER(code_complete)
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
50 TOK_LITERAL(floatliteral) // 2.0
51 TOK_LITERAL(integer) // 42
52 TOK_LITERAL(string) // "foo"
53 TOK_LITERAL(inttype) // i4, si8, ui16
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, "|")
76 TOK_PUNCTUATION(file_metadata_begin, "{-#")
77 TOK_PUNCTUATION(file_metadata_end, "#-}")
79 // Keywords. These turn "foo" into Token::kw_foo enums.
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)
86 TOK_KEYWORD(attributes)
91 TOK_KEYWORD(dense_resource)
100 TOK_KEYWORD(f8E5M2FNUZ)
101 TOK_KEYWORD(f8E4M3FNUZ)
102 TOK_KEYWORD(f8E4M3B11FNUZ)
104 TOK_KEYWORD(f4E2M1FN)
105 TOK_KEYWORD(f6E2M3FN)
106 TOK_KEYWORD(f6E3M2FN)
107 TOK_KEYWORD(f8E8M0FNU)
110 TOK_KEYWORD(floordiv)
136 #undef TOK_IDENTIFIER
138 #undef TOK_PUNCTUATION