1use crate::{Location, Position, Token};
5use crate::style::Colorize;
6
7fn escape_string(s: &str) -> String {
8 s.replace('\\', "\\\\")
9 .replace('\n', "\\n")
10 .replace('\r', "\\r")
11 .replace('\t', "\\t")
12 .replace('"', "\\\"")
13}
14
15fn format_string_value(value: &str) -> String {
16 format!("\"{}\"", escape_string(value)).green().to_string()
17}
18
19fn format_token_value(token: &Option<Token>) -> String {
20 token.as_ref().map(|t| t.tree_inspect()).unwrap_or_else(|| "∅".magenta().to_string())
21}
22
23fn format_token_type_value(token_type: &Option<String>) -> String {
24 token_type.as_ref().map(|t| format!("\"{}\"", t).green().to_string()).unwrap_or_else(|| "∅".magenta().to_string())
25}
26
27#[allow(dead_code)]
28fn format_position_value(position: &Option<crate::Position>) -> String {
29 position.as_ref().map(|p| p.to_string()).unwrap_or_else(|| "∅".magenta().to_string())
30}
31
32#[allow(dead_code)]
33fn format_size_value(value: usize) -> String {
34 value.to_string().magenta().bold().to_string()
35}
36
37#[derive(Debug, Clone, PartialEq)]
38pub enum ErrorType {
39 UnexpectedError,
40 UnexpectedTokenError,
41 MissingOpeningTagError,
42 MissingClosingTagError,
43 TagNamesMismatchError,
44 VoidElementClosingTagError,
45 UnclosedElementError,
46 RubyParseError,
47 ERBControlFlowScopeError,
48 MissingERBEndTagError,
49 ERBMultipleBlocksInTagError,
50 ERBCaseWithConditionsError,
51 ERBCaseInlinePatternMatchError,
52 ConditionalElementMultipleTagsError,
53 ConditionalElementConditionMismatchError,
54 UnclosedCommentError,
55 NestedCommentError,
56 InvalidCommentClosingTagError,
57 OmittedClosingTagError,
58 UnclosedOpenTagError,
59 UnclosedCloseTagError,
60 EndTagWithTrailingSolidusError,
61 UnclosedQuoteError,
62 MissingAttributeValueError,
63 MissingWhitespaceBetweenAttributesError,
64 UnexpectedCharacterInAttributeNameError,
65 UnexpectedCharacterInUnquotedAttributeValueError,
66 UnexpectedEqualsSignBeforeAttributeNameError,
67 UnexpectedSolidusInTagError,
68 UnclosedERBTagError,
69 MalformedERBClosingTagError,
70 StrayERBClosingTagError,
71 NestedERBTagError,
72 RenderAmbiguousLocalsError,
73 RenderMissingLocalsError,
74 RenderNoArgumentsError,
75 RenderConflictingPartialError,
76 RenderInvalidAsOptionError,
77 RenderObjectAndCollectionError,
78 RenderLayoutWithoutBlockError,
79 StrictLocalsPositionalArgumentError,
80 StrictLocalsBlockArgumentError,
81 StrictLocalsSplatArgumentError,
82 StrictLocalsMissingParenthesisError,
83 StrictLocalsDuplicateDeclarationError,
84 HerbStateMissingParenthesisError,
85 HerbStateNonCanonicalDirectiveError,
86 HerbStateInvalidParameterError,
87 HerbStateDuplicateDeclarationError,
88 VoidElementContentError,
89 DotNotationCasingError,
90 TimeoutError,
91}
92
93impl ErrorType {
94 pub fn as_str(&self) -> &str {
95 match self {
96 ErrorType::UnexpectedError => "UNEXPECTED_ERROR",
97 ErrorType::UnexpectedTokenError => "UNEXPECTED_TOKEN_ERROR",
98 ErrorType::MissingOpeningTagError => "MISSING_OPENING_TAG_ERROR",
99 ErrorType::MissingClosingTagError => "MISSING_CLOSING_TAG_ERROR",
100 ErrorType::TagNamesMismatchError => "TAG_NAMES_MISMATCH_ERROR",
101 ErrorType::VoidElementClosingTagError => "VOID_ELEMENT_CLOSING_TAG_ERROR",
102 ErrorType::UnclosedElementError => "UNCLOSED_ELEMENT_ERROR",
103 ErrorType::RubyParseError => "RUBY_PARSE_ERROR",
104 ErrorType::ERBControlFlowScopeError => "ERB_CONTROL_FLOW_SCOPE_ERROR",
105 ErrorType::MissingERBEndTagError => "MISSING_ERB_END_TAG_ERROR",
106 ErrorType::ERBMultipleBlocksInTagError => "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR",
107 ErrorType::ERBCaseWithConditionsError => "ERB_CASE_WITH_CONDITIONS_ERROR",
108 ErrorType::ERBCaseInlinePatternMatchError => "ERB_CASE_INLINE_PATTERN_MATCH_ERROR",
109 ErrorType::ConditionalElementMultipleTagsError => "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR",
110 ErrorType::ConditionalElementConditionMismatchError => "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR",
111 ErrorType::UnclosedCommentError => "UNCLOSED_COMMENT_ERROR",
112 ErrorType::NestedCommentError => "NESTED_COMMENT_ERROR",
113 ErrorType::InvalidCommentClosingTagError => "INVALID_COMMENT_CLOSING_TAG_ERROR",
114 ErrorType::OmittedClosingTagError => "OMITTED_CLOSING_TAG_ERROR",
115 ErrorType::UnclosedOpenTagError => "UNCLOSED_OPEN_TAG_ERROR",
116 ErrorType::UnclosedCloseTagError => "UNCLOSED_CLOSE_TAG_ERROR",
117 ErrorType::EndTagWithTrailingSolidusError => "END_TAG_WITH_TRAILING_SOLIDUS_ERROR",
118 ErrorType::UnclosedQuoteError => "UNCLOSED_QUOTE_ERROR",
119 ErrorType::MissingAttributeValueError => "MISSING_ATTRIBUTE_VALUE_ERROR",
120 ErrorType::MissingWhitespaceBetweenAttributesError => "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES_ERROR",
121 ErrorType::UnexpectedCharacterInAttributeNameError => "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME_ERROR",
122 ErrorType::UnexpectedCharacterInUnquotedAttributeValueError => "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE_ERROR",
123 ErrorType::UnexpectedEqualsSignBeforeAttributeNameError => "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME_ERROR",
124 ErrorType::UnexpectedSolidusInTagError => "UNEXPECTED_SOLIDUS_IN_TAG_ERROR",
125 ErrorType::UnclosedERBTagError => "UNCLOSED_ERB_TAG_ERROR",
126 ErrorType::MalformedERBClosingTagError => "MALFORMED_ERB_CLOSING_TAG_ERROR",
127 ErrorType::StrayERBClosingTagError => "STRAY_ERB_CLOSING_TAG_ERROR",
128 ErrorType::NestedERBTagError => "NESTED_ERB_TAG_ERROR",
129 ErrorType::RenderAmbiguousLocalsError => "RENDER_AMBIGUOUS_LOCALS_ERROR",
130 ErrorType::RenderMissingLocalsError => "RENDER_MISSING_LOCALS_ERROR",
131 ErrorType::RenderNoArgumentsError => "RENDER_NO_ARGUMENTS_ERROR",
132 ErrorType::RenderConflictingPartialError => "RENDER_CONFLICTING_PARTIAL_ERROR",
133 ErrorType::RenderInvalidAsOptionError => "RENDER_INVALID_AS_OPTION_ERROR",
134 ErrorType::RenderObjectAndCollectionError => "RENDER_OBJECT_AND_COLLECTION_ERROR",
135 ErrorType::RenderLayoutWithoutBlockError => "RENDER_LAYOUT_WITHOUT_BLOCK_ERROR",
136 ErrorType::StrictLocalsPositionalArgumentError => "STRICT_LOCALS_POSITIONAL_ARGUMENT_ERROR",
137 ErrorType::StrictLocalsBlockArgumentError => "STRICT_LOCALS_BLOCK_ARGUMENT_ERROR",
138 ErrorType::StrictLocalsSplatArgumentError => "STRICT_LOCALS_SPLAT_ARGUMENT_ERROR",
139 ErrorType::StrictLocalsMissingParenthesisError => "STRICT_LOCALS_MISSING_PARENTHESIS_ERROR",
140 ErrorType::StrictLocalsDuplicateDeclarationError => "STRICT_LOCALS_DUPLICATE_DECLARATION_ERROR",
141 ErrorType::HerbStateMissingParenthesisError => "HERB_STATE_MISSING_PARENTHESIS_ERROR",
142 ErrorType::HerbStateNonCanonicalDirectiveError => "HERB_STATE_NON_CANONICAL_DIRECTIVE_ERROR",
143 ErrorType::HerbStateInvalidParameterError => "HERB_STATE_INVALID_PARAMETER_ERROR",
144 ErrorType::HerbStateDuplicateDeclarationError => "HERB_STATE_DUPLICATE_DECLARATION_ERROR",
145 ErrorType::VoidElementContentError => "VOID_ELEMENT_CONTENT_ERROR",
146 ErrorType::DotNotationCasingError => "DOT_NOTATION_CASING_ERROR",
147 ErrorType::TimeoutError => "TIMEOUT_ERROR",
148 }
149 }
150}
151
152pub trait ErrorNode {
153 fn error_type(&self) -> &str;
154 fn message(&self) -> &str;
155 fn location(&self) -> &Location;
156 fn tree_inspect(&self) -> String;
157}
158
159#[derive(Debug, Clone)]
160pub enum AnyError {
161 UnexpectedError(UnexpectedError),
162 UnexpectedTokenError(UnexpectedTokenError),
163 MissingOpeningTagError(MissingOpeningTagError),
164 MissingClosingTagError(MissingClosingTagError),
165 TagNamesMismatchError(TagNamesMismatchError),
166 VoidElementClosingTagError(VoidElementClosingTagError),
167 UnclosedElementError(UnclosedElementError),
168 RubyParseError(RubyParseError),
169 ERBControlFlowScopeError(ERBControlFlowScopeError),
170 MissingERBEndTagError(MissingERBEndTagError),
171 ERBMultipleBlocksInTagError(ERBMultipleBlocksInTagError),
172 ERBCaseWithConditionsError(ERBCaseWithConditionsError),
173 ERBCaseInlinePatternMatchError(ERBCaseInlinePatternMatchError),
174 ConditionalElementMultipleTagsError(ConditionalElementMultipleTagsError),
175 ConditionalElementConditionMismatchError(ConditionalElementConditionMismatchError),
176 UnclosedCommentError(UnclosedCommentError),
177 NestedCommentError(NestedCommentError),
178 InvalidCommentClosingTagError(InvalidCommentClosingTagError),
179 OmittedClosingTagError(OmittedClosingTagError),
180 UnclosedOpenTagError(UnclosedOpenTagError),
181 UnclosedCloseTagError(UnclosedCloseTagError),
182 EndTagWithTrailingSolidusError(EndTagWithTrailingSolidusError),
183 UnclosedQuoteError(UnclosedQuoteError),
184 MissingAttributeValueError(MissingAttributeValueError),
185 MissingWhitespaceBetweenAttributesError(MissingWhitespaceBetweenAttributesError),
186 UnexpectedCharacterInAttributeNameError(UnexpectedCharacterInAttributeNameError),
187 UnexpectedCharacterInUnquotedAttributeValueError(UnexpectedCharacterInUnquotedAttributeValueError),
188 UnexpectedEqualsSignBeforeAttributeNameError(UnexpectedEqualsSignBeforeAttributeNameError),
189 UnexpectedSolidusInTagError(UnexpectedSolidusInTagError),
190 UnclosedERBTagError(UnclosedERBTagError),
191 MalformedERBClosingTagError(MalformedERBClosingTagError),
192 StrayERBClosingTagError(StrayERBClosingTagError),
193 NestedERBTagError(NestedERBTagError),
194 RenderAmbiguousLocalsError(RenderAmbiguousLocalsError),
195 RenderMissingLocalsError(RenderMissingLocalsError),
196 RenderNoArgumentsError(RenderNoArgumentsError),
197 RenderConflictingPartialError(RenderConflictingPartialError),
198 RenderInvalidAsOptionError(RenderInvalidAsOptionError),
199 RenderObjectAndCollectionError(RenderObjectAndCollectionError),
200 RenderLayoutWithoutBlockError(RenderLayoutWithoutBlockError),
201 StrictLocalsPositionalArgumentError(StrictLocalsPositionalArgumentError),
202 StrictLocalsBlockArgumentError(StrictLocalsBlockArgumentError),
203 StrictLocalsSplatArgumentError(StrictLocalsSplatArgumentError),
204 StrictLocalsMissingParenthesisError(StrictLocalsMissingParenthesisError),
205 StrictLocalsDuplicateDeclarationError(StrictLocalsDuplicateDeclarationError),
206 HerbStateMissingParenthesisError(HerbStateMissingParenthesisError),
207 HerbStateNonCanonicalDirectiveError(HerbStateNonCanonicalDirectiveError),
208 HerbStateInvalidParameterError(HerbStateInvalidParameterError),
209 HerbStateDuplicateDeclarationError(HerbStateDuplicateDeclarationError),
210 VoidElementContentError(VoidElementContentError),
211 DotNotationCasingError(DotNotationCasingError),
212 TimeoutError(TimeoutError),
213}
214
215impl AnyError {
216 pub fn error_type(&self) -> &str {
217 match self {
218 AnyError::UnexpectedError(e) => &e.error_type,
219 AnyError::UnexpectedTokenError(e) => &e.error_type,
220 AnyError::MissingOpeningTagError(e) => &e.error_type,
221 AnyError::MissingClosingTagError(e) => &e.error_type,
222 AnyError::TagNamesMismatchError(e) => &e.error_type,
223 AnyError::VoidElementClosingTagError(e) => &e.error_type,
224 AnyError::UnclosedElementError(e) => &e.error_type,
225 AnyError::RubyParseError(e) => &e.error_type,
226 AnyError::ERBControlFlowScopeError(e) => &e.error_type,
227 AnyError::MissingERBEndTagError(e) => &e.error_type,
228 AnyError::ERBMultipleBlocksInTagError(e) => &e.error_type,
229 AnyError::ERBCaseWithConditionsError(e) => &e.error_type,
230 AnyError::ERBCaseInlinePatternMatchError(e) => &e.error_type,
231 AnyError::ConditionalElementMultipleTagsError(e) => &e.error_type,
232 AnyError::ConditionalElementConditionMismatchError(e) => &e.error_type,
233 AnyError::UnclosedCommentError(e) => &e.error_type,
234 AnyError::NestedCommentError(e) => &e.error_type,
235 AnyError::InvalidCommentClosingTagError(e) => &e.error_type,
236 AnyError::OmittedClosingTagError(e) => &e.error_type,
237 AnyError::UnclosedOpenTagError(e) => &e.error_type,
238 AnyError::UnclosedCloseTagError(e) => &e.error_type,
239 AnyError::EndTagWithTrailingSolidusError(e) => &e.error_type,
240 AnyError::UnclosedQuoteError(e) => &e.error_type,
241 AnyError::MissingAttributeValueError(e) => &e.error_type,
242 AnyError::MissingWhitespaceBetweenAttributesError(e) => &e.error_type,
243 AnyError::UnexpectedCharacterInAttributeNameError(e) => &e.error_type,
244 AnyError::UnexpectedCharacterInUnquotedAttributeValueError(e) => &e.error_type,
245 AnyError::UnexpectedEqualsSignBeforeAttributeNameError(e) => &e.error_type,
246 AnyError::UnexpectedSolidusInTagError(e) => &e.error_type,
247 AnyError::UnclosedERBTagError(e) => &e.error_type,
248 AnyError::MalformedERBClosingTagError(e) => &e.error_type,
249 AnyError::StrayERBClosingTagError(e) => &e.error_type,
250 AnyError::NestedERBTagError(e) => &e.error_type,
251 AnyError::RenderAmbiguousLocalsError(e) => &e.error_type,
252 AnyError::RenderMissingLocalsError(e) => &e.error_type,
253 AnyError::RenderNoArgumentsError(e) => &e.error_type,
254 AnyError::RenderConflictingPartialError(e) => &e.error_type,
255 AnyError::RenderInvalidAsOptionError(e) => &e.error_type,
256 AnyError::RenderObjectAndCollectionError(e) => &e.error_type,
257 AnyError::RenderLayoutWithoutBlockError(e) => &e.error_type,
258 AnyError::StrictLocalsPositionalArgumentError(e) => &e.error_type,
259 AnyError::StrictLocalsBlockArgumentError(e) => &e.error_type,
260 AnyError::StrictLocalsSplatArgumentError(e) => &e.error_type,
261 AnyError::StrictLocalsMissingParenthesisError(e) => &e.error_type,
262 AnyError::StrictLocalsDuplicateDeclarationError(e) => &e.error_type,
263 AnyError::HerbStateMissingParenthesisError(e) => &e.error_type,
264 AnyError::HerbStateNonCanonicalDirectiveError(e) => &e.error_type,
265 AnyError::HerbStateInvalidParameterError(e) => &e.error_type,
266 AnyError::HerbStateDuplicateDeclarationError(e) => &e.error_type,
267 AnyError::VoidElementContentError(e) => &e.error_type,
268 AnyError::DotNotationCasingError(e) => &e.error_type,
269 AnyError::TimeoutError(e) => &e.error_type,
270 }
271 }
272
273 pub fn message(&self) -> &str {
274 match self {
275 AnyError::UnexpectedError(e) => &e.message,
276 AnyError::UnexpectedTokenError(e) => &e.message,
277 AnyError::MissingOpeningTagError(e) => &e.message,
278 AnyError::MissingClosingTagError(e) => &e.message,
279 AnyError::TagNamesMismatchError(e) => &e.message,
280 AnyError::VoidElementClosingTagError(e) => &e.message,
281 AnyError::UnclosedElementError(e) => &e.message,
282 AnyError::RubyParseError(e) => &e.message,
283 AnyError::ERBControlFlowScopeError(e) => &e.message,
284 AnyError::MissingERBEndTagError(e) => &e.message,
285 AnyError::ERBMultipleBlocksInTagError(e) => &e.message,
286 AnyError::ERBCaseWithConditionsError(e) => &e.message,
287 AnyError::ERBCaseInlinePatternMatchError(e) => &e.message,
288 AnyError::ConditionalElementMultipleTagsError(e) => &e.message,
289 AnyError::ConditionalElementConditionMismatchError(e) => &e.message,
290 AnyError::UnclosedCommentError(e) => &e.message,
291 AnyError::NestedCommentError(e) => &e.message,
292 AnyError::InvalidCommentClosingTagError(e) => &e.message,
293 AnyError::OmittedClosingTagError(e) => &e.message,
294 AnyError::UnclosedOpenTagError(e) => &e.message,
295 AnyError::UnclosedCloseTagError(e) => &e.message,
296 AnyError::EndTagWithTrailingSolidusError(e) => &e.message,
297 AnyError::UnclosedQuoteError(e) => &e.message,
298 AnyError::MissingAttributeValueError(e) => &e.message,
299 AnyError::MissingWhitespaceBetweenAttributesError(e) => &e.message,
300 AnyError::UnexpectedCharacterInAttributeNameError(e) => &e.message,
301 AnyError::UnexpectedCharacterInUnquotedAttributeValueError(e) => &e.message,
302 AnyError::UnexpectedEqualsSignBeforeAttributeNameError(e) => &e.message,
303 AnyError::UnexpectedSolidusInTagError(e) => &e.message,
304 AnyError::UnclosedERBTagError(e) => &e.message,
305 AnyError::MalformedERBClosingTagError(e) => &e.message,
306 AnyError::StrayERBClosingTagError(e) => &e.message,
307 AnyError::NestedERBTagError(e) => &e.message,
308 AnyError::RenderAmbiguousLocalsError(e) => &e.message,
309 AnyError::RenderMissingLocalsError(e) => &e.message,
310 AnyError::RenderNoArgumentsError(e) => &e.message,
311 AnyError::RenderConflictingPartialError(e) => &e.message,
312 AnyError::RenderInvalidAsOptionError(e) => &e.message,
313 AnyError::RenderObjectAndCollectionError(e) => &e.message,
314 AnyError::RenderLayoutWithoutBlockError(e) => &e.message,
315 AnyError::StrictLocalsPositionalArgumentError(e) => &e.message,
316 AnyError::StrictLocalsBlockArgumentError(e) => &e.message,
317 AnyError::StrictLocalsSplatArgumentError(e) => &e.message,
318 AnyError::StrictLocalsMissingParenthesisError(e) => &e.message,
319 AnyError::StrictLocalsDuplicateDeclarationError(e) => &e.message,
320 AnyError::HerbStateMissingParenthesisError(e) => &e.message,
321 AnyError::HerbStateNonCanonicalDirectiveError(e) => &e.message,
322 AnyError::HerbStateInvalidParameterError(e) => &e.message,
323 AnyError::HerbStateDuplicateDeclarationError(e) => &e.message,
324 AnyError::VoidElementContentError(e) => &e.message,
325 AnyError::DotNotationCasingError(e) => &e.message,
326 AnyError::TimeoutError(e) => &e.message,
327 }
328 }
329
330 pub fn location(&self) -> &Location {
331 match self {
332 AnyError::UnexpectedError(e) => &e.location,
333 AnyError::UnexpectedTokenError(e) => &e.location,
334 AnyError::MissingOpeningTagError(e) => &e.location,
335 AnyError::MissingClosingTagError(e) => &e.location,
336 AnyError::TagNamesMismatchError(e) => &e.location,
337 AnyError::VoidElementClosingTagError(e) => &e.location,
338 AnyError::UnclosedElementError(e) => &e.location,
339 AnyError::RubyParseError(e) => &e.location,
340 AnyError::ERBControlFlowScopeError(e) => &e.location,
341 AnyError::MissingERBEndTagError(e) => &e.location,
342 AnyError::ERBMultipleBlocksInTagError(e) => &e.location,
343 AnyError::ERBCaseWithConditionsError(e) => &e.location,
344 AnyError::ERBCaseInlinePatternMatchError(e) => &e.location,
345 AnyError::ConditionalElementMultipleTagsError(e) => &e.location,
346 AnyError::ConditionalElementConditionMismatchError(e) => &e.location,
347 AnyError::UnclosedCommentError(e) => &e.location,
348 AnyError::NestedCommentError(e) => &e.location,
349 AnyError::InvalidCommentClosingTagError(e) => &e.location,
350 AnyError::OmittedClosingTagError(e) => &e.location,
351 AnyError::UnclosedOpenTagError(e) => &e.location,
352 AnyError::UnclosedCloseTagError(e) => &e.location,
353 AnyError::EndTagWithTrailingSolidusError(e) => &e.location,
354 AnyError::UnclosedQuoteError(e) => &e.location,
355 AnyError::MissingAttributeValueError(e) => &e.location,
356 AnyError::MissingWhitespaceBetweenAttributesError(e) => &e.location,
357 AnyError::UnexpectedCharacterInAttributeNameError(e) => &e.location,
358 AnyError::UnexpectedCharacterInUnquotedAttributeValueError(e) => &e.location,
359 AnyError::UnexpectedEqualsSignBeforeAttributeNameError(e) => &e.location,
360 AnyError::UnexpectedSolidusInTagError(e) => &e.location,
361 AnyError::UnclosedERBTagError(e) => &e.location,
362 AnyError::MalformedERBClosingTagError(e) => &e.location,
363 AnyError::StrayERBClosingTagError(e) => &e.location,
364 AnyError::NestedERBTagError(e) => &e.location,
365 AnyError::RenderAmbiguousLocalsError(e) => &e.location,
366 AnyError::RenderMissingLocalsError(e) => &e.location,
367 AnyError::RenderNoArgumentsError(e) => &e.location,
368 AnyError::RenderConflictingPartialError(e) => &e.location,
369 AnyError::RenderInvalidAsOptionError(e) => &e.location,
370 AnyError::RenderObjectAndCollectionError(e) => &e.location,
371 AnyError::RenderLayoutWithoutBlockError(e) => &e.location,
372 AnyError::StrictLocalsPositionalArgumentError(e) => &e.location,
373 AnyError::StrictLocalsBlockArgumentError(e) => &e.location,
374 AnyError::StrictLocalsSplatArgumentError(e) => &e.location,
375 AnyError::StrictLocalsMissingParenthesisError(e) => &e.location,
376 AnyError::StrictLocalsDuplicateDeclarationError(e) => &e.location,
377 AnyError::HerbStateMissingParenthesisError(e) => &e.location,
378 AnyError::HerbStateNonCanonicalDirectiveError(e) => &e.location,
379 AnyError::HerbStateInvalidParameterError(e) => &e.location,
380 AnyError::HerbStateDuplicateDeclarationError(e) => &e.location,
381 AnyError::VoidElementContentError(e) => &e.location,
382 AnyError::DotNotationCasingError(e) => &e.location,
383 AnyError::TimeoutError(e) => &e.location,
384 }
385 }
386
387 pub fn tree_inspect(&self) -> String {
388 match self {
389 AnyError::UnexpectedError(e) => e.tree_inspect(),
390 AnyError::UnexpectedTokenError(e) => e.tree_inspect(),
391 AnyError::MissingOpeningTagError(e) => e.tree_inspect(),
392 AnyError::MissingClosingTagError(e) => e.tree_inspect(),
393 AnyError::TagNamesMismatchError(e) => e.tree_inspect(),
394 AnyError::VoidElementClosingTagError(e) => e.tree_inspect(),
395 AnyError::UnclosedElementError(e) => e.tree_inspect(),
396 AnyError::RubyParseError(e) => e.tree_inspect(),
397 AnyError::ERBControlFlowScopeError(e) => e.tree_inspect(),
398 AnyError::MissingERBEndTagError(e) => e.tree_inspect(),
399 AnyError::ERBMultipleBlocksInTagError(e) => e.tree_inspect(),
400 AnyError::ERBCaseWithConditionsError(e) => e.tree_inspect(),
401 AnyError::ERBCaseInlinePatternMatchError(e) => e.tree_inspect(),
402 AnyError::ConditionalElementMultipleTagsError(e) => e.tree_inspect(),
403 AnyError::ConditionalElementConditionMismatchError(e) => e.tree_inspect(),
404 AnyError::UnclosedCommentError(e) => e.tree_inspect(),
405 AnyError::NestedCommentError(e) => e.tree_inspect(),
406 AnyError::InvalidCommentClosingTagError(e) => e.tree_inspect(),
407 AnyError::OmittedClosingTagError(e) => e.tree_inspect(),
408 AnyError::UnclosedOpenTagError(e) => e.tree_inspect(),
409 AnyError::UnclosedCloseTagError(e) => e.tree_inspect(),
410 AnyError::EndTagWithTrailingSolidusError(e) => e.tree_inspect(),
411 AnyError::UnclosedQuoteError(e) => e.tree_inspect(),
412 AnyError::MissingAttributeValueError(e) => e.tree_inspect(),
413 AnyError::MissingWhitespaceBetweenAttributesError(e) => e.tree_inspect(),
414 AnyError::UnexpectedCharacterInAttributeNameError(e) => e.tree_inspect(),
415 AnyError::UnexpectedCharacterInUnquotedAttributeValueError(e) => e.tree_inspect(),
416 AnyError::UnexpectedEqualsSignBeforeAttributeNameError(e) => e.tree_inspect(),
417 AnyError::UnexpectedSolidusInTagError(e) => e.tree_inspect(),
418 AnyError::UnclosedERBTagError(e) => e.tree_inspect(),
419 AnyError::MalformedERBClosingTagError(e) => e.tree_inspect(),
420 AnyError::StrayERBClosingTagError(e) => e.tree_inspect(),
421 AnyError::NestedERBTagError(e) => e.tree_inspect(),
422 AnyError::RenderAmbiguousLocalsError(e) => e.tree_inspect(),
423 AnyError::RenderMissingLocalsError(e) => e.tree_inspect(),
424 AnyError::RenderNoArgumentsError(e) => e.tree_inspect(),
425 AnyError::RenderConflictingPartialError(e) => e.tree_inspect(),
426 AnyError::RenderInvalidAsOptionError(e) => e.tree_inspect(),
427 AnyError::RenderObjectAndCollectionError(e) => e.tree_inspect(),
428 AnyError::RenderLayoutWithoutBlockError(e) => e.tree_inspect(),
429 AnyError::StrictLocalsPositionalArgumentError(e) => e.tree_inspect(),
430 AnyError::StrictLocalsBlockArgumentError(e) => e.tree_inspect(),
431 AnyError::StrictLocalsSplatArgumentError(e) => e.tree_inspect(),
432 AnyError::StrictLocalsMissingParenthesisError(e) => e.tree_inspect(),
433 AnyError::StrictLocalsDuplicateDeclarationError(e) => e.tree_inspect(),
434 AnyError::HerbStateMissingParenthesisError(e) => e.tree_inspect(),
435 AnyError::HerbStateNonCanonicalDirectiveError(e) => e.tree_inspect(),
436 AnyError::HerbStateInvalidParameterError(e) => e.tree_inspect(),
437 AnyError::HerbStateDuplicateDeclarationError(e) => e.tree_inspect(),
438 AnyError::VoidElementContentError(e) => e.tree_inspect(),
439 AnyError::DotNotationCasingError(e) => e.tree_inspect(),
440 AnyError::TimeoutError(e) => e.tree_inspect(),
441 }
442 }
443}
444
445impl ErrorNode for AnyError {
446 fn error_type(&self) -> &str {
447 self.error_type()
448 }
449
450 fn message(&self) -> &str {
451 self.message()
452 }
453
454 fn location(&self) -> &Location {
455 self.location()
456 }
457
458 fn tree_inspect(&self) -> String {
459 self.tree_inspect()
460 }
461}
462
463#[derive(Debug, Clone)]
464pub struct UnexpectedError {
465 pub error_type: String,
466 pub message: String,
467 pub location: Location,
468 pub description: String,
469 pub expected: String,
470 pub found: String,
471}
472
473#[allow(clippy::too_many_arguments)]
474impl UnexpectedError {
475 pub fn new(
476 message: String,
477 location: Location,
478 description: String,
479 expected: String,
480 found: String,
481 ) -> Self {
482 Self {
483 error_type: "UNEXPECTED_ERROR".to_string(),
484 message,
485 location,
486 description,
487 expected,
488 found,
489 }
490 }
491
492 pub fn tree_inspect(&self) -> String {
493 let mut output = String::new();
494
495 output.push_str(&format!("{} {} {}\n",
496 "@".white(),
497 "UnexpectedError".red().bold(),
498 format!("(location: {})", self.location).dimmed()
499 ));
500 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
501 output.push_str(&format!("{} {}: {}\n", "├──".white(), "description".white(), format_string_value(&self.description)));
502 output.push_str(&format!("{} {}: {}\n", "├──".white(), "expected".white(), format_string_value(&self.expected)));
503 output.push_str(&format!("{} {}: {}\n", "└──".white(), "found".white(), format_string_value(&self.found)));
504
505 output
506 }
507}
508
509impl ErrorNode for UnexpectedError {
510 fn error_type(&self) -> &str {
511 &self.error_type
512 }
513
514 fn message(&self) -> &str {
515 &self.message
516 }
517
518 fn location(&self) -> &Location {
519 &self.location
520 }
521
522 fn tree_inspect(&self) -> String {
523 UnexpectedError::tree_inspect(self)
524 }
525}
526
527#[derive(Debug, Clone)]
528pub struct UnexpectedTokenError {
529 pub error_type: String,
530 pub message: String,
531 pub location: Location,
532 pub expected_type: Option<String>,
533 pub found: Option<Token>,
534}
535
536#[allow(clippy::too_many_arguments)]
537impl UnexpectedTokenError {
538 pub fn new(
539 message: String,
540 location: Location,
541 expected_type: Option<String>,
542 found: Option<Token>,
543 ) -> Self {
544 Self {
545 error_type: "UNEXPECTED_TOKEN_ERROR".to_string(),
546 message,
547 location,
548 expected_type,
549 found,
550 }
551 }
552
553 pub fn tree_inspect(&self) -> String {
554 let mut output = String::new();
555
556 output.push_str(&format!("{} {} {}\n",
557 "@".white(),
558 "UnexpectedTokenError".red().bold(),
559 format!("(location: {})", self.location).dimmed()
560 ));
561 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
562 output.push_str(&format!("{} {}: {}\n", "├──".white(), "expected_type".white(), format_token_type_value(&self.expected_type)));
563 output.push_str(&format!("{} {}: {}\n", "└──".white(), "found".white(), format_token_value(&self.found)));
564
565 output
566 }
567}
568
569impl ErrorNode for UnexpectedTokenError {
570 fn error_type(&self) -> &str {
571 &self.error_type
572 }
573
574 fn message(&self) -> &str {
575 &self.message
576 }
577
578 fn location(&self) -> &Location {
579 &self.location
580 }
581
582 fn tree_inspect(&self) -> String {
583 UnexpectedTokenError::tree_inspect(self)
584 }
585}
586
587#[derive(Debug, Clone)]
588pub struct MissingOpeningTagError {
589 pub error_type: String,
590 pub message: String,
591 pub location: Location,
592 pub closing_tag: Option<Token>,
593}
594
595#[allow(clippy::too_many_arguments)]
596impl MissingOpeningTagError {
597 pub fn new(
598 message: String,
599 location: Location,
600 closing_tag: Option<Token>,
601 ) -> Self {
602 Self {
603 error_type: "MISSING_OPENING_TAG_ERROR".to_string(),
604 message,
605 location,
606 closing_tag,
607 }
608 }
609
610 pub fn tree_inspect(&self) -> String {
611 let mut output = String::new();
612
613 output.push_str(&format!("{} {} {}\n",
614 "@".white(),
615 "MissingOpeningTagError".red().bold(),
616 format!("(location: {})", self.location).dimmed()
617 ));
618 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
619 output.push_str(&format!("{} {}: {}\n", "└──".white(), "closing_tag".white(), format_token_value(&self.closing_tag)));
620
621 output
622 }
623}
624
625impl ErrorNode for MissingOpeningTagError {
626 fn error_type(&self) -> &str {
627 &self.error_type
628 }
629
630 fn message(&self) -> &str {
631 &self.message
632 }
633
634 fn location(&self) -> &Location {
635 &self.location
636 }
637
638 fn tree_inspect(&self) -> String {
639 MissingOpeningTagError::tree_inspect(self)
640 }
641}
642
643#[derive(Debug, Clone)]
644pub struct MissingClosingTagError {
645 pub error_type: String,
646 pub message: String,
647 pub location: Location,
648 pub opening_tag: Option<Token>,
649}
650
651#[allow(clippy::too_many_arguments)]
652impl MissingClosingTagError {
653 pub fn new(
654 message: String,
655 location: Location,
656 opening_tag: Option<Token>,
657 ) -> Self {
658 Self {
659 error_type: "MISSING_CLOSING_TAG_ERROR".to_string(),
660 message,
661 location,
662 opening_tag,
663 }
664 }
665
666 pub fn tree_inspect(&self) -> String {
667 let mut output = String::new();
668
669 output.push_str(&format!("{} {} {}\n",
670 "@".white(),
671 "MissingClosingTagError".red().bold(),
672 format!("(location: {})", self.location).dimmed()
673 ));
674 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
675 output.push_str(&format!("{} {}: {}\n", "└──".white(), "opening_tag".white(), format_token_value(&self.opening_tag)));
676
677 output
678 }
679}
680
681impl ErrorNode for MissingClosingTagError {
682 fn error_type(&self) -> &str {
683 &self.error_type
684 }
685
686 fn message(&self) -> &str {
687 &self.message
688 }
689
690 fn location(&self) -> &Location {
691 &self.location
692 }
693
694 fn tree_inspect(&self) -> String {
695 MissingClosingTagError::tree_inspect(self)
696 }
697}
698
699#[derive(Debug, Clone)]
700pub struct TagNamesMismatchError {
701 pub error_type: String,
702 pub message: String,
703 pub location: Location,
704 pub opening_tag: Option<Token>,
705 pub closing_tag: Option<Token>,
706}
707
708#[allow(clippy::too_many_arguments)]
709impl TagNamesMismatchError {
710 pub fn new(
711 message: String,
712 location: Location,
713 opening_tag: Option<Token>,
714 closing_tag: Option<Token>,
715 ) -> Self {
716 Self {
717 error_type: "TAG_NAMES_MISMATCH_ERROR".to_string(),
718 message,
719 location,
720 opening_tag,
721 closing_tag,
722 }
723 }
724
725 pub fn tree_inspect(&self) -> String {
726 let mut output = String::new();
727
728 output.push_str(&format!("{} {} {}\n",
729 "@".white(),
730 "TagNamesMismatchError".red().bold(),
731 format!("(location: {})", self.location).dimmed()
732 ));
733 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
734 output.push_str(&format!("{} {}: {}\n", "├──".white(), "opening_tag".white(), format_token_value(&self.opening_tag)));
735 output.push_str(&format!("{} {}: {}\n", "└──".white(), "closing_tag".white(), format_token_value(&self.closing_tag)));
736
737 output
738 }
739}
740
741impl ErrorNode for TagNamesMismatchError {
742 fn error_type(&self) -> &str {
743 &self.error_type
744 }
745
746 fn message(&self) -> &str {
747 &self.message
748 }
749
750 fn location(&self) -> &Location {
751 &self.location
752 }
753
754 fn tree_inspect(&self) -> String {
755 TagNamesMismatchError::tree_inspect(self)
756 }
757}
758
759#[derive(Debug, Clone)]
760pub struct VoidElementClosingTagError {
761 pub error_type: String,
762 pub message: String,
763 pub location: Location,
764 pub tag_name: Option<Token>,
765 pub expected: String,
766 pub found: String,
767}
768
769#[allow(clippy::too_many_arguments)]
770impl VoidElementClosingTagError {
771 pub fn new(
772 message: String,
773 location: Location,
774 tag_name: Option<Token>,
775 expected: String,
776 found: String,
777 ) -> Self {
778 Self {
779 error_type: "VOID_ELEMENT_CLOSING_TAG_ERROR".to_string(),
780 message,
781 location,
782 tag_name,
783 expected,
784 found,
785 }
786 }
787
788 pub fn tree_inspect(&self) -> String {
789 let mut output = String::new();
790
791 output.push_str(&format!("{} {} {}\n",
792 "@".white(),
793 "VoidElementClosingTagError".red().bold(),
794 format!("(location: {})", self.location).dimmed()
795 ));
796 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
797 output.push_str(&format!("{} {}: {}\n", "├──".white(), "tag_name".white(), format_token_value(&self.tag_name)));
798 output.push_str(&format!("{} {}: {}\n", "├──".white(), "expected".white(), format_string_value(&self.expected)));
799 output.push_str(&format!("{} {}: {}\n", "└──".white(), "found".white(), format_string_value(&self.found)));
800
801 output
802 }
803}
804
805impl ErrorNode for VoidElementClosingTagError {
806 fn error_type(&self) -> &str {
807 &self.error_type
808 }
809
810 fn message(&self) -> &str {
811 &self.message
812 }
813
814 fn location(&self) -> &Location {
815 &self.location
816 }
817
818 fn tree_inspect(&self) -> String {
819 VoidElementClosingTagError::tree_inspect(self)
820 }
821}
822
823#[derive(Debug, Clone)]
824pub struct UnclosedElementError {
825 pub error_type: String,
826 pub message: String,
827 pub location: Location,
828 pub opening_tag: Option<Token>,
829}
830
831#[allow(clippy::too_many_arguments)]
832impl UnclosedElementError {
833 pub fn new(
834 message: String,
835 location: Location,
836 opening_tag: Option<Token>,
837 ) -> Self {
838 Self {
839 error_type: "UNCLOSED_ELEMENT_ERROR".to_string(),
840 message,
841 location,
842 opening_tag,
843 }
844 }
845
846 pub fn tree_inspect(&self) -> String {
847 let mut output = String::new();
848
849 output.push_str(&format!("{} {} {}\n",
850 "@".white(),
851 "UnclosedElementError".red().bold(),
852 format!("(location: {})", self.location).dimmed()
853 ));
854 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
855 output.push_str(&format!("{} {}: {}\n", "└──".white(), "opening_tag".white(), format_token_value(&self.opening_tag)));
856
857 output
858 }
859}
860
861impl ErrorNode for UnclosedElementError {
862 fn error_type(&self) -> &str {
863 &self.error_type
864 }
865
866 fn message(&self) -> &str {
867 &self.message
868 }
869
870 fn location(&self) -> &Location {
871 &self.location
872 }
873
874 fn tree_inspect(&self) -> String {
875 UnclosedElementError::tree_inspect(self)
876 }
877}
878
879#[derive(Debug, Clone)]
880pub struct RubyParseError {
881 pub error_type: String,
882 pub message: String,
883 pub location: Location,
884 pub error_message: String,
885 pub diagnostic_id: String,
886 pub level: String,
887}
888
889#[allow(clippy::too_many_arguments)]
890impl RubyParseError {
891 pub fn new(
892 message: String,
893 location: Location,
894 error_message: String,
895 diagnostic_id: String,
896 level: String,
897 ) -> Self {
898 Self {
899 error_type: "RUBY_PARSE_ERROR".to_string(),
900 message,
901 location,
902 error_message,
903 diagnostic_id,
904 level,
905 }
906 }
907
908 pub fn tree_inspect(&self) -> String {
909 let mut output = String::new();
910
911 output.push_str(&format!("{} {} {}\n",
912 "@".white(),
913 "RubyParseError".red().bold(),
914 format!("(location: {})", self.location).dimmed()
915 ));
916 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
917 output.push_str(&format!("{} {}: {}\n", "├──".white(), "error_message".white(), format_string_value(&self.error_message)));
918 output.push_str(&format!("{} {}: {}\n", "├──".white(), "diagnostic_id".white(), format_string_value(&self.diagnostic_id)));
919 output.push_str(&format!("{} {}: {}\n", "└──".white(), "level".white(), format_string_value(&self.level)));
920
921 output
922 }
923}
924
925impl ErrorNode for RubyParseError {
926 fn error_type(&self) -> &str {
927 &self.error_type
928 }
929
930 fn message(&self) -> &str {
931 &self.message
932 }
933
934 fn location(&self) -> &Location {
935 &self.location
936 }
937
938 fn tree_inspect(&self) -> String {
939 RubyParseError::tree_inspect(self)
940 }
941}
942
943#[derive(Debug, Clone)]
944pub struct ERBControlFlowScopeError {
945 pub error_type: String,
946 pub message: String,
947 pub location: Location,
948 pub keyword: String,
949}
950
951#[allow(clippy::too_many_arguments)]
952impl ERBControlFlowScopeError {
953 pub fn new(
954 message: String,
955 location: Location,
956 keyword: String,
957 ) -> Self {
958 Self {
959 error_type: "ERB_CONTROL_FLOW_SCOPE_ERROR".to_string(),
960 message,
961 location,
962 keyword,
963 }
964 }
965
966 pub fn tree_inspect(&self) -> String {
967 let mut output = String::new();
968
969 output.push_str(&format!("{} {} {}\n",
970 "@".white(),
971 "ERBControlFlowScopeError".red().bold(),
972 format!("(location: {})", self.location).dimmed()
973 ));
974 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
975 output.push_str(&format!("{} {}: {}\n", "└──".white(), "keyword".white(), format_string_value(&self.keyword)));
976
977 output
978 }
979}
980
981impl ErrorNode for ERBControlFlowScopeError {
982 fn error_type(&self) -> &str {
983 &self.error_type
984 }
985
986 fn message(&self) -> &str {
987 &self.message
988 }
989
990 fn location(&self) -> &Location {
991 &self.location
992 }
993
994 fn tree_inspect(&self) -> String {
995 ERBControlFlowScopeError::tree_inspect(self)
996 }
997}
998
999#[derive(Debug, Clone)]
1000pub struct MissingERBEndTagError {
1001 pub error_type: String,
1002 pub message: String,
1003 pub location: Location,
1004 pub keyword: String,
1005}
1006
1007#[allow(clippy::too_many_arguments)]
1008impl MissingERBEndTagError {
1009 pub fn new(
1010 message: String,
1011 location: Location,
1012 keyword: String,
1013 ) -> Self {
1014 Self {
1015 error_type: "MISSING_ERB_END_TAG_ERROR".to_string(),
1016 message,
1017 location,
1018 keyword,
1019 }
1020 }
1021
1022 pub fn tree_inspect(&self) -> String {
1023 let mut output = String::new();
1024
1025 output.push_str(&format!("{} {} {}\n",
1026 "@".white(),
1027 "MissingERBEndTagError".red().bold(),
1028 format!("(location: {})", self.location).dimmed()
1029 ));
1030 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1031 output.push_str(&format!("{} {}: {}\n", "└──".white(), "keyword".white(), format_string_value(&self.keyword)));
1032
1033 output
1034 }
1035}
1036
1037impl ErrorNode for MissingERBEndTagError {
1038 fn error_type(&self) -> &str {
1039 &self.error_type
1040 }
1041
1042 fn message(&self) -> &str {
1043 &self.message
1044 }
1045
1046 fn location(&self) -> &Location {
1047 &self.location
1048 }
1049
1050 fn tree_inspect(&self) -> String {
1051 MissingERBEndTagError::tree_inspect(self)
1052 }
1053}
1054
1055#[derive(Debug, Clone)]
1056pub struct ERBMultipleBlocksInTagError {
1057 pub error_type: String,
1058 pub message: String,
1059 pub location: Location,
1060}
1061
1062#[allow(clippy::too_many_arguments)]
1063impl ERBMultipleBlocksInTagError {
1064 pub fn new(
1065 message: String,
1066 location: Location,
1067 ) -> Self {
1068 Self {
1069 error_type: "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR".to_string(),
1070 message,
1071 location,
1072 }
1073 }
1074
1075 pub fn tree_inspect(&self) -> String {
1076 let mut output = String::new();
1077
1078 output.push_str(&format!("{} {} {}\n",
1079 "@".white(),
1080 "ERBMultipleBlocksInTagError".red().bold(),
1081 format!("(location: {})", self.location).dimmed()
1082 ));
1083 output.push_str(&format!("{} {}: {}\n", "└──".white(), "message".white(), format_string_value(&self.message)));
1084
1085 output
1086 }
1087}
1088
1089impl ErrorNode for ERBMultipleBlocksInTagError {
1090 fn error_type(&self) -> &str {
1091 &self.error_type
1092 }
1093
1094 fn message(&self) -> &str {
1095 &self.message
1096 }
1097
1098 fn location(&self) -> &Location {
1099 &self.location
1100 }
1101
1102 fn tree_inspect(&self) -> String {
1103 ERBMultipleBlocksInTagError::tree_inspect(self)
1104 }
1105}
1106
1107#[derive(Debug, Clone)]
1108pub struct ERBCaseWithConditionsError {
1109 pub error_type: String,
1110 pub message: String,
1111 pub location: Location,
1112}
1113
1114#[allow(clippy::too_many_arguments)]
1115impl ERBCaseWithConditionsError {
1116 pub fn new(
1117 message: String,
1118 location: Location,
1119 ) -> Self {
1120 Self {
1121 error_type: "ERB_CASE_WITH_CONDITIONS_ERROR".to_string(),
1122 message,
1123 location,
1124 }
1125 }
1126
1127 pub fn tree_inspect(&self) -> String {
1128 let mut output = String::new();
1129
1130 output.push_str(&format!("{} {} {}\n",
1131 "@".white(),
1132 "ERBCaseWithConditionsError".red().bold(),
1133 format!("(location: {})", self.location).dimmed()
1134 ));
1135 output.push_str(&format!("{} {}: {}\n", "└──".white(), "message".white(), format_string_value(&self.message)));
1136
1137 output
1138 }
1139}
1140
1141impl ErrorNode for ERBCaseWithConditionsError {
1142 fn error_type(&self) -> &str {
1143 &self.error_type
1144 }
1145
1146 fn message(&self) -> &str {
1147 &self.message
1148 }
1149
1150 fn location(&self) -> &Location {
1151 &self.location
1152 }
1153
1154 fn tree_inspect(&self) -> String {
1155 ERBCaseWithConditionsError::tree_inspect(self)
1156 }
1157}
1158
1159#[derive(Debug, Clone)]
1160pub struct ERBCaseInlinePatternMatchError {
1161 pub error_type: String,
1162 pub message: String,
1163 pub location: Location,
1164}
1165
1166#[allow(clippy::too_many_arguments)]
1167impl ERBCaseInlinePatternMatchError {
1168 pub fn new(
1169 message: String,
1170 location: Location,
1171 ) -> Self {
1172 Self {
1173 error_type: "ERB_CASE_INLINE_PATTERN_MATCH_ERROR".to_string(),
1174 message,
1175 location,
1176 }
1177 }
1178
1179 pub fn tree_inspect(&self) -> String {
1180 let mut output = String::new();
1181
1182 output.push_str(&format!("{} {} {}\n",
1183 "@".white(),
1184 "ERBCaseInlinePatternMatchError".red().bold(),
1185 format!("(location: {})", self.location).dimmed()
1186 ));
1187 output.push_str(&format!("{} {}: {}\n", "└──".white(), "message".white(), format_string_value(&self.message)));
1188
1189 output
1190 }
1191}
1192
1193impl ErrorNode for ERBCaseInlinePatternMatchError {
1194 fn error_type(&self) -> &str {
1195 &self.error_type
1196 }
1197
1198 fn message(&self) -> &str {
1199 &self.message
1200 }
1201
1202 fn location(&self) -> &Location {
1203 &self.location
1204 }
1205
1206 fn tree_inspect(&self) -> String {
1207 ERBCaseInlinePatternMatchError::tree_inspect(self)
1208 }
1209}
1210
1211#[derive(Debug, Clone)]
1212pub struct ConditionalElementMultipleTagsError {
1213 pub error_type: String,
1214 pub message: String,
1215 pub location: Location,
1216 pub line: usize,
1217 pub column: usize,
1218}
1219
1220#[allow(clippy::too_many_arguments)]
1221impl ConditionalElementMultipleTagsError {
1222 pub fn new(
1223 message: String,
1224 location: Location,
1225 line: usize,
1226 column: usize,
1227 ) -> Self {
1228 Self {
1229 error_type: "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR".to_string(),
1230 message,
1231 location,
1232 line,
1233 column,
1234 }
1235 }
1236
1237 pub fn tree_inspect(&self) -> String {
1238 let mut output = String::new();
1239
1240 output.push_str(&format!("{} {} {}\n",
1241 "@".white(),
1242 "ConditionalElementMultipleTagsError".red().bold(),
1243 format!("(location: {})", self.location).dimmed()
1244 ));
1245 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1246 output.push_str(&format!("{} {}: {}\n", "├──".white(), "line".white(), format_size_value(self.line)));
1247 output.push_str(&format!("{} {}: {}\n", "└──".white(), "column".white(), format_size_value(self.column)));
1248
1249 output
1250 }
1251}
1252
1253impl ErrorNode for ConditionalElementMultipleTagsError {
1254 fn error_type(&self) -> &str {
1255 &self.error_type
1256 }
1257
1258 fn message(&self) -> &str {
1259 &self.message
1260 }
1261
1262 fn location(&self) -> &Location {
1263 &self.location
1264 }
1265
1266 fn tree_inspect(&self) -> String {
1267 ConditionalElementMultipleTagsError::tree_inspect(self)
1268 }
1269}
1270
1271#[derive(Debug, Clone)]
1272pub struct ConditionalElementConditionMismatchError {
1273 pub error_type: String,
1274 pub message: String,
1275 pub location: Location,
1276 pub tag_name: String,
1277 pub open_condition: String,
1278 pub open_line: usize,
1279 pub open_column: usize,
1280 pub close_condition: String,
1281 pub close_line: usize,
1282 pub close_column: usize,
1283}
1284
1285#[allow(clippy::too_many_arguments)]
1286impl ConditionalElementConditionMismatchError {
1287 pub fn new(
1288 message: String,
1289 location: Location,
1290 tag_name: String,
1291 open_condition: String,
1292 open_line: usize,
1293 open_column: usize,
1294 close_condition: String,
1295 close_line: usize,
1296 close_column: usize,
1297 ) -> Self {
1298 Self {
1299 error_type: "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR".to_string(),
1300 message,
1301 location,
1302 tag_name,
1303 open_condition,
1304 open_line,
1305 open_column,
1306 close_condition,
1307 close_line,
1308 close_column,
1309 }
1310 }
1311
1312 pub fn tree_inspect(&self) -> String {
1313 let mut output = String::new();
1314
1315 output.push_str(&format!("{} {} {}\n",
1316 "@".white(),
1317 "ConditionalElementConditionMismatchError".red().bold(),
1318 format!("(location: {})", self.location).dimmed()
1319 ));
1320 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1321 output.push_str(&format!("{} {}: {}\n", "├──".white(), "tag_name".white(), format_string_value(&self.tag_name)));
1322 output.push_str(&format!("{} {}: {}\n", "├──".white(), "open_condition".white(), format_string_value(&self.open_condition)));
1323 output.push_str(&format!("{} {}: {}\n", "├──".white(), "open_line".white(), format_size_value(self.open_line)));
1324 output.push_str(&format!("{} {}: {}\n", "├──".white(), "open_column".white(), format_size_value(self.open_column)));
1325 output.push_str(&format!("{} {}: {}\n", "├──".white(), "close_condition".white(), format_string_value(&self.close_condition)));
1326 output.push_str(&format!("{} {}: {}\n", "├──".white(), "close_line".white(), format_size_value(self.close_line)));
1327 output.push_str(&format!("{} {}: {}\n", "└──".white(), "close_column".white(), format_size_value(self.close_column)));
1328
1329 output
1330 }
1331}
1332
1333impl ErrorNode for ConditionalElementConditionMismatchError {
1334 fn error_type(&self) -> &str {
1335 &self.error_type
1336 }
1337
1338 fn message(&self) -> &str {
1339 &self.message
1340 }
1341
1342 fn location(&self) -> &Location {
1343 &self.location
1344 }
1345
1346 fn tree_inspect(&self) -> String {
1347 ConditionalElementConditionMismatchError::tree_inspect(self)
1348 }
1349}
1350
1351#[derive(Debug, Clone)]
1352pub struct UnclosedCommentError {
1353 pub error_type: String,
1354 pub message: String,
1355 pub location: Location,
1356 pub comment_start: Option<Token>,
1357}
1358
1359#[allow(clippy::too_many_arguments)]
1360impl UnclosedCommentError {
1361 pub fn new(
1362 message: String,
1363 location: Location,
1364 comment_start: Option<Token>,
1365 ) -> Self {
1366 Self {
1367 error_type: "UNCLOSED_COMMENT_ERROR".to_string(),
1368 message,
1369 location,
1370 comment_start,
1371 }
1372 }
1373
1374 pub fn tree_inspect(&self) -> String {
1375 let mut output = String::new();
1376
1377 output.push_str(&format!("{} {} {}\n",
1378 "@".white(),
1379 "UnclosedCommentError".red().bold(),
1380 format!("(location: {})", self.location).dimmed()
1381 ));
1382 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1383 output.push_str(&format!("{} {}: {}\n", "└──".white(), "comment_start".white(), format_token_value(&self.comment_start)));
1384
1385 output
1386 }
1387}
1388
1389impl ErrorNode for UnclosedCommentError {
1390 fn error_type(&self) -> &str {
1391 &self.error_type
1392 }
1393
1394 fn message(&self) -> &str {
1395 &self.message
1396 }
1397
1398 fn location(&self) -> &Location {
1399 &self.location
1400 }
1401
1402 fn tree_inspect(&self) -> String {
1403 UnclosedCommentError::tree_inspect(self)
1404 }
1405}
1406
1407#[derive(Debug, Clone)]
1408pub struct NestedCommentError {
1409 pub error_type: String,
1410 pub message: String,
1411 pub location: Location,
1412 pub comment_start: Option<Token>,
1413 pub nested_start: Option<Token>,
1414}
1415
1416#[allow(clippy::too_many_arguments)]
1417impl NestedCommentError {
1418 pub fn new(
1419 message: String,
1420 location: Location,
1421 comment_start: Option<Token>,
1422 nested_start: Option<Token>,
1423 ) -> Self {
1424 Self {
1425 error_type: "NESTED_COMMENT_ERROR".to_string(),
1426 message,
1427 location,
1428 comment_start,
1429 nested_start,
1430 }
1431 }
1432
1433 pub fn tree_inspect(&self) -> String {
1434 let mut output = String::new();
1435
1436 output.push_str(&format!("{} {} {}\n",
1437 "@".white(),
1438 "NestedCommentError".red().bold(),
1439 format!("(location: {})", self.location).dimmed()
1440 ));
1441 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1442 output.push_str(&format!("{} {}: {}\n", "├──".white(), "comment_start".white(), format_token_value(&self.comment_start)));
1443 output.push_str(&format!("{} {}: {}\n", "└──".white(), "nested_start".white(), format_token_value(&self.nested_start)));
1444
1445 output
1446 }
1447}
1448
1449impl ErrorNode for NestedCommentError {
1450 fn error_type(&self) -> &str {
1451 &self.error_type
1452 }
1453
1454 fn message(&self) -> &str {
1455 &self.message
1456 }
1457
1458 fn location(&self) -> &Location {
1459 &self.location
1460 }
1461
1462 fn tree_inspect(&self) -> String {
1463 NestedCommentError::tree_inspect(self)
1464 }
1465}
1466
1467#[derive(Debug, Clone)]
1468pub struct InvalidCommentClosingTagError {
1469 pub error_type: String,
1470 pub message: String,
1471 pub location: Location,
1472 pub closing_tag: Option<Token>,
1473}
1474
1475#[allow(clippy::too_many_arguments)]
1476impl InvalidCommentClosingTagError {
1477 pub fn new(
1478 message: String,
1479 location: Location,
1480 closing_tag: Option<Token>,
1481 ) -> Self {
1482 Self {
1483 error_type: "INVALID_COMMENT_CLOSING_TAG_ERROR".to_string(),
1484 message,
1485 location,
1486 closing_tag,
1487 }
1488 }
1489
1490 pub fn tree_inspect(&self) -> String {
1491 let mut output = String::new();
1492
1493 output.push_str(&format!("{} {} {}\n",
1494 "@".white(),
1495 "InvalidCommentClosingTagError".red().bold(),
1496 format!("(location: {})", self.location).dimmed()
1497 ));
1498 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1499 output.push_str(&format!("{} {}: {}\n", "└──".white(), "closing_tag".white(), format_token_value(&self.closing_tag)));
1500
1501 output
1502 }
1503}
1504
1505impl ErrorNode for InvalidCommentClosingTagError {
1506 fn error_type(&self) -> &str {
1507 &self.error_type
1508 }
1509
1510 fn message(&self) -> &str {
1511 &self.message
1512 }
1513
1514 fn location(&self) -> &Location {
1515 &self.location
1516 }
1517
1518 fn tree_inspect(&self) -> String {
1519 InvalidCommentClosingTagError::tree_inspect(self)
1520 }
1521}
1522
1523#[derive(Debug, Clone)]
1524pub struct OmittedClosingTagError {
1525 pub error_type: String,
1526 pub message: String,
1527 pub location: Location,
1528 pub opening_tag: Option<Token>,
1529 pub insertion_point: Option<Position>,
1530}
1531
1532#[allow(clippy::too_many_arguments)]
1533impl OmittedClosingTagError {
1534 pub fn new(
1535 message: String,
1536 location: Location,
1537 opening_tag: Option<Token>,
1538 insertion_point: Option<Position>,
1539 ) -> Self {
1540 Self {
1541 error_type: "OMITTED_CLOSING_TAG_ERROR".to_string(),
1542 message,
1543 location,
1544 opening_tag,
1545 insertion_point,
1546 }
1547 }
1548
1549 pub fn tree_inspect(&self) -> String {
1550 let mut output = String::new();
1551
1552 output.push_str(&format!("{} {} {}\n",
1553 "@".white(),
1554 "OmittedClosingTagError".red().bold(),
1555 format!("(location: {})", self.location).dimmed()
1556 ));
1557 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1558 output.push_str(&format!("{} {}: {}\n", "├──".white(), "opening_tag".white(), format_token_value(&self.opening_tag)));
1559 output.push_str(&format!("{} {}: {}\n", "└──".white(), "insertion_point".white(), format_position_value(&self.insertion_point)));
1560
1561 output
1562 }
1563}
1564
1565impl ErrorNode for OmittedClosingTagError {
1566 fn error_type(&self) -> &str {
1567 &self.error_type
1568 }
1569
1570 fn message(&self) -> &str {
1571 &self.message
1572 }
1573
1574 fn location(&self) -> &Location {
1575 &self.location
1576 }
1577
1578 fn tree_inspect(&self) -> String {
1579 OmittedClosingTagError::tree_inspect(self)
1580 }
1581}
1582
1583#[derive(Debug, Clone)]
1584pub struct UnclosedOpenTagError {
1585 pub error_type: String,
1586 pub message: String,
1587 pub location: Location,
1588 pub tag_name: Option<Token>,
1589}
1590
1591#[allow(clippy::too_many_arguments)]
1592impl UnclosedOpenTagError {
1593 pub fn new(
1594 message: String,
1595 location: Location,
1596 tag_name: Option<Token>,
1597 ) -> Self {
1598 Self {
1599 error_type: "UNCLOSED_OPEN_TAG_ERROR".to_string(),
1600 message,
1601 location,
1602 tag_name,
1603 }
1604 }
1605
1606 pub fn tree_inspect(&self) -> String {
1607 let mut output = String::new();
1608
1609 output.push_str(&format!("{} {} {}\n",
1610 "@".white(),
1611 "UnclosedOpenTagError".red().bold(),
1612 format!("(location: {})", self.location).dimmed()
1613 ));
1614 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1615 output.push_str(&format!("{} {}: {}\n", "└──".white(), "tag_name".white(), format_token_value(&self.tag_name)));
1616
1617 output
1618 }
1619}
1620
1621impl ErrorNode for UnclosedOpenTagError {
1622 fn error_type(&self) -> &str {
1623 &self.error_type
1624 }
1625
1626 fn message(&self) -> &str {
1627 &self.message
1628 }
1629
1630 fn location(&self) -> &Location {
1631 &self.location
1632 }
1633
1634 fn tree_inspect(&self) -> String {
1635 UnclosedOpenTagError::tree_inspect(self)
1636 }
1637}
1638
1639#[derive(Debug, Clone)]
1640pub struct UnclosedCloseTagError {
1641 pub error_type: String,
1642 pub message: String,
1643 pub location: Location,
1644 pub tag_name: Option<Token>,
1645}
1646
1647#[allow(clippy::too_many_arguments)]
1648impl UnclosedCloseTagError {
1649 pub fn new(
1650 message: String,
1651 location: Location,
1652 tag_name: Option<Token>,
1653 ) -> Self {
1654 Self {
1655 error_type: "UNCLOSED_CLOSE_TAG_ERROR".to_string(),
1656 message,
1657 location,
1658 tag_name,
1659 }
1660 }
1661
1662 pub fn tree_inspect(&self) -> String {
1663 let mut output = String::new();
1664
1665 output.push_str(&format!("{} {} {}\n",
1666 "@".white(),
1667 "UnclosedCloseTagError".red().bold(),
1668 format!("(location: {})", self.location).dimmed()
1669 ));
1670 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1671 output.push_str(&format!("{} {}: {}\n", "└──".white(), "tag_name".white(), format_token_value(&self.tag_name)));
1672
1673 output
1674 }
1675}
1676
1677impl ErrorNode for UnclosedCloseTagError {
1678 fn error_type(&self) -> &str {
1679 &self.error_type
1680 }
1681
1682 fn message(&self) -> &str {
1683 &self.message
1684 }
1685
1686 fn location(&self) -> &Location {
1687 &self.location
1688 }
1689
1690 fn tree_inspect(&self) -> String {
1691 UnclosedCloseTagError::tree_inspect(self)
1692 }
1693}
1694
1695#[derive(Debug, Clone)]
1696pub struct EndTagWithTrailingSolidusError {
1697 pub error_type: String,
1698 pub message: String,
1699 pub location: Location,
1700 pub tag_name: Option<Token>,
1701}
1702
1703#[allow(clippy::too_many_arguments)]
1704impl EndTagWithTrailingSolidusError {
1705 pub fn new(
1706 message: String,
1707 location: Location,
1708 tag_name: Option<Token>,
1709 ) -> Self {
1710 Self {
1711 error_type: "END_TAG_WITH_TRAILING_SOLIDUS_ERROR".to_string(),
1712 message,
1713 location,
1714 tag_name,
1715 }
1716 }
1717
1718 pub fn tree_inspect(&self) -> String {
1719 let mut output = String::new();
1720
1721 output.push_str(&format!("{} {} {}\n",
1722 "@".white(),
1723 "EndTagWithTrailingSolidusError".red().bold(),
1724 format!("(location: {})", self.location).dimmed()
1725 ));
1726 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1727 output.push_str(&format!("{} {}: {}\n", "└──".white(), "tag_name".white(), format_token_value(&self.tag_name)));
1728
1729 output
1730 }
1731}
1732
1733impl ErrorNode for EndTagWithTrailingSolidusError {
1734 fn error_type(&self) -> &str {
1735 &self.error_type
1736 }
1737
1738 fn message(&self) -> &str {
1739 &self.message
1740 }
1741
1742 fn location(&self) -> &Location {
1743 &self.location
1744 }
1745
1746 fn tree_inspect(&self) -> String {
1747 EndTagWithTrailingSolidusError::tree_inspect(self)
1748 }
1749}
1750
1751#[derive(Debug, Clone)]
1752pub struct UnclosedQuoteError {
1753 pub error_type: String,
1754 pub message: String,
1755 pub location: Location,
1756 pub opening_quote: Option<Token>,
1757}
1758
1759#[allow(clippy::too_many_arguments)]
1760impl UnclosedQuoteError {
1761 pub fn new(
1762 message: String,
1763 location: Location,
1764 opening_quote: Option<Token>,
1765 ) -> Self {
1766 Self {
1767 error_type: "UNCLOSED_QUOTE_ERROR".to_string(),
1768 message,
1769 location,
1770 opening_quote,
1771 }
1772 }
1773
1774 pub fn tree_inspect(&self) -> String {
1775 let mut output = String::new();
1776
1777 output.push_str(&format!("{} {} {}\n",
1778 "@".white(),
1779 "UnclosedQuoteError".red().bold(),
1780 format!("(location: {})", self.location).dimmed()
1781 ));
1782 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1783 output.push_str(&format!("{} {}: {}\n", "└──".white(), "opening_quote".white(), format_token_value(&self.opening_quote)));
1784
1785 output
1786 }
1787}
1788
1789impl ErrorNode for UnclosedQuoteError {
1790 fn error_type(&self) -> &str {
1791 &self.error_type
1792 }
1793
1794 fn message(&self) -> &str {
1795 &self.message
1796 }
1797
1798 fn location(&self) -> &Location {
1799 &self.location
1800 }
1801
1802 fn tree_inspect(&self) -> String {
1803 UnclosedQuoteError::tree_inspect(self)
1804 }
1805}
1806
1807#[derive(Debug, Clone)]
1808pub struct MissingAttributeValueError {
1809 pub error_type: String,
1810 pub message: String,
1811 pub location: Location,
1812 pub attribute_name: String,
1813}
1814
1815#[allow(clippy::too_many_arguments)]
1816impl MissingAttributeValueError {
1817 pub fn new(
1818 message: String,
1819 location: Location,
1820 attribute_name: String,
1821 ) -> Self {
1822 Self {
1823 error_type: "MISSING_ATTRIBUTE_VALUE_ERROR".to_string(),
1824 message,
1825 location,
1826 attribute_name,
1827 }
1828 }
1829
1830 pub fn tree_inspect(&self) -> String {
1831 let mut output = String::new();
1832
1833 output.push_str(&format!("{} {} {}\n",
1834 "@".white(),
1835 "MissingAttributeValueError".red().bold(),
1836 format!("(location: {})", self.location).dimmed()
1837 ));
1838 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1839 output.push_str(&format!("{} {}: {}\n", "└──".white(), "attribute_name".white(), format_string_value(&self.attribute_name)));
1840
1841 output
1842 }
1843}
1844
1845impl ErrorNode for MissingAttributeValueError {
1846 fn error_type(&self) -> &str {
1847 &self.error_type
1848 }
1849
1850 fn message(&self) -> &str {
1851 &self.message
1852 }
1853
1854 fn location(&self) -> &Location {
1855 &self.location
1856 }
1857
1858 fn tree_inspect(&self) -> String {
1859 MissingAttributeValueError::tree_inspect(self)
1860 }
1861}
1862
1863#[derive(Debug, Clone)]
1864pub struct MissingWhitespaceBetweenAttributesError {
1865 pub error_type: String,
1866 pub message: String,
1867 pub location: Location,
1868 pub found: Option<Token>,
1869}
1870
1871#[allow(clippy::too_many_arguments)]
1872impl MissingWhitespaceBetweenAttributesError {
1873 pub fn new(
1874 message: String,
1875 location: Location,
1876 found: Option<Token>,
1877 ) -> Self {
1878 Self {
1879 error_type: "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES_ERROR".to_string(),
1880 message,
1881 location,
1882 found,
1883 }
1884 }
1885
1886 pub fn tree_inspect(&self) -> String {
1887 let mut output = String::new();
1888
1889 output.push_str(&format!("{} {} {}\n",
1890 "@".white(),
1891 "MissingWhitespaceBetweenAttributesError".red().bold(),
1892 format!("(location: {})", self.location).dimmed()
1893 ));
1894 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1895 output.push_str(&format!("{} {}: {}\n", "└──".white(), "found".white(), format_token_value(&self.found)));
1896
1897 output
1898 }
1899}
1900
1901impl ErrorNode for MissingWhitespaceBetweenAttributesError {
1902 fn error_type(&self) -> &str {
1903 &self.error_type
1904 }
1905
1906 fn message(&self) -> &str {
1907 &self.message
1908 }
1909
1910 fn location(&self) -> &Location {
1911 &self.location
1912 }
1913
1914 fn tree_inspect(&self) -> String {
1915 MissingWhitespaceBetweenAttributesError::tree_inspect(self)
1916 }
1917}
1918
1919#[derive(Debug, Clone)]
1920pub struct UnexpectedCharacterInAttributeNameError {
1921 pub error_type: String,
1922 pub message: String,
1923 pub location: Location,
1924 pub character: Option<Token>,
1925}
1926
1927#[allow(clippy::too_many_arguments)]
1928impl UnexpectedCharacterInAttributeNameError {
1929 pub fn new(
1930 message: String,
1931 location: Location,
1932 character: Option<Token>,
1933 ) -> Self {
1934 Self {
1935 error_type: "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME_ERROR".to_string(),
1936 message,
1937 location,
1938 character,
1939 }
1940 }
1941
1942 pub fn tree_inspect(&self) -> String {
1943 let mut output = String::new();
1944
1945 output.push_str(&format!("{} {} {}\n",
1946 "@".white(),
1947 "UnexpectedCharacterInAttributeNameError".red().bold(),
1948 format!("(location: {})", self.location).dimmed()
1949 ));
1950 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
1951 output.push_str(&format!("{} {}: {}\n", "└──".white(), "character".white(), format_token_value(&self.character)));
1952
1953 output
1954 }
1955}
1956
1957impl ErrorNode for UnexpectedCharacterInAttributeNameError {
1958 fn error_type(&self) -> &str {
1959 &self.error_type
1960 }
1961
1962 fn message(&self) -> &str {
1963 &self.message
1964 }
1965
1966 fn location(&self) -> &Location {
1967 &self.location
1968 }
1969
1970 fn tree_inspect(&self) -> String {
1971 UnexpectedCharacterInAttributeNameError::tree_inspect(self)
1972 }
1973}
1974
1975#[derive(Debug, Clone)]
1976pub struct UnexpectedCharacterInUnquotedAttributeValueError {
1977 pub error_type: String,
1978 pub message: String,
1979 pub location: Location,
1980 pub character: Option<Token>,
1981}
1982
1983#[allow(clippy::too_many_arguments)]
1984impl UnexpectedCharacterInUnquotedAttributeValueError {
1985 pub fn new(
1986 message: String,
1987 location: Location,
1988 character: Option<Token>,
1989 ) -> Self {
1990 Self {
1991 error_type: "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE_ERROR".to_string(),
1992 message,
1993 location,
1994 character,
1995 }
1996 }
1997
1998 pub fn tree_inspect(&self) -> String {
1999 let mut output = String::new();
2000
2001 output.push_str(&format!("{} {} {}\n",
2002 "@".white(),
2003 "UnexpectedCharacterInUnquotedAttributeValueError".red().bold(),
2004 format!("(location: {})", self.location).dimmed()
2005 ));
2006 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2007 output.push_str(&format!("{} {}: {}\n", "└──".white(), "character".white(), format_token_value(&self.character)));
2008
2009 output
2010 }
2011}
2012
2013impl ErrorNode for UnexpectedCharacterInUnquotedAttributeValueError {
2014 fn error_type(&self) -> &str {
2015 &self.error_type
2016 }
2017
2018 fn message(&self) -> &str {
2019 &self.message
2020 }
2021
2022 fn location(&self) -> &Location {
2023 &self.location
2024 }
2025
2026 fn tree_inspect(&self) -> String {
2027 UnexpectedCharacterInUnquotedAttributeValueError::tree_inspect(self)
2028 }
2029}
2030
2031#[derive(Debug, Clone)]
2032pub struct UnexpectedEqualsSignBeforeAttributeNameError {
2033 pub error_type: String,
2034 pub message: String,
2035 pub location: Location,
2036 pub equals: Option<Token>,
2037}
2038
2039#[allow(clippy::too_many_arguments)]
2040impl UnexpectedEqualsSignBeforeAttributeNameError {
2041 pub fn new(
2042 message: String,
2043 location: Location,
2044 equals: Option<Token>,
2045 ) -> Self {
2046 Self {
2047 error_type: "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME_ERROR".to_string(),
2048 message,
2049 location,
2050 equals,
2051 }
2052 }
2053
2054 pub fn tree_inspect(&self) -> String {
2055 let mut output = String::new();
2056
2057 output.push_str(&format!("{} {} {}\n",
2058 "@".white(),
2059 "UnexpectedEqualsSignBeforeAttributeNameError".red().bold(),
2060 format!("(location: {})", self.location).dimmed()
2061 ));
2062 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2063 output.push_str(&format!("{} {}: {}\n", "└──".white(), "equals".white(), format_token_value(&self.equals)));
2064
2065 output
2066 }
2067}
2068
2069impl ErrorNode for UnexpectedEqualsSignBeforeAttributeNameError {
2070 fn error_type(&self) -> &str {
2071 &self.error_type
2072 }
2073
2074 fn message(&self) -> &str {
2075 &self.message
2076 }
2077
2078 fn location(&self) -> &Location {
2079 &self.location
2080 }
2081
2082 fn tree_inspect(&self) -> String {
2083 UnexpectedEqualsSignBeforeAttributeNameError::tree_inspect(self)
2084 }
2085}
2086
2087#[derive(Debug, Clone)]
2088pub struct UnexpectedSolidusInTagError {
2089 pub error_type: String,
2090 pub message: String,
2091 pub location: Location,
2092 pub solidus: Option<Token>,
2093}
2094
2095#[allow(clippy::too_many_arguments)]
2096impl UnexpectedSolidusInTagError {
2097 pub fn new(
2098 message: String,
2099 location: Location,
2100 solidus: Option<Token>,
2101 ) -> Self {
2102 Self {
2103 error_type: "UNEXPECTED_SOLIDUS_IN_TAG_ERROR".to_string(),
2104 message,
2105 location,
2106 solidus,
2107 }
2108 }
2109
2110 pub fn tree_inspect(&self) -> String {
2111 let mut output = String::new();
2112
2113 output.push_str(&format!("{} {} {}\n",
2114 "@".white(),
2115 "UnexpectedSolidusInTagError".red().bold(),
2116 format!("(location: {})", self.location).dimmed()
2117 ));
2118 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2119 output.push_str(&format!("{} {}: {}\n", "└──".white(), "solidus".white(), format_token_value(&self.solidus)));
2120
2121 output
2122 }
2123}
2124
2125impl ErrorNode for UnexpectedSolidusInTagError {
2126 fn error_type(&self) -> &str {
2127 &self.error_type
2128 }
2129
2130 fn message(&self) -> &str {
2131 &self.message
2132 }
2133
2134 fn location(&self) -> &Location {
2135 &self.location
2136 }
2137
2138 fn tree_inspect(&self) -> String {
2139 UnexpectedSolidusInTagError::tree_inspect(self)
2140 }
2141}
2142
2143#[derive(Debug, Clone)]
2144pub struct UnclosedERBTagError {
2145 pub error_type: String,
2146 pub message: String,
2147 pub location: Location,
2148 pub opening_tag: Option<Token>,
2149}
2150
2151#[allow(clippy::too_many_arguments)]
2152impl UnclosedERBTagError {
2153 pub fn new(
2154 message: String,
2155 location: Location,
2156 opening_tag: Option<Token>,
2157 ) -> Self {
2158 Self {
2159 error_type: "UNCLOSED_ERB_TAG_ERROR".to_string(),
2160 message,
2161 location,
2162 opening_tag,
2163 }
2164 }
2165
2166 pub fn tree_inspect(&self) -> String {
2167 let mut output = String::new();
2168
2169 output.push_str(&format!("{} {} {}\n",
2170 "@".white(),
2171 "UnclosedERBTagError".red().bold(),
2172 format!("(location: {})", self.location).dimmed()
2173 ));
2174 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2175 output.push_str(&format!("{} {}: {}\n", "└──".white(), "opening_tag".white(), format_token_value(&self.opening_tag)));
2176
2177 output
2178 }
2179}
2180
2181impl ErrorNode for UnclosedERBTagError {
2182 fn error_type(&self) -> &str {
2183 &self.error_type
2184 }
2185
2186 fn message(&self) -> &str {
2187 &self.message
2188 }
2189
2190 fn location(&self) -> &Location {
2191 &self.location
2192 }
2193
2194 fn tree_inspect(&self) -> String {
2195 UnclosedERBTagError::tree_inspect(self)
2196 }
2197}
2198
2199#[derive(Debug, Clone)]
2200pub struct MalformedERBClosingTagError {
2201 pub error_type: String,
2202 pub message: String,
2203 pub location: Location,
2204 pub opening_tag: Option<Token>,
2205 pub closing_tag: Option<Token>,
2206}
2207
2208#[allow(clippy::too_many_arguments)]
2209impl MalformedERBClosingTagError {
2210 pub fn new(
2211 message: String,
2212 location: Location,
2213 opening_tag: Option<Token>,
2214 closing_tag: Option<Token>,
2215 ) -> Self {
2216 Self {
2217 error_type: "MALFORMED_ERB_CLOSING_TAG_ERROR".to_string(),
2218 message,
2219 location,
2220 opening_tag,
2221 closing_tag,
2222 }
2223 }
2224
2225 pub fn tree_inspect(&self) -> String {
2226 let mut output = String::new();
2227
2228 output.push_str(&format!("{} {} {}\n",
2229 "@".white(),
2230 "MalformedERBClosingTagError".red().bold(),
2231 format!("(location: {})", self.location).dimmed()
2232 ));
2233 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2234 output.push_str(&format!("{} {}: {}\n", "├──".white(), "opening_tag".white(), format_token_value(&self.opening_tag)));
2235 output.push_str(&format!("{} {}: {}\n", "└──".white(), "closing_tag".white(), format_token_value(&self.closing_tag)));
2236
2237 output
2238 }
2239}
2240
2241impl ErrorNode for MalformedERBClosingTagError {
2242 fn error_type(&self) -> &str {
2243 &self.error_type
2244 }
2245
2246 fn message(&self) -> &str {
2247 &self.message
2248 }
2249
2250 fn location(&self) -> &Location {
2251 &self.location
2252 }
2253
2254 fn tree_inspect(&self) -> String {
2255 MalformedERBClosingTagError::tree_inspect(self)
2256 }
2257}
2258
2259#[derive(Debug, Clone)]
2260pub struct StrayERBClosingTagError {
2261 pub error_type: String,
2262 pub message: String,
2263 pub location: Location,
2264}
2265
2266#[allow(clippy::too_many_arguments)]
2267impl StrayERBClosingTagError {
2268 pub fn new(
2269 message: String,
2270 location: Location,
2271 ) -> Self {
2272 Self {
2273 error_type: "STRAY_ERB_CLOSING_TAG_ERROR".to_string(),
2274 message,
2275 location,
2276 }
2277 }
2278
2279 pub fn tree_inspect(&self) -> String {
2280 let mut output = String::new();
2281
2282 output.push_str(&format!("{} {} {}\n",
2283 "@".white(),
2284 "StrayERBClosingTagError".red().bold(),
2285 format!("(location: {})", self.location).dimmed()
2286 ));
2287 output.push_str(&format!("{} {}: {}\n", "└──".white(), "message".white(), format_string_value(&self.message)));
2288
2289 output
2290 }
2291}
2292
2293impl ErrorNode for StrayERBClosingTagError {
2294 fn error_type(&self) -> &str {
2295 &self.error_type
2296 }
2297
2298 fn message(&self) -> &str {
2299 &self.message
2300 }
2301
2302 fn location(&self) -> &Location {
2303 &self.location
2304 }
2305
2306 fn tree_inspect(&self) -> String {
2307 StrayERBClosingTagError::tree_inspect(self)
2308 }
2309}
2310
2311#[derive(Debug, Clone)]
2312pub struct NestedERBTagError {
2313 pub error_type: String,
2314 pub message: String,
2315 pub location: Location,
2316 pub opening_tag: Option<Token>,
2317 pub nested_tag_line: usize,
2318 pub nested_tag_column: usize,
2319}
2320
2321#[allow(clippy::too_many_arguments)]
2322impl NestedERBTagError {
2323 pub fn new(
2324 message: String,
2325 location: Location,
2326 opening_tag: Option<Token>,
2327 nested_tag_line: usize,
2328 nested_tag_column: usize,
2329 ) -> Self {
2330 Self {
2331 error_type: "NESTED_ERB_TAG_ERROR".to_string(),
2332 message,
2333 location,
2334 opening_tag,
2335 nested_tag_line,
2336 nested_tag_column,
2337 }
2338 }
2339
2340 pub fn tree_inspect(&self) -> String {
2341 let mut output = String::new();
2342
2343 output.push_str(&format!("{} {} {}\n",
2344 "@".white(),
2345 "NestedERBTagError".red().bold(),
2346 format!("(location: {})", self.location).dimmed()
2347 ));
2348 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2349 output.push_str(&format!("{} {}: {}\n", "├──".white(), "opening_tag".white(), format_token_value(&self.opening_tag)));
2350 output.push_str(&format!("{} {}: {}\n", "├──".white(), "nested_tag_line".white(), format_size_value(self.nested_tag_line)));
2351 output.push_str(&format!("{} {}: {}\n", "└──".white(), "nested_tag_column".white(), format_size_value(self.nested_tag_column)));
2352
2353 output
2354 }
2355}
2356
2357impl ErrorNode for NestedERBTagError {
2358 fn error_type(&self) -> &str {
2359 &self.error_type
2360 }
2361
2362 fn message(&self) -> &str {
2363 &self.message
2364 }
2365
2366 fn location(&self) -> &Location {
2367 &self.location
2368 }
2369
2370 fn tree_inspect(&self) -> String {
2371 NestedERBTagError::tree_inspect(self)
2372 }
2373}
2374
2375#[derive(Debug, Clone)]
2376pub struct RenderAmbiguousLocalsError {
2377 pub error_type: String,
2378 pub message: String,
2379 pub location: Location,
2380 pub partial: String,
2381}
2382
2383#[allow(clippy::too_many_arguments)]
2384impl RenderAmbiguousLocalsError {
2385 pub fn new(
2386 message: String,
2387 location: Location,
2388 partial: String,
2389 ) -> Self {
2390 Self {
2391 error_type: "RENDER_AMBIGUOUS_LOCALS_ERROR".to_string(),
2392 message,
2393 location,
2394 partial,
2395 }
2396 }
2397
2398 pub fn tree_inspect(&self) -> String {
2399 let mut output = String::new();
2400
2401 output.push_str(&format!("{} {} {}\n",
2402 "@".white(),
2403 "RenderAmbiguousLocalsError".red().bold(),
2404 format!("(location: {})", self.location).dimmed()
2405 ));
2406 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2407 output.push_str(&format!("{} {}: {}\n", "└──".white(), "partial".white(), format_string_value(&self.partial)));
2408
2409 output
2410 }
2411}
2412
2413impl ErrorNode for RenderAmbiguousLocalsError {
2414 fn error_type(&self) -> &str {
2415 &self.error_type
2416 }
2417
2418 fn message(&self) -> &str {
2419 &self.message
2420 }
2421
2422 fn location(&self) -> &Location {
2423 &self.location
2424 }
2425
2426 fn tree_inspect(&self) -> String {
2427 RenderAmbiguousLocalsError::tree_inspect(self)
2428 }
2429}
2430
2431#[derive(Debug, Clone)]
2432pub struct RenderMissingLocalsError {
2433 pub error_type: String,
2434 pub message: String,
2435 pub location: Location,
2436 pub partial: String,
2437 pub keywords: String,
2438}
2439
2440#[allow(clippy::too_many_arguments)]
2441impl RenderMissingLocalsError {
2442 pub fn new(
2443 message: String,
2444 location: Location,
2445 partial: String,
2446 keywords: String,
2447 ) -> Self {
2448 Self {
2449 error_type: "RENDER_MISSING_LOCALS_ERROR".to_string(),
2450 message,
2451 location,
2452 partial,
2453 keywords,
2454 }
2455 }
2456
2457 pub fn tree_inspect(&self) -> String {
2458 let mut output = String::new();
2459
2460 output.push_str(&format!("{} {} {}\n",
2461 "@".white(),
2462 "RenderMissingLocalsError".red().bold(),
2463 format!("(location: {})", self.location).dimmed()
2464 ));
2465 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2466 output.push_str(&format!("{} {}: {}\n", "├──".white(), "partial".white(), format_string_value(&self.partial)));
2467 output.push_str(&format!("{} {}: {}\n", "└──".white(), "keywords".white(), format_string_value(&self.keywords)));
2468
2469 output
2470 }
2471}
2472
2473impl ErrorNode for RenderMissingLocalsError {
2474 fn error_type(&self) -> &str {
2475 &self.error_type
2476 }
2477
2478 fn message(&self) -> &str {
2479 &self.message
2480 }
2481
2482 fn location(&self) -> &Location {
2483 &self.location
2484 }
2485
2486 fn tree_inspect(&self) -> String {
2487 RenderMissingLocalsError::tree_inspect(self)
2488 }
2489}
2490
2491#[derive(Debug, Clone)]
2492pub struct RenderNoArgumentsError {
2493 pub error_type: String,
2494 pub message: String,
2495 pub location: Location,
2496}
2497
2498#[allow(clippy::too_many_arguments)]
2499impl RenderNoArgumentsError {
2500 pub fn new(
2501 message: String,
2502 location: Location,
2503 ) -> Self {
2504 Self {
2505 error_type: "RENDER_NO_ARGUMENTS_ERROR".to_string(),
2506 message,
2507 location,
2508 }
2509 }
2510
2511 pub fn tree_inspect(&self) -> String {
2512 let mut output = String::new();
2513
2514 output.push_str(&format!("{} {} {}\n",
2515 "@".white(),
2516 "RenderNoArgumentsError".red().bold(),
2517 format!("(location: {})", self.location).dimmed()
2518 ));
2519 output.push_str(&format!("{} {}: {}\n", "└──".white(), "message".white(), format_string_value(&self.message)));
2520
2521 output
2522 }
2523}
2524
2525impl ErrorNode for RenderNoArgumentsError {
2526 fn error_type(&self) -> &str {
2527 &self.error_type
2528 }
2529
2530 fn message(&self) -> &str {
2531 &self.message
2532 }
2533
2534 fn location(&self) -> &Location {
2535 &self.location
2536 }
2537
2538 fn tree_inspect(&self) -> String {
2539 RenderNoArgumentsError::tree_inspect(self)
2540 }
2541}
2542
2543#[derive(Debug, Clone)]
2544pub struct RenderConflictingPartialError {
2545 pub error_type: String,
2546 pub message: String,
2547 pub location: Location,
2548 pub positional_partial: String,
2549 pub keyword_partial: String,
2550}
2551
2552#[allow(clippy::too_many_arguments)]
2553impl RenderConflictingPartialError {
2554 pub fn new(
2555 message: String,
2556 location: Location,
2557 positional_partial: String,
2558 keyword_partial: String,
2559 ) -> Self {
2560 Self {
2561 error_type: "RENDER_CONFLICTING_PARTIAL_ERROR".to_string(),
2562 message,
2563 location,
2564 positional_partial,
2565 keyword_partial,
2566 }
2567 }
2568
2569 pub fn tree_inspect(&self) -> String {
2570 let mut output = String::new();
2571
2572 output.push_str(&format!("{} {} {}\n",
2573 "@".white(),
2574 "RenderConflictingPartialError".red().bold(),
2575 format!("(location: {})", self.location).dimmed()
2576 ));
2577 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2578 output.push_str(&format!("{} {}: {}\n", "├──".white(), "positional_partial".white(), format_string_value(&self.positional_partial)));
2579 output.push_str(&format!("{} {}: {}\n", "└──".white(), "keyword_partial".white(), format_string_value(&self.keyword_partial)));
2580
2581 output
2582 }
2583}
2584
2585impl ErrorNode for RenderConflictingPartialError {
2586 fn error_type(&self) -> &str {
2587 &self.error_type
2588 }
2589
2590 fn message(&self) -> &str {
2591 &self.message
2592 }
2593
2594 fn location(&self) -> &Location {
2595 &self.location
2596 }
2597
2598 fn tree_inspect(&self) -> String {
2599 RenderConflictingPartialError::tree_inspect(self)
2600 }
2601}
2602
2603#[derive(Debug, Clone)]
2604pub struct RenderInvalidAsOptionError {
2605 pub error_type: String,
2606 pub message: String,
2607 pub location: Location,
2608 pub as_value: String,
2609}
2610
2611#[allow(clippy::too_many_arguments)]
2612impl RenderInvalidAsOptionError {
2613 pub fn new(
2614 message: String,
2615 location: Location,
2616 as_value: String,
2617 ) -> Self {
2618 Self {
2619 error_type: "RENDER_INVALID_AS_OPTION_ERROR".to_string(),
2620 message,
2621 location,
2622 as_value,
2623 }
2624 }
2625
2626 pub fn tree_inspect(&self) -> String {
2627 let mut output = String::new();
2628
2629 output.push_str(&format!("{} {} {}\n",
2630 "@".white(),
2631 "RenderInvalidAsOptionError".red().bold(),
2632 format!("(location: {})", self.location).dimmed()
2633 ));
2634 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2635 output.push_str(&format!("{} {}: {}\n", "└──".white(), "as_value".white(), format_string_value(&self.as_value)));
2636
2637 output
2638 }
2639}
2640
2641impl ErrorNode for RenderInvalidAsOptionError {
2642 fn error_type(&self) -> &str {
2643 &self.error_type
2644 }
2645
2646 fn message(&self) -> &str {
2647 &self.message
2648 }
2649
2650 fn location(&self) -> &Location {
2651 &self.location
2652 }
2653
2654 fn tree_inspect(&self) -> String {
2655 RenderInvalidAsOptionError::tree_inspect(self)
2656 }
2657}
2658
2659#[derive(Debug, Clone)]
2660pub struct RenderObjectAndCollectionError {
2661 pub error_type: String,
2662 pub message: String,
2663 pub location: Location,
2664}
2665
2666#[allow(clippy::too_many_arguments)]
2667impl RenderObjectAndCollectionError {
2668 pub fn new(
2669 message: String,
2670 location: Location,
2671 ) -> Self {
2672 Self {
2673 error_type: "RENDER_OBJECT_AND_COLLECTION_ERROR".to_string(),
2674 message,
2675 location,
2676 }
2677 }
2678
2679 pub fn tree_inspect(&self) -> String {
2680 let mut output = String::new();
2681
2682 output.push_str(&format!("{} {} {}\n",
2683 "@".white(),
2684 "RenderObjectAndCollectionError".red().bold(),
2685 format!("(location: {})", self.location).dimmed()
2686 ));
2687 output.push_str(&format!("{} {}: {}\n", "└──".white(), "message".white(), format_string_value(&self.message)));
2688
2689 output
2690 }
2691}
2692
2693impl ErrorNode for RenderObjectAndCollectionError {
2694 fn error_type(&self) -> &str {
2695 &self.error_type
2696 }
2697
2698 fn message(&self) -> &str {
2699 &self.message
2700 }
2701
2702 fn location(&self) -> &Location {
2703 &self.location
2704 }
2705
2706 fn tree_inspect(&self) -> String {
2707 RenderObjectAndCollectionError::tree_inspect(self)
2708 }
2709}
2710
2711#[derive(Debug, Clone)]
2712pub struct RenderLayoutWithoutBlockError {
2713 pub error_type: String,
2714 pub message: String,
2715 pub location: Location,
2716 pub layout: String,
2717}
2718
2719#[allow(clippy::too_many_arguments)]
2720impl RenderLayoutWithoutBlockError {
2721 pub fn new(
2722 message: String,
2723 location: Location,
2724 layout: String,
2725 ) -> Self {
2726 Self {
2727 error_type: "RENDER_LAYOUT_WITHOUT_BLOCK_ERROR".to_string(),
2728 message,
2729 location,
2730 layout,
2731 }
2732 }
2733
2734 pub fn tree_inspect(&self) -> String {
2735 let mut output = String::new();
2736
2737 output.push_str(&format!("{} {} {}\n",
2738 "@".white(),
2739 "RenderLayoutWithoutBlockError".red().bold(),
2740 format!("(location: {})", self.location).dimmed()
2741 ));
2742 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2743 output.push_str(&format!("{} {}: {}\n", "└──".white(), "layout".white(), format_string_value(&self.layout)));
2744
2745 output
2746 }
2747}
2748
2749impl ErrorNode for RenderLayoutWithoutBlockError {
2750 fn error_type(&self) -> &str {
2751 &self.error_type
2752 }
2753
2754 fn message(&self) -> &str {
2755 &self.message
2756 }
2757
2758 fn location(&self) -> &Location {
2759 &self.location
2760 }
2761
2762 fn tree_inspect(&self) -> String {
2763 RenderLayoutWithoutBlockError::tree_inspect(self)
2764 }
2765}
2766
2767#[derive(Debug, Clone)]
2768pub struct StrictLocalsPositionalArgumentError {
2769 pub error_type: String,
2770 pub message: String,
2771 pub location: Location,
2772 pub name: String,
2773}
2774
2775#[allow(clippy::too_many_arguments)]
2776impl StrictLocalsPositionalArgumentError {
2777 pub fn new(
2778 message: String,
2779 location: Location,
2780 name: String,
2781 ) -> Self {
2782 Self {
2783 error_type: "STRICT_LOCALS_POSITIONAL_ARGUMENT_ERROR".to_string(),
2784 message,
2785 location,
2786 name,
2787 }
2788 }
2789
2790 pub fn tree_inspect(&self) -> String {
2791 let mut output = String::new();
2792
2793 output.push_str(&format!("{} {} {}\n",
2794 "@".white(),
2795 "StrictLocalsPositionalArgumentError".red().bold(),
2796 format!("(location: {})", self.location).dimmed()
2797 ));
2798 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2799 output.push_str(&format!("{} {}: {}\n", "└──".white(), "name".white(), format_string_value(&self.name)));
2800
2801 output
2802 }
2803}
2804
2805impl ErrorNode for StrictLocalsPositionalArgumentError {
2806 fn error_type(&self) -> &str {
2807 &self.error_type
2808 }
2809
2810 fn message(&self) -> &str {
2811 &self.message
2812 }
2813
2814 fn location(&self) -> &Location {
2815 &self.location
2816 }
2817
2818 fn tree_inspect(&self) -> String {
2819 StrictLocalsPositionalArgumentError::tree_inspect(self)
2820 }
2821}
2822
2823#[derive(Debug, Clone)]
2824pub struct StrictLocalsBlockArgumentError {
2825 pub error_type: String,
2826 pub message: String,
2827 pub location: Location,
2828 pub name: String,
2829}
2830
2831#[allow(clippy::too_many_arguments)]
2832impl StrictLocalsBlockArgumentError {
2833 pub fn new(
2834 message: String,
2835 location: Location,
2836 name: String,
2837 ) -> Self {
2838 Self {
2839 error_type: "STRICT_LOCALS_BLOCK_ARGUMENT_ERROR".to_string(),
2840 message,
2841 location,
2842 name,
2843 }
2844 }
2845
2846 pub fn tree_inspect(&self) -> String {
2847 let mut output = String::new();
2848
2849 output.push_str(&format!("{} {} {}\n",
2850 "@".white(),
2851 "StrictLocalsBlockArgumentError".red().bold(),
2852 format!("(location: {})", self.location).dimmed()
2853 ));
2854 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2855 output.push_str(&format!("{} {}: {}\n", "└──".white(), "name".white(), format_string_value(&self.name)));
2856
2857 output
2858 }
2859}
2860
2861impl ErrorNode for StrictLocalsBlockArgumentError {
2862 fn error_type(&self) -> &str {
2863 &self.error_type
2864 }
2865
2866 fn message(&self) -> &str {
2867 &self.message
2868 }
2869
2870 fn location(&self) -> &Location {
2871 &self.location
2872 }
2873
2874 fn tree_inspect(&self) -> String {
2875 StrictLocalsBlockArgumentError::tree_inspect(self)
2876 }
2877}
2878
2879#[derive(Debug, Clone)]
2880pub struct StrictLocalsSplatArgumentError {
2881 pub error_type: String,
2882 pub message: String,
2883 pub location: Location,
2884 pub name: String,
2885}
2886
2887#[allow(clippy::too_many_arguments)]
2888impl StrictLocalsSplatArgumentError {
2889 pub fn new(
2890 message: String,
2891 location: Location,
2892 name: String,
2893 ) -> Self {
2894 Self {
2895 error_type: "STRICT_LOCALS_SPLAT_ARGUMENT_ERROR".to_string(),
2896 message,
2897 location,
2898 name,
2899 }
2900 }
2901
2902 pub fn tree_inspect(&self) -> String {
2903 let mut output = String::new();
2904
2905 output.push_str(&format!("{} {} {}\n",
2906 "@".white(),
2907 "StrictLocalsSplatArgumentError".red().bold(),
2908 format!("(location: {})", self.location).dimmed()
2909 ));
2910 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2911 output.push_str(&format!("{} {}: {}\n", "└──".white(), "name".white(), format_string_value(&self.name)));
2912
2913 output
2914 }
2915}
2916
2917impl ErrorNode for StrictLocalsSplatArgumentError {
2918 fn error_type(&self) -> &str {
2919 &self.error_type
2920 }
2921
2922 fn message(&self) -> &str {
2923 &self.message
2924 }
2925
2926 fn location(&self) -> &Location {
2927 &self.location
2928 }
2929
2930 fn tree_inspect(&self) -> String {
2931 StrictLocalsSplatArgumentError::tree_inspect(self)
2932 }
2933}
2934
2935#[derive(Debug, Clone)]
2936pub struct StrictLocalsMissingParenthesisError {
2937 pub error_type: String,
2938 pub message: String,
2939 pub location: Location,
2940 pub rest: String,
2941}
2942
2943#[allow(clippy::too_many_arguments)]
2944impl StrictLocalsMissingParenthesisError {
2945 pub fn new(
2946 message: String,
2947 location: Location,
2948 rest: String,
2949 ) -> Self {
2950 Self {
2951 error_type: "STRICT_LOCALS_MISSING_PARENTHESIS_ERROR".to_string(),
2952 message,
2953 location,
2954 rest,
2955 }
2956 }
2957
2958 pub fn tree_inspect(&self) -> String {
2959 let mut output = String::new();
2960
2961 output.push_str(&format!("{} {} {}\n",
2962 "@".white(),
2963 "StrictLocalsMissingParenthesisError".red().bold(),
2964 format!("(location: {})", self.location).dimmed()
2965 ));
2966 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
2967 output.push_str(&format!("{} {}: {}\n", "└──".white(), "rest".white(), format_string_value(&self.rest)));
2968
2969 output
2970 }
2971}
2972
2973impl ErrorNode for StrictLocalsMissingParenthesisError {
2974 fn error_type(&self) -> &str {
2975 &self.error_type
2976 }
2977
2978 fn message(&self) -> &str {
2979 &self.message
2980 }
2981
2982 fn location(&self) -> &Location {
2983 &self.location
2984 }
2985
2986 fn tree_inspect(&self) -> String {
2987 StrictLocalsMissingParenthesisError::tree_inspect(self)
2988 }
2989}
2990
2991#[derive(Debug, Clone)]
2992pub struct StrictLocalsDuplicateDeclarationError {
2993 pub error_type: String,
2994 pub message: String,
2995 pub location: Location,
2996}
2997
2998#[allow(clippy::too_many_arguments)]
2999impl StrictLocalsDuplicateDeclarationError {
3000 pub fn new(
3001 message: String,
3002 location: Location,
3003 ) -> Self {
3004 Self {
3005 error_type: "STRICT_LOCALS_DUPLICATE_DECLARATION_ERROR".to_string(),
3006 message,
3007 location,
3008 }
3009 }
3010
3011 pub fn tree_inspect(&self) -> String {
3012 let mut output = String::new();
3013
3014 output.push_str(&format!("{} {} {}\n",
3015 "@".white(),
3016 "StrictLocalsDuplicateDeclarationError".red().bold(),
3017 format!("(location: {})", self.location).dimmed()
3018 ));
3019 output.push_str(&format!("{} {}: {}\n", "└──".white(), "message".white(), format_string_value(&self.message)));
3020
3021 output
3022 }
3023}
3024
3025impl ErrorNode for StrictLocalsDuplicateDeclarationError {
3026 fn error_type(&self) -> &str {
3027 &self.error_type
3028 }
3029
3030 fn message(&self) -> &str {
3031 &self.message
3032 }
3033
3034 fn location(&self) -> &Location {
3035 &self.location
3036 }
3037
3038 fn tree_inspect(&self) -> String {
3039 StrictLocalsDuplicateDeclarationError::tree_inspect(self)
3040 }
3041}
3042
3043#[derive(Debug, Clone)]
3044pub struct HerbStateMissingParenthesisError {
3045 pub error_type: String,
3046 pub message: String,
3047 pub location: Location,
3048 pub rest: String,
3049}
3050
3051#[allow(clippy::too_many_arguments)]
3052impl HerbStateMissingParenthesisError {
3053 pub fn new(
3054 message: String,
3055 location: Location,
3056 rest: String,
3057 ) -> Self {
3058 Self {
3059 error_type: "HERB_STATE_MISSING_PARENTHESIS_ERROR".to_string(),
3060 message,
3061 location,
3062 rest,
3063 }
3064 }
3065
3066 pub fn tree_inspect(&self) -> String {
3067 let mut output = String::new();
3068
3069 output.push_str(&format!("{} {} {}\n",
3070 "@".white(),
3071 "HerbStateMissingParenthesisError".red().bold(),
3072 format!("(location: {})", self.location).dimmed()
3073 ));
3074 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
3075 output.push_str(&format!("{} {}: {}\n", "└──".white(), "rest".white(), format_string_value(&self.rest)));
3076
3077 output
3078 }
3079}
3080
3081impl ErrorNode for HerbStateMissingParenthesisError {
3082 fn error_type(&self) -> &str {
3083 &self.error_type
3084 }
3085
3086 fn message(&self) -> &str {
3087 &self.message
3088 }
3089
3090 fn location(&self) -> &Location {
3091 &self.location
3092 }
3093
3094 fn tree_inspect(&self) -> String {
3095 HerbStateMissingParenthesisError::tree_inspect(self)
3096 }
3097}
3098
3099#[derive(Debug, Clone)]
3100pub struct HerbStateNonCanonicalDirectiveError {
3101 pub error_type: String,
3102 pub message: String,
3103 pub location: Location,
3104 pub found: String,
3105 pub expected: String,
3106}
3107
3108#[allow(clippy::too_many_arguments)]
3109impl HerbStateNonCanonicalDirectiveError {
3110 pub fn new(
3111 message: String,
3112 location: Location,
3113 found: String,
3114 expected: String,
3115 ) -> Self {
3116 Self {
3117 error_type: "HERB_STATE_NON_CANONICAL_DIRECTIVE_ERROR".to_string(),
3118 message,
3119 location,
3120 found,
3121 expected,
3122 }
3123 }
3124
3125 pub fn tree_inspect(&self) -> String {
3126 let mut output = String::new();
3127
3128 output.push_str(&format!("{} {} {}\n",
3129 "@".white(),
3130 "HerbStateNonCanonicalDirectiveError".red().bold(),
3131 format!("(location: {})", self.location).dimmed()
3132 ));
3133 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
3134 output.push_str(&format!("{} {}: {}\n", "├──".white(), "found".white(), format_string_value(&self.found)));
3135 output.push_str(&format!("{} {}: {}\n", "└──".white(), "expected".white(), format_string_value(&self.expected)));
3136
3137 output
3138 }
3139}
3140
3141impl ErrorNode for HerbStateNonCanonicalDirectiveError {
3142 fn error_type(&self) -> &str {
3143 &self.error_type
3144 }
3145
3146 fn message(&self) -> &str {
3147 &self.message
3148 }
3149
3150 fn location(&self) -> &Location {
3151 &self.location
3152 }
3153
3154 fn tree_inspect(&self) -> String {
3155 HerbStateNonCanonicalDirectiveError::tree_inspect(self)
3156 }
3157}
3158
3159#[derive(Debug, Clone)]
3160pub struct HerbStateInvalidParameterError {
3161 pub error_type: String,
3162 pub message: String,
3163 pub location: Location,
3164 pub parameter: String,
3165}
3166
3167#[allow(clippy::too_many_arguments)]
3168impl HerbStateInvalidParameterError {
3169 pub fn new(
3170 message: String,
3171 location: Location,
3172 parameter: String,
3173 ) -> Self {
3174 Self {
3175 error_type: "HERB_STATE_INVALID_PARAMETER_ERROR".to_string(),
3176 message,
3177 location,
3178 parameter,
3179 }
3180 }
3181
3182 pub fn tree_inspect(&self) -> String {
3183 let mut output = String::new();
3184
3185 output.push_str(&format!("{} {} {}\n",
3186 "@".white(),
3187 "HerbStateInvalidParameterError".red().bold(),
3188 format!("(location: {})", self.location).dimmed()
3189 ));
3190 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
3191 output.push_str(&format!("{} {}: {}\n", "└──".white(), "parameter".white(), format_string_value(&self.parameter)));
3192
3193 output
3194 }
3195}
3196
3197impl ErrorNode for HerbStateInvalidParameterError {
3198 fn error_type(&self) -> &str {
3199 &self.error_type
3200 }
3201
3202 fn message(&self) -> &str {
3203 &self.message
3204 }
3205
3206 fn location(&self) -> &Location {
3207 &self.location
3208 }
3209
3210 fn tree_inspect(&self) -> String {
3211 HerbStateInvalidParameterError::tree_inspect(self)
3212 }
3213}
3214
3215#[derive(Debug, Clone)]
3216pub struct HerbStateDuplicateDeclarationError {
3217 pub error_type: String,
3218 pub message: String,
3219 pub location: Location,
3220}
3221
3222#[allow(clippy::too_many_arguments)]
3223impl HerbStateDuplicateDeclarationError {
3224 pub fn new(
3225 message: String,
3226 location: Location,
3227 ) -> Self {
3228 Self {
3229 error_type: "HERB_STATE_DUPLICATE_DECLARATION_ERROR".to_string(),
3230 message,
3231 location,
3232 }
3233 }
3234
3235 pub fn tree_inspect(&self) -> String {
3236 let mut output = String::new();
3237
3238 output.push_str(&format!("{} {} {}\n",
3239 "@".white(),
3240 "HerbStateDuplicateDeclarationError".red().bold(),
3241 format!("(location: {})", self.location).dimmed()
3242 ));
3243 output.push_str(&format!("{} {}: {}\n", "└──".white(), "message".white(), format_string_value(&self.message)));
3244
3245 output
3246 }
3247}
3248
3249impl ErrorNode for HerbStateDuplicateDeclarationError {
3250 fn error_type(&self) -> &str {
3251 &self.error_type
3252 }
3253
3254 fn message(&self) -> &str {
3255 &self.message
3256 }
3257
3258 fn location(&self) -> &Location {
3259 &self.location
3260 }
3261
3262 fn tree_inspect(&self) -> String {
3263 HerbStateDuplicateDeclarationError::tree_inspect(self)
3264 }
3265}
3266
3267#[derive(Debug, Clone)]
3268pub struct VoidElementContentError {
3269 pub error_type: String,
3270 pub message: String,
3271 pub location: Location,
3272 pub tag_name: Option<Token>,
3273 pub helper_name: String,
3274 pub content_type: String,
3275}
3276
3277#[allow(clippy::too_many_arguments)]
3278impl VoidElementContentError {
3279 pub fn new(
3280 message: String,
3281 location: Location,
3282 tag_name: Option<Token>,
3283 helper_name: String,
3284 content_type: String,
3285 ) -> Self {
3286 Self {
3287 error_type: "VOID_ELEMENT_CONTENT_ERROR".to_string(),
3288 message,
3289 location,
3290 tag_name,
3291 helper_name,
3292 content_type,
3293 }
3294 }
3295
3296 pub fn tree_inspect(&self) -> String {
3297 let mut output = String::new();
3298
3299 output.push_str(&format!("{} {} {}\n",
3300 "@".white(),
3301 "VoidElementContentError".red().bold(),
3302 format!("(location: {})", self.location).dimmed()
3303 ));
3304 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
3305 output.push_str(&format!("{} {}: {}\n", "├──".white(), "tag_name".white(), format_token_value(&self.tag_name)));
3306 output.push_str(&format!("{} {}: {}\n", "├──".white(), "helper_name".white(), format_string_value(&self.helper_name)));
3307 output.push_str(&format!("{} {}: {}\n", "└──".white(), "content_type".white(), format_string_value(&self.content_type)));
3308
3309 output
3310 }
3311}
3312
3313impl ErrorNode for VoidElementContentError {
3314 fn error_type(&self) -> &str {
3315 &self.error_type
3316 }
3317
3318 fn message(&self) -> &str {
3319 &self.message
3320 }
3321
3322 fn location(&self) -> &Location {
3323 &self.location
3324 }
3325
3326 fn tree_inspect(&self) -> String {
3327 VoidElementContentError::tree_inspect(self)
3328 }
3329}
3330
3331#[derive(Debug, Clone)]
3332pub struct DotNotationCasingError {
3333 pub error_type: String,
3334 pub message: String,
3335 pub location: Location,
3336 pub segment: Option<Token>,
3337}
3338
3339#[allow(clippy::too_many_arguments)]
3340impl DotNotationCasingError {
3341 pub fn new(
3342 message: String,
3343 location: Location,
3344 segment: Option<Token>,
3345 ) -> Self {
3346 Self {
3347 error_type: "DOT_NOTATION_CASING_ERROR".to_string(),
3348 message,
3349 location,
3350 segment,
3351 }
3352 }
3353
3354 pub fn tree_inspect(&self) -> String {
3355 let mut output = String::new();
3356
3357 output.push_str(&format!("{} {} {}\n",
3358 "@".white(),
3359 "DotNotationCasingError".red().bold(),
3360 format!("(location: {})", self.location).dimmed()
3361 ));
3362 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
3363 output.push_str(&format!("{} {}: {}\n", "└──".white(), "segment".white(), format_token_value(&self.segment)));
3364
3365 output
3366 }
3367}
3368
3369impl ErrorNode for DotNotationCasingError {
3370 fn error_type(&self) -> &str {
3371 &self.error_type
3372 }
3373
3374 fn message(&self) -> &str {
3375 &self.message
3376 }
3377
3378 fn location(&self) -> &Location {
3379 &self.location
3380 }
3381
3382 fn tree_inspect(&self) -> String {
3383 DotNotationCasingError::tree_inspect(self)
3384 }
3385}
3386
3387#[derive(Debug, Clone)]
3388pub struct TimeoutError {
3389 pub error_type: String,
3390 pub message: String,
3391 pub location: Location,
3392 pub timeout_ms: usize,
3393}
3394
3395#[allow(clippy::too_many_arguments)]
3396impl TimeoutError {
3397 pub fn new(
3398 message: String,
3399 location: Location,
3400 timeout_ms: usize,
3401 ) -> Self {
3402 Self {
3403 error_type: "TIMEOUT_ERROR".to_string(),
3404 message,
3405 location,
3406 timeout_ms,
3407 }
3408 }
3409
3410 pub fn tree_inspect(&self) -> String {
3411 let mut output = String::new();
3412
3413 output.push_str(&format!("{} {} {}\n",
3414 "@".white(),
3415 "TimeoutError".red().bold(),
3416 format!("(location: {})", self.location).dimmed()
3417 ));
3418 output.push_str(&format!("{} {}: {}\n", "├──".white(), "message".white(), format_string_value(&self.message)));
3419 output.push_str(&format!("{} {}: {}\n", "└──".white(), "timeout_ms".white(), format_size_value(self.timeout_ms)));
3420
3421 output
3422 }
3423}
3424
3425impl ErrorNode for TimeoutError {
3426 fn error_type(&self) -> &str {
3427 &self.error_type
3428 }
3429
3430 fn message(&self) -> &str {
3431 &self.message
3432 }
3433
3434 fn location(&self) -> &Location {
3435 &self.location
3436 }
3437
3438 fn tree_inspect(&self) -> String {
3439 TimeoutError::tree_inspect(self)
3440 }
3441}
3442