1#[macro_use]
7pub mod macros;
8pub mod parse_error;
9pub mod pest_converter;
10pub mod renderer;
11
12pub mod context;
14pub mod conversions;
15pub mod formatting;
16pub mod impls;
17pub mod suggestions;
18pub mod types;
19
20pub use parse_error::{
22 ErrorSeverity, ExpectedToken, Highlight, HighlightStyle, IdentifierContext,
23 MissingComponentKind, NumberError, ParseErrorKind, RelatedInfo, SourceContext, SourceLine,
24 StringDelimiter, StructuredParseError, Suggestion, SuggestionConfidence, TextEdit,
25 TokenCategory, TokenInfo, TokenKind,
26};
27
28pub use renderer::{CliErrorRenderer, CliRendererConfig, ErrorRenderer};
30
31pub use types::{ErrorCode, ErrorNote, ShapeError, SourceLocation};
33
34pub use context::{ErrorContext, Result, ResultExt, span_to_location};
36
37#[macro_export]
39macro_rules! parse_error {
40 ($msg:expr) => {
41 $crate::error::ShapeError::ParseError {
42 message: $msg.to_string(),
43 location: None,
44 }
45 };
46 ($msg:expr, $loc:expr) => {
47 $crate::error::ShapeError::ParseError {
48 message: $msg.to_string(),
49 location: Some($loc),
50 }
51 };
52}
53
54#[macro_export]
55macro_rules! runtime_error {
56 ($msg:expr) => {
57 $crate::error::ShapeError::RuntimeError {
58 message: $msg.to_string(),
59 location: None,
60 }
61 };
62 ($msg:expr, $loc:expr) => {
63 $crate::error::ShapeError::RuntimeError {
64 message: $msg.to_string(),
65 location: Some($loc),
66 }
67 };
68}
69
70#[macro_export]
71macro_rules! semantic_error {
72 ($msg:expr) => {
73 $crate::error::ShapeError::SemanticError {
74 message: $msg.to_string(),
75 location: None,
76 }
77 };
78 ($msg:expr, $loc:expr) => {
79 $crate::error::ShapeError::SemanticError {
80 message: $msg.to_string(),
81 location: Some($loc),
82 }
83 };
84}