leo_errors/errors/parser/parser_warnings.rs
1// Copyright (C) 2019-2025 Provable Inc.
2// This file is part of the Leo library.
3
4// The Leo library is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// The Leo library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
16
17use crate::create_messages;
18
19use std::fmt::Display;
20
21create_messages!(
22 /// ParserWarning enum that represents all the warnings for the `leo-parser` crate.
23 #[derive(Hash, PartialEq, Eq)]
24 ParserWarning,
25 code_mask: 0000i32,
26 code_prefix: "PAR",
27
28 /// For when a user used const on a parameter or input instead of constant.
29 @formatted
30 const_parameter_or_input {
31 args: (),
32 msg: "`constant` is preferred over `const` for function parameters to indicate a R1CS constant.",
33 help: None,
34 }
35
36 /// For when a keyword is deprecated but could be used as a valid identifier.
37 @formatted
38 deprecated {
39 args: (keyword: impl Display, help: impl Display),
40 msg: format!("The keyword `{keyword}` is deprecated."),
41 help: Some(help.to_string()),
42 }
43
44
45
46);