leo_errors/errors/ast/
ast_errors.rs1use std::{
18 error::Error as ErrorArg,
19 fmt::{Debug, Display},
20};
21
22create_messages!(
23 AstError,
25 code_mask: 2000i32,
26 code_prefix: "AST",
27
28 @backtraced
30 failed_to_convert_ast_to_json_string {
31 args: (error: impl ErrorArg),
32 msg: format!("failed to convert ast to a json string {error}"),
33 help: None,
34 }
35
36 @backtraced
38 failed_to_create_ast_json_file {
39 args: (path: impl Debug, error: impl ErrorArg),
40 msg: format!("failed to create ast json file `{path:?}` {error}"),
41 help: None,
42 }
43
44 @backtraced
46 failed_to_write_ast_to_json_file {
47 args: (path: impl Debug, error: impl ErrorArg),
48 msg: format!("failed to write ast to a json file `{path:?}` {error}"),
49 help: None,
50 }
51
52 @backtraced
54 failed_to_read_json_string_to_ast {
55 args: (error: impl ErrorArg),
56 msg: format!("failed to convert json string to an ast {error}"),
57 help: None,
58 }
59
60 @backtraced
62 failed_to_read_json_file {
63 args: (path: impl Debug, error: impl ErrorArg),
64 msg: format!("failed to convert json file `{path:?}` to an ast {error}"),
65 help: None,
66 }
67
68 @backtraced
70 failed_to_convert_ast_to_json_value {
71 args: (error: impl ErrorArg),
72 msg: format!("failed to convert ast to a json value {error}"),
73 help: None,
74 }
75
76 @formatted
78 shadowed_function {
79 args: (func: impl Display),
80 msg: format!("function `{func}` shadowed by"),
81 help: None,
82 }
83
84 @formatted
86 shadowed_struct {
87 args: (struct_: impl Display),
88 msg: format!("struct `{struct_}` shadowed by"),
89 help: None,
90 }
91
92 @formatted
94 shadowed_record {
95 args: (record: impl Display),
96 msg: format!("record `{record}` shadowed by"),
97 help: None,
98 }
99
100 @formatted
102 shadowed_variable {
103 args: (var: impl Display),
104 msg: format!("variable `{var}` shadowed by"),
105 help: None,
106 }
107
108 @backtraced
110 failed_to_convert_symbol_table_to_json_string {
111 args: (error: impl ErrorArg),
112 msg: format!("failed to convert symbol_table to a json string {error}"),
113 help: None,
114 }
115
116 @backtraced
118 failed_to_create_symbol_table_json_file {
119 args: (path: impl Debug, error: impl ErrorArg),
120 msg: format!("failed to create symbol_table json file `{path:?}` {error}"),
121 help: None,
122 }
123
124 @backtraced
126 failed_to_write_symbol_table_to_json_file {
127 args: (path: impl Debug, error: impl ErrorArg),
128 msg: format!("failed to write symbol_table to a json file `{path:?}` {error}"),
129 help: None,
130 }
131
132 @backtraced
134 failed_to_read_json_string_to_symbol_table {
135 args: (error: impl ErrorArg),
136 msg: format!("failed to convert json string to an symbol_table {error}"),
137 help: None,
138 }
139
140 @backtraced
142 failed_to_convert_symbol_table_to_json_value {
143 args: (error: impl ErrorArg),
144 msg: format!("failed to convert symbol_table to a json value {error}"),
145 help: None,
146 }
147
148 @formatted
149 redefining_external_struct {
150 args: (struct_: impl Display),
151 msg: format!("There are two definitions of struct `{struct_}` that do not match."),
152 help: Some("Check the import files to see if there are any struct definitions of the same name.".to_string()),
153 }
154
155 @backtraced
156 function_not_found {
157 args: (func: impl Display),
158 msg: format!("function `{func}` not found"),
159 help: None,
160 }
161
162 @formatted
163 name_defined_multiple_times {
164 args: (name: impl Display),
165 msg: format!("The name `{name}` is defined multiple times."),
166 help: None,
167 }
168);