1use llmcc_core::define_tokens;
2use llmcc_core::graph_builder::BlockKind;
3use llmcc_core::ir::HirKind;
4use llmcc_core::paste;
5use llmcc_core::{Parser, Tree};
6
7define_tokens! {
8 Rust,
9 (Text_fn , 96 , "fn" , HirKind::Text),
11 (Text_LPAREN , 4 , "(" , HirKind::Text),
12 (Text_RPAREN , 5 , ")" , HirKind::Text),
13 (Text_LBRACE , 8 , "{" , HirKind::Text),
14 (Text_RBRACE , 9 , "}" , HirKind::Text),
15 (Text_let , 101 , "let" , HirKind::Text),
16 (Text_EQ , 70 , "=" , HirKind::Text),
17 (Text_SEMI , 2 , ";" , HirKind::Text),
18 (Text_COLON , 11 , ":" , HirKind::Text),
19 (Text_COMMA , 83 , "," , HirKind::Text),
20 (Text_ARROW , 85 , "->" , HirKind::Text),
21
22 (integer_literal , 127 , "integer_literal" , HirKind::Text),
24 (type_identifier , 354 , "type_identifier" , HirKind::Identifier),
25 (scoped_identifier , 243 , "scoped_identifier" , HirKind::Identifier),
26 (field_identifier , 351 , "field_identifier" , HirKind::Identifier),
27 (identifier , 1 , "identifier" , HirKind::Identifier),
28 (parameter , 213 , "parameter" , HirKind::Internal),
29 (parameters , 210 , "parameters" , HirKind::Internal),
30 (let_declaration , 203 , "let_declaration" , HirKind::Internal),
31 (field_declaration , 182 , "field_declaration" , HirKind::Internal, BlockKind::Field),
32 (block , 293 , "block" , HirKind::Scope, BlockKind::Scope),
33 (source_file , 157 , "source_file" , HirKind::File, BlockKind::Root),
34 (mod_item , 173 , "mod_item" , HirKind::Scope, BlockKind::Scope),
35 (struct_item , 176 , "struct_item" , HirKind::Scope, BlockKind::Class),
36 (enum_item , 178 , "enum_item" , HirKind::Scope, BlockKind::Enum),
37 (enum_variant_list , 179 , "enum_variant_list" , HirKind::Internal),
38 (enum_variant , 180 , "enum_variant" , HirKind::Identifier),
39 (impl_item , 193 , "impl_item" , HirKind::Scope, BlockKind::Impl),
40 (trait_item , 194 , "trait_item" , HirKind::Scope, BlockKind::Scope),
41 (const_item , 185 , "const_item" , HirKind::Scope, BlockKind::Const),
42 (static_item , 186 , "static_item" , HirKind::Scope, BlockKind::Const),
43 (function_item , 188 , "function_item" , HirKind::Scope, BlockKind::Func),
44 (mutable_specifier , 122 , "mutable_specifier" , HirKind::Text),
45 (expression_statement , 160 , "expression_statement" , HirKind::Internal),
46 (assignment_expression , 251 , "assignment_expression" , HirKind::Internal),
47 (binary_expression , 250 , "binary_expression" , HirKind::Internal),
48 (operator , 14 , "operator" , HirKind::Internal),
49 (call_expression , 256 , "call_expression" , HirKind::Internal, BlockKind::Call),
50 (arguments , 257 , "arguments" , HirKind::Internal),
51 (primitive_type , 32 , "primitive_type" , HirKind::Identifier),
52
53 (field_name , 19 , "name" , HirKind::Internal),
55 (field_type , 28 , "type" , HirKind::Internal),
56 (field_pattern , 24 , "pattern" , HirKind::Internal),
57 (field_return_type , 25 , "return_type" , HirKind::Internal),
58 (field_parameters , 22 , "parameters" , HirKind::Internal),
59}