herb 0.8.10-arm-linux-gnu → 0.9.1-arm-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +11 -3
- data/README.md +64 -34
- data/Rakefile +48 -40
- data/config.yml +473 -34
- data/ext/herb/error_helpers.c +535 -140
- data/ext/herb/error_helpers.h +1 -0
- data/ext/herb/extconf.rb +67 -28
- data/ext/herb/extension.c +321 -51
- data/ext/herb/extension.h +1 -0
- data/ext/herb/extension_helpers.c +24 -14
- data/ext/herb/extension_helpers.h +2 -2
- data/ext/herb/nodes.c +647 -270
- data/ext/herb/nodes.h +1 -0
- data/herb.gemspec +3 -2
- data/lib/herb/3.0/herb.so +0 -0
- data/lib/herb/3.1/herb.so +0 -0
- data/lib/herb/3.2/herb.so +0 -0
- data/lib/herb/3.3/herb.so +0 -0
- data/lib/herb/3.4/herb.so +0 -0
- data/lib/herb/4.0/herb.so +0 -0
- data/lib/herb/ast/helpers.rb +3 -3
- data/lib/herb/ast/node.rb +15 -2
- data/lib/herb/ast/nodes.rb +1530 -179
- data/lib/herb/bootstrap.rb +87 -0
- data/lib/herb/cli.rb +341 -31
- data/lib/herb/configuration.rb +248 -0
- data/lib/herb/defaults.yml +32 -0
- data/lib/herb/engine/compiler.rb +78 -11
- data/lib/herb/engine/debug_visitor.rb +13 -3
- data/lib/herb/engine/error_formatter.rb +13 -9
- data/lib/herb/engine/parser_error_overlay.rb +10 -6
- data/lib/herb/engine/validator.rb +8 -3
- data/lib/herb/engine/validators/nesting_validator.rb +2 -2
- data/lib/herb/engine.rb +119 -43
- data/lib/herb/errors.rb +808 -88
- data/lib/herb/lex_result.rb +1 -0
- data/lib/herb/location.rb +7 -3
- data/lib/herb/parse_result.rb +12 -2
- data/lib/herb/parser_options.rb +62 -0
- data/lib/herb/position.rb +1 -0
- data/lib/herb/prism_inspect.rb +120 -0
- data/lib/herb/project.rb +923 -331
- data/lib/herb/range.rb +1 -0
- data/lib/herb/token.rb +7 -1
- data/lib/herb/version.rb +1 -1
- data/lib/herb/visitor.rb +47 -2
- data/lib/herb/warnings.rb +6 -1
- data/lib/herb.rb +35 -3
- data/sig/herb/ast/helpers.rbs +2 -2
- data/sig/herb/ast/node.rbs +12 -2
- data/sig/herb/ast/nodes.rbs +773 -128
- data/sig/herb/bootstrap.rbs +31 -0
- data/sig/herb/configuration.rbs +89 -0
- data/sig/herb/engine/compiler.rbs +9 -1
- data/sig/herb/engine/debug_visitor.rbs +2 -0
- data/sig/herb/engine/validator.rbs +5 -1
- data/sig/herb/engine.rbs +21 -3
- data/sig/herb/errors.rbs +372 -63
- data/sig/herb/location.rbs +4 -0
- data/sig/herb/parse_result.rbs +4 -2
- data/sig/herb/parser_options.rbs +46 -0
- data/sig/herb/position.rbs +1 -0
- data/sig/herb/prism_inspect.rbs +28 -0
- data/sig/herb/range.rbs +1 -0
- data/sig/herb/token.rbs +6 -0
- data/sig/herb/visitor.rbs +31 -4
- data/sig/herb/warnings.rbs +6 -1
- data/sig/herb.rbs +14 -0
- data/sig/herb_c_extension.rbs +5 -2
- data/sig/rubyvm.rbs +5 -0
- data/sig/serialized_ast_errors.rbs +82 -6
- data/sig/serialized_ast_nodes.rbs +91 -6
- data/src/analyze/action_view/attribute_extraction_helpers.c +303 -0
- data/src/analyze/action_view/content_tag.c +78 -0
- data/src/analyze/action_view/link_to.c +167 -0
- data/src/analyze/action_view/registry.c +83 -0
- data/src/analyze/action_view/tag.c +70 -0
- data/src/analyze/action_view/tag_helper_node_builders.c +305 -0
- data/src/analyze/action_view/tag_helpers.c +815 -0
- data/src/analyze/action_view/turbo_frame_tag.c +88 -0
- data/src/analyze/analyze.c +885 -0
- data/src/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
- data/src/analyze/builders.c +343 -0
- data/src/analyze/conditional_elements.c +594 -0
- data/src/analyze/conditional_open_tags.c +640 -0
- data/src/analyze/control_type.c +250 -0
- data/src/{analyze_helpers.c → analyze/helpers.c} +48 -23
- data/src/analyze/invalid_structures.c +193 -0
- data/src/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
- data/src/analyze/parse_errors.c +84 -0
- data/src/analyze/prism_annotate.c +399 -0
- data/src/analyze/render_nodes.c +761 -0
- data/src/{analyze_transform.c → analyze/transform.c} +24 -3
- data/src/ast_node.c +17 -7
- data/src/ast_nodes.c +759 -387
- data/src/ast_pretty_print.c +264 -6
- data/src/errors.c +1454 -519
- data/src/extract.c +145 -49
- data/src/herb.c +52 -34
- data/src/html_util.c +241 -12
- data/src/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
- data/src/include/analyze/action_view/tag_helper_handler.h +43 -0
- data/src/include/analyze/action_view/tag_helper_node_builders.h +70 -0
- data/src/include/analyze/action_view/tag_helpers.h +38 -0
- data/src/include/{analyze.h → analyze/analyze.h} +14 -4
- data/src/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
- data/src/include/analyze/builders.h +27 -0
- data/src/include/analyze/conditional_elements.h +9 -0
- data/src/include/analyze/conditional_open_tags.h +9 -0
- data/src/include/analyze/control_type.h +14 -0
- data/src/include/{analyze_helpers.h → analyze/helpers.h} +4 -2
- data/src/include/analyze/invalid_structures.h +11 -0
- data/src/include/analyze/prism_annotate.h +16 -0
- data/src/include/analyze/render_nodes.h +11 -0
- data/src/include/ast_node.h +11 -5
- data/src/include/ast_nodes.h +154 -38
- data/src/include/ast_pretty_print.h +5 -0
- data/src/include/element_source.h +3 -8
- data/src/include/errors.h +206 -55
- data/src/include/extract.h +21 -5
- data/src/include/herb.h +18 -6
- data/src/include/herb_prism_node.h +13 -0
- data/src/include/html_util.h +7 -2
- data/src/include/io.h +3 -1
- data/src/include/lex_helpers.h +29 -0
- data/src/include/lexer.h +1 -1
- data/src/include/lexer_peek_helpers.h +87 -13
- data/src/include/lexer_struct.h +2 -0
- data/src/include/location.h +2 -1
- data/src/include/parser.h +28 -2
- data/src/include/parser_helpers.h +19 -3
- data/src/include/pretty_print.h +10 -5
- data/src/include/prism_context.h +45 -0
- data/src/include/prism_helpers.h +10 -7
- data/src/include/prism_serialized.h +12 -0
- data/src/include/token.h +16 -4
- data/src/include/token_struct.h +10 -3
- data/src/include/utf8.h +2 -1
- data/src/include/util/hb_allocator.h +78 -0
- data/src/include/util/hb_arena.h +6 -1
- data/src/include/util/hb_arena_debug.h +12 -1
- data/src/include/util/hb_array.h +7 -3
- data/src/include/util/hb_buffer.h +6 -4
- data/src/include/util/hb_foreach.h +79 -0
- data/src/include/util/hb_narray.h +8 -4
- data/src/include/util/hb_string.h +56 -9
- data/src/include/util.h +6 -3
- data/src/include/version.h +1 -1
- data/src/io.c +3 -2
- data/src/lexer.c +42 -30
- data/src/lexer_peek_helpers.c +12 -74
- data/src/location.c +2 -2
- data/src/main.c +53 -28
- data/src/parser.c +784 -247
- data/src/parser_helpers.c +110 -23
- data/src/parser_match_tags.c +129 -48
- data/src/pretty_print.c +29 -24
- data/src/prism_helpers.c +30 -27
- data/src/ruby_parser.c +2 -0
- data/src/token.c +151 -66
- data/src/token_matchers.c +0 -1
- data/src/utf8.c +7 -6
- data/src/util/hb_allocator.c +341 -0
- data/src/util/hb_arena.c +81 -56
- data/src/util/hb_arena_debug.c +32 -17
- data/src/util/hb_array.c +30 -15
- data/src/util/hb_buffer.c +17 -21
- data/src/util/hb_narray.c +22 -7
- data/src/util/hb_string.c +49 -35
- data/src/util.c +21 -11
- data/src/visitor.c +67 -0
- data/templates/ext/herb/error_helpers.c.erb +24 -11
- data/templates/ext/herb/error_helpers.h.erb +1 -0
- data/templates/ext/herb/nodes.c.erb +50 -16
- data/templates/ext/herb/nodes.h.erb +1 -0
- data/templates/java/error_helpers.c.erb +1 -1
- data/templates/java/nodes.c.erb +30 -8
- data/templates/java/org/herb/ast/Errors.java.erb +24 -1
- data/templates/java/org/herb/ast/Nodes.java.erb +80 -21
- data/templates/javascript/packages/core/src/errors.ts.erb +16 -3
- data/templates/javascript/packages/core/src/node-type-guards.ts.erb +3 -1
- data/templates/javascript/packages/core/src/nodes.ts.erb +109 -32
- data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +13 -4
- data/templates/javascript/packages/node/extension/nodes.cpp.erb +43 -4
- data/templates/lib/herb/ast/nodes.rb.erb +95 -32
- data/templates/lib/herb/errors.rb.erb +15 -3
- data/templates/lib/herb/visitor.rb.erb +2 -2
- data/templates/rust/src/ast/nodes.rs.erb +97 -44
- data/templates/rust/src/errors.rs.erb +2 -1
- data/templates/rust/src/nodes.rs.erb +168 -16
- data/templates/rust/src/union_types.rs.erb +60 -0
- data/templates/rust/src/visitor.rs.erb +81 -0
- data/templates/src/{analyze_missing_end.c.erb → analyze/missing_end.c.erb} +9 -6
- data/templates/src/{analyze_transform.c.erb → analyze/transform.c.erb} +2 -2
- data/templates/src/ast_nodes.c.erb +34 -26
- data/templates/src/ast_pretty_print.c.erb +24 -5
- data/templates/src/errors.c.erb +60 -54
- data/templates/src/include/ast_nodes.h.erb +6 -2
- data/templates/src/include/ast_pretty_print.h.erb +5 -0
- data/templates/src/include/errors.h.erb +15 -11
- data/templates/src/include/util/hb_foreach.h.erb +20 -0
- data/templates/src/parser_match_tags.c.erb +10 -4
- data/templates/src/visitor.c.erb +2 -2
- data/templates/template.rb +204 -29
- data/templates/wasm/error_helpers.cpp.erb +9 -5
- data/templates/wasm/nodes.cpp.erb +41 -4
- metadata +60 -16
- data/src/analyze.c +0 -1608
- data/src/element_source.c +0 -12
- data/src/include/util/hb_system.h +0 -9
- data/src/util/hb_system.c +0 -30
data/lib/herb/errors.rb
CHANGED
|
@@ -5,13 +5,18 @@
|
|
|
5
5
|
# modified manually. See /home/runner/work/herb/herb/templates/lib/herb/errors.rb.erb
|
|
6
6
|
|
|
7
7
|
module Herb
|
|
8
|
+
#: type serialized_error = {
|
|
9
|
+
#| type: String,
|
|
10
|
+
#| location: serialized_location?,
|
|
11
|
+
#| message: String
|
|
12
|
+
#| }
|
|
8
13
|
module Errors
|
|
9
14
|
class Error
|
|
10
15
|
attr_reader :type #: String
|
|
11
|
-
attr_reader :location #: Location
|
|
16
|
+
attr_reader :location #: Location?
|
|
12
17
|
attr_reader :message #: String
|
|
13
18
|
|
|
14
|
-
#: (String, Location
|
|
19
|
+
#: (String, Location?, String) -> void
|
|
15
20
|
def initialize(type, location, message)
|
|
16
21
|
@type = type
|
|
17
22
|
@location = location
|
|
@@ -51,11 +56,16 @@ module Herb
|
|
|
51
56
|
class UnexpectedError < Error
|
|
52
57
|
include Colors
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
#| description: String?,
|
|
60
|
+
#| expected: String?,
|
|
61
|
+
#| found: String?,
|
|
62
|
+
#| }
|
|
57
63
|
|
|
58
|
-
|
|
64
|
+
attr_reader :description #: String?
|
|
65
|
+
attr_reader :expected #: String?
|
|
66
|
+
attr_reader :found #: String?
|
|
67
|
+
|
|
68
|
+
#: (String, Location?, String, String, String, String) -> void
|
|
59
69
|
def initialize(type, location, message, description, expected, found)
|
|
60
70
|
super(type, location, message)
|
|
61
71
|
@description = description
|
|
@@ -81,7 +91,7 @@ module Herb
|
|
|
81
91
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
82
92
|
output = +""
|
|
83
93
|
|
|
84
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
94
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
85
95
|
output += white("├── message: #{green(message.inspect)}\n")
|
|
86
96
|
output += white("├── description: #{green(description.inspect)}\n")
|
|
87
97
|
output += white("├── expected: #{green(expected.inspect)}\n")
|
|
@@ -95,10 +105,14 @@ module Herb
|
|
|
95
105
|
class UnexpectedTokenError < Error
|
|
96
106
|
include Colors
|
|
97
107
|
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
#| expected_type: String?,
|
|
109
|
+
#| found: Herb::Token?,
|
|
110
|
+
#| }
|
|
111
|
+
|
|
112
|
+
attr_reader :expected_type #: String?
|
|
113
|
+
attr_reader :found #: Herb::Token?
|
|
100
114
|
|
|
101
|
-
#: (String, Location
|
|
115
|
+
#: (String, Location?, String, String, Herb::Token) -> void
|
|
102
116
|
def initialize(type, location, message, expected_type, found)
|
|
103
117
|
super(type, location, message)
|
|
104
118
|
@expected_type = expected_type
|
|
@@ -122,7 +136,7 @@ module Herb
|
|
|
122
136
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
123
137
|
output = +""
|
|
124
138
|
|
|
125
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
139
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
126
140
|
output += white("├── message: #{green(message.inspect)}\n")
|
|
127
141
|
output += white("├── expected_type: #{green(expected_type.inspect)}\n")
|
|
128
142
|
output += white("└── found: ")
|
|
@@ -137,9 +151,12 @@ module Herb
|
|
|
137
151
|
class MissingOpeningTagError < Error
|
|
138
152
|
include Colors
|
|
139
153
|
|
|
140
|
-
|
|
154
|
+
#| closing_tag: Herb::Token?,
|
|
155
|
+
#| }
|
|
141
156
|
|
|
142
|
-
|
|
157
|
+
attr_reader :closing_tag #: Herb::Token?
|
|
158
|
+
|
|
159
|
+
#: (String, Location?, String, Herb::Token) -> void
|
|
143
160
|
def initialize(type, location, message, closing_tag)
|
|
144
161
|
super(type, location, message)
|
|
145
162
|
@closing_tag = closing_tag
|
|
@@ -161,7 +178,7 @@ module Herb
|
|
|
161
178
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
162
179
|
output = +""
|
|
163
180
|
|
|
164
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
181
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
165
182
|
output += white("├── message: #{green(message.inspect)}\n")
|
|
166
183
|
output += white("└── closing_tag: ")
|
|
167
184
|
output += closing_tag ? closing_tag.tree_inspect : magenta("∅")
|
|
@@ -175,9 +192,12 @@ module Herb
|
|
|
175
192
|
class MissingClosingTagError < Error
|
|
176
193
|
include Colors
|
|
177
194
|
|
|
178
|
-
|
|
195
|
+
#| opening_tag: Herb::Token?,
|
|
196
|
+
#| }
|
|
197
|
+
|
|
198
|
+
attr_reader :opening_tag #: Herb::Token?
|
|
179
199
|
|
|
180
|
-
#: (String, Location
|
|
200
|
+
#: (String, Location?, String, Herb::Token) -> void
|
|
181
201
|
def initialize(type, location, message, opening_tag)
|
|
182
202
|
super(type, location, message)
|
|
183
203
|
@opening_tag = opening_tag
|
|
@@ -199,7 +219,7 @@ module Herb
|
|
|
199
219
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
200
220
|
output = +""
|
|
201
221
|
|
|
202
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
222
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
203
223
|
output += white("├── message: #{green(message.inspect)}\n")
|
|
204
224
|
output += white("└── opening_tag: ")
|
|
205
225
|
output += opening_tag ? opening_tag.tree_inspect : magenta("∅")
|
|
@@ -213,10 +233,14 @@ module Herb
|
|
|
213
233
|
class TagNamesMismatchError < Error
|
|
214
234
|
include Colors
|
|
215
235
|
|
|
216
|
-
|
|
217
|
-
|
|
236
|
+
#| opening_tag: Herb::Token?,
|
|
237
|
+
#| closing_tag: Herb::Token?,
|
|
238
|
+
#| }
|
|
218
239
|
|
|
219
|
-
|
|
240
|
+
attr_reader :opening_tag #: Herb::Token?
|
|
241
|
+
attr_reader :closing_tag #: Herb::Token?
|
|
242
|
+
|
|
243
|
+
#: (String, Location?, String, Herb::Token, Herb::Token) -> void
|
|
220
244
|
def initialize(type, location, message, opening_tag, closing_tag)
|
|
221
245
|
super(type, location, message)
|
|
222
246
|
@opening_tag = opening_tag
|
|
@@ -240,7 +264,7 @@ module Herb
|
|
|
240
264
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
241
265
|
output = +""
|
|
242
266
|
|
|
243
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
267
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
244
268
|
output += white("├── message: #{green(message.inspect)}\n")
|
|
245
269
|
output += white("├── opening_tag: ")
|
|
246
270
|
output += opening_tag ? opening_tag.tree_inspect : magenta("∅")
|
|
@@ -254,58 +278,19 @@ module Herb
|
|
|
254
278
|
end
|
|
255
279
|
end
|
|
256
280
|
|
|
257
|
-
class QuotesMismatchError < Error
|
|
258
|
-
include Colors
|
|
259
|
-
|
|
260
|
-
attr_reader :opening_quote #: Herb::Token
|
|
261
|
-
attr_reader :closing_quote #: Herb::Token
|
|
262
|
-
|
|
263
|
-
#: (String, Location, String, Herb::Token, Herb::Token) -> void
|
|
264
|
-
def initialize(type, location, message, opening_quote, closing_quote)
|
|
265
|
-
super(type, location, message)
|
|
266
|
-
@opening_quote = opening_quote
|
|
267
|
-
@closing_quote = closing_quote
|
|
268
|
-
end
|
|
269
|
-
|
|
270
|
-
#: () -> String
|
|
271
|
-
def inspect
|
|
272
|
-
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
273
|
-
end
|
|
274
|
-
|
|
275
|
-
#: () -> serialized_quotes_mismatch_error
|
|
276
|
-
def to_hash
|
|
277
|
-
super.merge(
|
|
278
|
-
opening_quote: opening_quote,
|
|
279
|
-
closing_quote: closing_quote
|
|
280
|
-
) #: Herb::serialized_quotes_mismatch_error
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
284
|
-
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
285
|
-
output = +""
|
|
286
|
-
|
|
287
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location.tree_inspect})\n")}")
|
|
288
|
-
output += white("├── message: #{green(message.inspect)}\n")
|
|
289
|
-
output += white("├── opening_quote: ")
|
|
290
|
-
output += opening_quote ? opening_quote.tree_inspect : magenta("∅")
|
|
291
|
-
output += "\n"
|
|
292
|
-
output += white("└── closing_quote: ")
|
|
293
|
-
output += closing_quote ? closing_quote.tree_inspect : magenta("∅")
|
|
294
|
-
output += "\n"
|
|
295
|
-
output += %(\n)
|
|
296
|
-
|
|
297
|
-
output.gsub(/^/, " " * indent)
|
|
298
|
-
end
|
|
299
|
-
end
|
|
300
|
-
|
|
301
281
|
class VoidElementClosingTagError < Error
|
|
302
282
|
include Colors
|
|
303
283
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
284
|
+
#| tag_name: Herb::Token?,
|
|
285
|
+
#| expected: String?,
|
|
286
|
+
#| found: String?,
|
|
287
|
+
#| }
|
|
288
|
+
|
|
289
|
+
attr_reader :tag_name #: Herb::Token?
|
|
290
|
+
attr_reader :expected #: String?
|
|
291
|
+
attr_reader :found #: String?
|
|
307
292
|
|
|
308
|
-
#: (String, Location
|
|
293
|
+
#: (String, Location?, String, Herb::Token, String, String) -> void
|
|
309
294
|
def initialize(type, location, message, tag_name, expected, found)
|
|
310
295
|
super(type, location, message)
|
|
311
296
|
@tag_name = tag_name
|
|
@@ -331,7 +316,7 @@ module Herb
|
|
|
331
316
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
332
317
|
output = +""
|
|
333
318
|
|
|
334
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
319
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
335
320
|
output += white("├── message: #{green(message.inspect)}\n")
|
|
336
321
|
output += white("├── tag_name: ")
|
|
337
322
|
output += tag_name ? tag_name.tree_inspect : magenta("∅")
|
|
@@ -347,9 +332,12 @@ module Herb
|
|
|
347
332
|
class UnclosedElementError < Error
|
|
348
333
|
include Colors
|
|
349
334
|
|
|
350
|
-
|
|
335
|
+
#| opening_tag: Herb::Token?,
|
|
336
|
+
#| }
|
|
351
337
|
|
|
352
|
-
|
|
338
|
+
attr_reader :opening_tag #: Herb::Token?
|
|
339
|
+
|
|
340
|
+
#: (String, Location?, String, Herb::Token) -> void
|
|
353
341
|
def initialize(type, location, message, opening_tag)
|
|
354
342
|
super(type, location, message)
|
|
355
343
|
@opening_tag = opening_tag
|
|
@@ -371,7 +359,7 @@ module Herb
|
|
|
371
359
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
372
360
|
output = +""
|
|
373
361
|
|
|
374
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
362
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
375
363
|
output += white("├── message: #{green(message.inspect)}\n")
|
|
376
364
|
output += white("└── opening_tag: ")
|
|
377
365
|
output += opening_tag ? opening_tag.tree_inspect : magenta("∅")
|
|
@@ -385,11 +373,16 @@ module Herb
|
|
|
385
373
|
class RubyParseError < Error
|
|
386
374
|
include Colors
|
|
387
375
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
376
|
+
#| error_message: String?,
|
|
377
|
+
#| diagnostic_id: String?,
|
|
378
|
+
#| level: String?,
|
|
379
|
+
#| }
|
|
380
|
+
|
|
381
|
+
attr_reader :error_message #: String?
|
|
382
|
+
attr_reader :diagnostic_id #: String?
|
|
383
|
+
attr_reader :level #: String?
|
|
391
384
|
|
|
392
|
-
#: (String, Location
|
|
385
|
+
#: (String, Location?, String, String, String, String) -> void
|
|
393
386
|
def initialize(type, location, message, error_message, diagnostic_id, level)
|
|
394
387
|
super(type, location, message)
|
|
395
388
|
@error_message = error_message
|
|
@@ -415,7 +408,7 @@ module Herb
|
|
|
415
408
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
416
409
|
output = +""
|
|
417
410
|
|
|
418
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
411
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
419
412
|
output += white("├── message: #{green(message.inspect)}\n")
|
|
420
413
|
output += white("├── error_message: #{green(error_message.inspect)}\n")
|
|
421
414
|
output += white("├── diagnostic_id: #{green(diagnostic_id.inspect)}\n")
|
|
@@ -429,9 +422,12 @@ module Herb
|
|
|
429
422
|
class ERBControlFlowScopeError < Error
|
|
430
423
|
include Colors
|
|
431
424
|
|
|
432
|
-
|
|
425
|
+
#| keyword: String?,
|
|
426
|
+
#| }
|
|
433
427
|
|
|
434
|
-
|
|
428
|
+
attr_reader :keyword #: String?
|
|
429
|
+
|
|
430
|
+
#: (String, Location?, String, String) -> void
|
|
435
431
|
def initialize(type, location, message, keyword)
|
|
436
432
|
super(type, location, message)
|
|
437
433
|
@keyword = keyword
|
|
@@ -453,7 +449,7 @@ module Herb
|
|
|
453
449
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
454
450
|
output = +""
|
|
455
451
|
|
|
456
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
452
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
457
453
|
output += white("├── message: #{green(message.inspect)}\n")
|
|
458
454
|
output += white("└── keyword: #{green(keyword.inspect)}\n")
|
|
459
455
|
output += %(\n)
|
|
@@ -465,9 +461,12 @@ module Herb
|
|
|
465
461
|
class MissingERBEndTagError < Error
|
|
466
462
|
include Colors
|
|
467
463
|
|
|
468
|
-
|
|
464
|
+
#| keyword: String?,
|
|
465
|
+
#| }
|
|
466
|
+
|
|
467
|
+
attr_reader :keyword #: String?
|
|
469
468
|
|
|
470
|
-
#: (String, Location
|
|
469
|
+
#: (String, Location?, String, String) -> void
|
|
471
470
|
def initialize(type, location, message, keyword)
|
|
472
471
|
super(type, location, message)
|
|
473
472
|
@keyword = keyword
|
|
@@ -478,18 +477,18 @@ module Herb
|
|
|
478
477
|
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
479
478
|
end
|
|
480
479
|
|
|
481
|
-
#: () ->
|
|
480
|
+
#: () -> serialized_missing_erb_end_tag_error
|
|
482
481
|
def to_hash
|
|
483
482
|
super.merge(
|
|
484
483
|
keyword: keyword
|
|
485
|
-
) #: Herb::
|
|
484
|
+
) #: Herb::serialized_missing_erb_end_tag_error
|
|
486
485
|
end
|
|
487
486
|
|
|
488
487
|
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
489
488
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
490
489
|
output = +""
|
|
491
490
|
|
|
492
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
491
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
493
492
|
output += white("├── message: #{green(message.inspect)}\n")
|
|
494
493
|
output += white("└── keyword: #{green(keyword.inspect)}\n")
|
|
495
494
|
output += %(\n)
|
|
@@ -510,7 +509,7 @@ module Herb
|
|
|
510
509
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
511
510
|
output = +""
|
|
512
511
|
|
|
513
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
512
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
514
513
|
output += white("└── message: #{green(message.inspect)}\n")
|
|
515
514
|
output += %(\n)
|
|
516
515
|
|
|
@@ -530,7 +529,7 @@ module Herb
|
|
|
530
529
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
531
530
|
output = +""
|
|
532
531
|
|
|
533
|
-
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location
|
|
532
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
534
533
|
output += white("└── message: #{green(message.inspect)}\n")
|
|
535
534
|
output += %(\n)
|
|
536
535
|
|
|
@@ -538,5 +537,726 @@ module Herb
|
|
|
538
537
|
end
|
|
539
538
|
end
|
|
540
539
|
|
|
540
|
+
class ConditionalElementMultipleTagsError < Error
|
|
541
|
+
include Colors
|
|
542
|
+
|
|
543
|
+
#| line: Integer?,
|
|
544
|
+
#| column: Integer?,
|
|
545
|
+
#| }
|
|
546
|
+
|
|
547
|
+
attr_reader :line #: Integer?
|
|
548
|
+
attr_reader :column #: Integer?
|
|
549
|
+
|
|
550
|
+
#: (String, Location?, String, Integer, Integer) -> void
|
|
551
|
+
def initialize(type, location, message, line, column)
|
|
552
|
+
super(type, location, message)
|
|
553
|
+
@line = line
|
|
554
|
+
@column = column
|
|
555
|
+
end
|
|
556
|
+
|
|
557
|
+
#: () -> String
|
|
558
|
+
def inspect
|
|
559
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
560
|
+
end
|
|
561
|
+
|
|
562
|
+
#: () -> serialized_conditional_element_multiple_tags_error
|
|
563
|
+
def to_hash
|
|
564
|
+
super.merge(
|
|
565
|
+
line: line,
|
|
566
|
+
column: column
|
|
567
|
+
) #: Herb::serialized_conditional_element_multiple_tags_error
|
|
568
|
+
end
|
|
569
|
+
|
|
570
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
571
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
572
|
+
output = +""
|
|
573
|
+
|
|
574
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
575
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
576
|
+
output += white("├── line: #{green(line.inspect)}\n")
|
|
577
|
+
output += white("└── column: #{green(column.inspect)}\n")
|
|
578
|
+
output += %(\n)
|
|
579
|
+
|
|
580
|
+
output.gsub(/^/, " " * indent)
|
|
581
|
+
end
|
|
582
|
+
end
|
|
583
|
+
|
|
584
|
+
class ConditionalElementConditionMismatchError < Error
|
|
585
|
+
include Colors
|
|
586
|
+
|
|
587
|
+
#| tag_name: String?,
|
|
588
|
+
#| open_condition: String?,
|
|
589
|
+
#| open_line: Integer?,
|
|
590
|
+
#| open_column: Integer?,
|
|
591
|
+
#| close_condition: String?,
|
|
592
|
+
#| close_line: Integer?,
|
|
593
|
+
#| close_column: Integer?,
|
|
594
|
+
#| }
|
|
595
|
+
|
|
596
|
+
attr_reader :tag_name #: String?
|
|
597
|
+
attr_reader :open_condition #: String?
|
|
598
|
+
attr_reader :open_line #: Integer?
|
|
599
|
+
attr_reader :open_column #: Integer?
|
|
600
|
+
attr_reader :close_condition #: String?
|
|
601
|
+
attr_reader :close_line #: Integer?
|
|
602
|
+
attr_reader :close_column #: Integer?
|
|
603
|
+
|
|
604
|
+
#: (String, Location?, String, String, String, Integer, Integer, String, Integer, Integer) -> void
|
|
605
|
+
def initialize(type, location, message, tag_name, open_condition, open_line, open_column, close_condition, close_line, close_column)
|
|
606
|
+
super(type, location, message)
|
|
607
|
+
@tag_name = tag_name
|
|
608
|
+
@open_condition = open_condition
|
|
609
|
+
@open_line = open_line
|
|
610
|
+
@open_column = open_column
|
|
611
|
+
@close_condition = close_condition
|
|
612
|
+
@close_line = close_line
|
|
613
|
+
@close_column = close_column
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
#: () -> String
|
|
617
|
+
def inspect
|
|
618
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
619
|
+
end
|
|
620
|
+
|
|
621
|
+
#: () -> serialized_conditional_element_condition_mismatch_error
|
|
622
|
+
def to_hash
|
|
623
|
+
super.merge(
|
|
624
|
+
tag_name: tag_name,
|
|
625
|
+
open_condition: open_condition,
|
|
626
|
+
open_line: open_line,
|
|
627
|
+
open_column: open_column,
|
|
628
|
+
close_condition: close_condition,
|
|
629
|
+
close_line: close_line,
|
|
630
|
+
close_column: close_column
|
|
631
|
+
) #: Herb::serialized_conditional_element_condition_mismatch_error
|
|
632
|
+
end
|
|
633
|
+
|
|
634
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
635
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
636
|
+
output = +""
|
|
637
|
+
|
|
638
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
639
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
640
|
+
output += white("├── tag_name: #{green(tag_name.inspect)}\n")
|
|
641
|
+
output += white("├── open_condition: #{green(open_condition.inspect)}\n")
|
|
642
|
+
output += white("├── open_line: #{green(open_line.inspect)}\n")
|
|
643
|
+
output += white("├── open_column: #{green(open_column.inspect)}\n")
|
|
644
|
+
output += white("├── close_condition: #{green(close_condition.inspect)}\n")
|
|
645
|
+
output += white("├── close_line: #{green(close_line.inspect)}\n")
|
|
646
|
+
output += white("└── close_column: #{green(close_column.inspect)}\n")
|
|
647
|
+
output += %(\n)
|
|
648
|
+
|
|
649
|
+
output.gsub(/^/, " " * indent)
|
|
650
|
+
end
|
|
651
|
+
end
|
|
652
|
+
|
|
653
|
+
class InvalidCommentClosingTagError < Error
|
|
654
|
+
include Colors
|
|
655
|
+
|
|
656
|
+
#| closing_tag: Herb::Token?,
|
|
657
|
+
#| }
|
|
658
|
+
|
|
659
|
+
attr_reader :closing_tag #: Herb::Token?
|
|
660
|
+
|
|
661
|
+
#: (String, Location?, String, Herb::Token) -> void
|
|
662
|
+
def initialize(type, location, message, closing_tag)
|
|
663
|
+
super(type, location, message)
|
|
664
|
+
@closing_tag = closing_tag
|
|
665
|
+
end
|
|
666
|
+
|
|
667
|
+
#: () -> String
|
|
668
|
+
def inspect
|
|
669
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
670
|
+
end
|
|
671
|
+
|
|
672
|
+
#: () -> serialized_invalid_comment_closing_tag_error
|
|
673
|
+
def to_hash
|
|
674
|
+
super.merge(
|
|
675
|
+
closing_tag: closing_tag
|
|
676
|
+
) #: Herb::serialized_invalid_comment_closing_tag_error
|
|
677
|
+
end
|
|
678
|
+
|
|
679
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
680
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
681
|
+
output = +""
|
|
682
|
+
|
|
683
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
684
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
685
|
+
output += white("└── closing_tag: ")
|
|
686
|
+
output += closing_tag ? closing_tag.tree_inspect : magenta("∅")
|
|
687
|
+
output += "\n"
|
|
688
|
+
output += %(\n)
|
|
689
|
+
|
|
690
|
+
output.gsub(/^/, " " * indent)
|
|
691
|
+
end
|
|
692
|
+
end
|
|
693
|
+
|
|
694
|
+
class OmittedClosingTagError < Error
|
|
695
|
+
include Colors
|
|
696
|
+
|
|
697
|
+
#| opening_tag: Herb::Token?,
|
|
698
|
+
#| insertion_point: Herb::Position?,
|
|
699
|
+
#| }
|
|
700
|
+
|
|
701
|
+
attr_reader :opening_tag #: Herb::Token?
|
|
702
|
+
attr_reader :insertion_point #: Herb::Position?
|
|
703
|
+
|
|
704
|
+
#: (String, Location?, String, Herb::Token, Herb::Position) -> void
|
|
705
|
+
def initialize(type, location, message, opening_tag, insertion_point)
|
|
706
|
+
super(type, location, message)
|
|
707
|
+
@opening_tag = opening_tag
|
|
708
|
+
@insertion_point = insertion_point
|
|
709
|
+
end
|
|
710
|
+
|
|
711
|
+
#: () -> String
|
|
712
|
+
def inspect
|
|
713
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
714
|
+
end
|
|
715
|
+
|
|
716
|
+
#: () -> serialized_omitted_closing_tag_error
|
|
717
|
+
def to_hash
|
|
718
|
+
super.merge(
|
|
719
|
+
opening_tag: opening_tag,
|
|
720
|
+
insertion_point: insertion_point
|
|
721
|
+
) #: Herb::serialized_omitted_closing_tag_error
|
|
722
|
+
end
|
|
723
|
+
|
|
724
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
725
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
726
|
+
output = +""
|
|
727
|
+
|
|
728
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
729
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
730
|
+
output += white("├── opening_tag: ")
|
|
731
|
+
output += opening_tag ? opening_tag.tree_inspect : magenta("∅")
|
|
732
|
+
output += "\n"
|
|
733
|
+
output += white("└── insertion_point: ")
|
|
734
|
+
output += insertion_point ? insertion_point.tree_inspect : magenta("∅")
|
|
735
|
+
output += "\n"
|
|
736
|
+
output += %(\n)
|
|
737
|
+
|
|
738
|
+
output.gsub(/^/, " " * indent)
|
|
739
|
+
end
|
|
740
|
+
end
|
|
741
|
+
|
|
742
|
+
class UnclosedOpenTagError < Error
|
|
743
|
+
include Colors
|
|
744
|
+
|
|
745
|
+
#| tag_name: Herb::Token?,
|
|
746
|
+
#| }
|
|
747
|
+
|
|
748
|
+
attr_reader :tag_name #: Herb::Token?
|
|
749
|
+
|
|
750
|
+
#: (String, Location?, String, Herb::Token) -> void
|
|
751
|
+
def initialize(type, location, message, tag_name)
|
|
752
|
+
super(type, location, message)
|
|
753
|
+
@tag_name = tag_name
|
|
754
|
+
end
|
|
755
|
+
|
|
756
|
+
#: () -> String
|
|
757
|
+
def inspect
|
|
758
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
759
|
+
end
|
|
760
|
+
|
|
761
|
+
#: () -> serialized_unclosed_open_tag_error
|
|
762
|
+
def to_hash
|
|
763
|
+
super.merge(
|
|
764
|
+
tag_name: tag_name
|
|
765
|
+
) #: Herb::serialized_unclosed_open_tag_error
|
|
766
|
+
end
|
|
767
|
+
|
|
768
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
769
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
770
|
+
output = +""
|
|
771
|
+
|
|
772
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
773
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
774
|
+
output += white("└── tag_name: ")
|
|
775
|
+
output += tag_name ? tag_name.tree_inspect : magenta("∅")
|
|
776
|
+
output += "\n"
|
|
777
|
+
output += %(\n)
|
|
778
|
+
|
|
779
|
+
output.gsub(/^/, " " * indent)
|
|
780
|
+
end
|
|
781
|
+
end
|
|
782
|
+
|
|
783
|
+
class UnclosedCloseTagError < Error
|
|
784
|
+
include Colors
|
|
785
|
+
|
|
786
|
+
#| tag_name: Herb::Token?,
|
|
787
|
+
#| }
|
|
788
|
+
|
|
789
|
+
attr_reader :tag_name #: Herb::Token?
|
|
790
|
+
|
|
791
|
+
#: (String, Location?, String, Herb::Token) -> void
|
|
792
|
+
def initialize(type, location, message, tag_name)
|
|
793
|
+
super(type, location, message)
|
|
794
|
+
@tag_name = tag_name
|
|
795
|
+
end
|
|
796
|
+
|
|
797
|
+
#: () -> String
|
|
798
|
+
def inspect
|
|
799
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
800
|
+
end
|
|
801
|
+
|
|
802
|
+
#: () -> serialized_unclosed_close_tag_error
|
|
803
|
+
def to_hash
|
|
804
|
+
super.merge(
|
|
805
|
+
tag_name: tag_name
|
|
806
|
+
) #: Herb::serialized_unclosed_close_tag_error
|
|
807
|
+
end
|
|
808
|
+
|
|
809
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
810
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
811
|
+
output = +""
|
|
812
|
+
|
|
813
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
814
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
815
|
+
output += white("└── tag_name: ")
|
|
816
|
+
output += tag_name ? tag_name.tree_inspect : magenta("∅")
|
|
817
|
+
output += "\n"
|
|
818
|
+
output += %(\n)
|
|
819
|
+
|
|
820
|
+
output.gsub(/^/, " " * indent)
|
|
821
|
+
end
|
|
822
|
+
end
|
|
823
|
+
|
|
824
|
+
class UnclosedQuoteError < Error
|
|
825
|
+
include Colors
|
|
826
|
+
|
|
827
|
+
#| opening_quote: Herb::Token?,
|
|
828
|
+
#| }
|
|
829
|
+
|
|
830
|
+
attr_reader :opening_quote #: Herb::Token?
|
|
831
|
+
|
|
832
|
+
#: (String, Location?, String, Herb::Token) -> void
|
|
833
|
+
def initialize(type, location, message, opening_quote)
|
|
834
|
+
super(type, location, message)
|
|
835
|
+
@opening_quote = opening_quote
|
|
836
|
+
end
|
|
837
|
+
|
|
838
|
+
#: () -> String
|
|
839
|
+
def inspect
|
|
840
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
841
|
+
end
|
|
842
|
+
|
|
843
|
+
#: () -> serialized_unclosed_quote_error
|
|
844
|
+
def to_hash
|
|
845
|
+
super.merge(
|
|
846
|
+
opening_quote: opening_quote
|
|
847
|
+
) #: Herb::serialized_unclosed_quote_error
|
|
848
|
+
end
|
|
849
|
+
|
|
850
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
851
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
852
|
+
output = +""
|
|
853
|
+
|
|
854
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
855
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
856
|
+
output += white("└── opening_quote: ")
|
|
857
|
+
output += opening_quote ? opening_quote.tree_inspect : magenta("∅")
|
|
858
|
+
output += "\n"
|
|
859
|
+
output += %(\n)
|
|
860
|
+
|
|
861
|
+
output.gsub(/^/, " " * indent)
|
|
862
|
+
end
|
|
863
|
+
end
|
|
864
|
+
|
|
865
|
+
class MissingAttributeValueError < Error
|
|
866
|
+
include Colors
|
|
867
|
+
|
|
868
|
+
#| attribute_name: String?,
|
|
869
|
+
#| }
|
|
870
|
+
|
|
871
|
+
attr_reader :attribute_name #: String?
|
|
872
|
+
|
|
873
|
+
#: (String, Location?, String, String) -> void
|
|
874
|
+
def initialize(type, location, message, attribute_name)
|
|
875
|
+
super(type, location, message)
|
|
876
|
+
@attribute_name = attribute_name
|
|
877
|
+
end
|
|
878
|
+
|
|
879
|
+
#: () -> String
|
|
880
|
+
def inspect
|
|
881
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
882
|
+
end
|
|
883
|
+
|
|
884
|
+
#: () -> serialized_missing_attribute_value_error
|
|
885
|
+
def to_hash
|
|
886
|
+
super.merge(
|
|
887
|
+
attribute_name: attribute_name
|
|
888
|
+
) #: Herb::serialized_missing_attribute_value_error
|
|
889
|
+
end
|
|
890
|
+
|
|
891
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
892
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
893
|
+
output = +""
|
|
894
|
+
|
|
895
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
896
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
897
|
+
output += white("└── attribute_name: #{green(attribute_name.inspect)}\n")
|
|
898
|
+
output += %(\n)
|
|
899
|
+
|
|
900
|
+
output.gsub(/^/, " " * indent)
|
|
901
|
+
end
|
|
902
|
+
end
|
|
903
|
+
|
|
904
|
+
class UnclosedERBTagError < Error
|
|
905
|
+
include Colors
|
|
906
|
+
|
|
907
|
+
#| opening_tag: Herb::Token?,
|
|
908
|
+
#| }
|
|
909
|
+
|
|
910
|
+
attr_reader :opening_tag #: Herb::Token?
|
|
911
|
+
|
|
912
|
+
#: (String, Location?, String, Herb::Token) -> void
|
|
913
|
+
def initialize(type, location, message, opening_tag)
|
|
914
|
+
super(type, location, message)
|
|
915
|
+
@opening_tag = opening_tag
|
|
916
|
+
end
|
|
917
|
+
|
|
918
|
+
#: () -> String
|
|
919
|
+
def inspect
|
|
920
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
921
|
+
end
|
|
922
|
+
|
|
923
|
+
#: () -> serialized_unclosed_erb_tag_error
|
|
924
|
+
def to_hash
|
|
925
|
+
super.merge(
|
|
926
|
+
opening_tag: opening_tag
|
|
927
|
+
) #: Herb::serialized_unclosed_erb_tag_error
|
|
928
|
+
end
|
|
929
|
+
|
|
930
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
931
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
932
|
+
output = +""
|
|
933
|
+
|
|
934
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
935
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
936
|
+
output += white("└── opening_tag: ")
|
|
937
|
+
output += opening_tag ? opening_tag.tree_inspect : magenta("∅")
|
|
938
|
+
output += "\n"
|
|
939
|
+
output += %(\n)
|
|
940
|
+
|
|
941
|
+
output.gsub(/^/, " " * indent)
|
|
942
|
+
end
|
|
943
|
+
end
|
|
944
|
+
|
|
945
|
+
class StrayERBClosingTagError < Error
|
|
946
|
+
include Colors
|
|
947
|
+
|
|
948
|
+
#: () -> String
|
|
949
|
+
def inspect
|
|
950
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
951
|
+
end
|
|
952
|
+
|
|
953
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
954
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
955
|
+
output = +""
|
|
956
|
+
|
|
957
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
958
|
+
output += white("└── message: #{green(message.inspect)}\n")
|
|
959
|
+
output += %(\n)
|
|
960
|
+
|
|
961
|
+
output.gsub(/^/, " " * indent)
|
|
962
|
+
end
|
|
963
|
+
end
|
|
964
|
+
|
|
965
|
+
class NestedERBTagError < Error
|
|
966
|
+
include Colors
|
|
967
|
+
|
|
968
|
+
#| opening_tag: Herb::Token?,
|
|
969
|
+
#| nested_tag_line: Integer?,
|
|
970
|
+
#| nested_tag_column: Integer?,
|
|
971
|
+
#| }
|
|
972
|
+
|
|
973
|
+
attr_reader :opening_tag #: Herb::Token?
|
|
974
|
+
attr_reader :nested_tag_line #: Integer?
|
|
975
|
+
attr_reader :nested_tag_column #: Integer?
|
|
976
|
+
|
|
977
|
+
#: (String, Location?, String, Herb::Token, Integer, Integer) -> void
|
|
978
|
+
def initialize(type, location, message, opening_tag, nested_tag_line, nested_tag_column)
|
|
979
|
+
super(type, location, message)
|
|
980
|
+
@opening_tag = opening_tag
|
|
981
|
+
@nested_tag_line = nested_tag_line
|
|
982
|
+
@nested_tag_column = nested_tag_column
|
|
983
|
+
end
|
|
984
|
+
|
|
985
|
+
#: () -> String
|
|
986
|
+
def inspect
|
|
987
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
988
|
+
end
|
|
989
|
+
|
|
990
|
+
#: () -> serialized_nested_erb_tag_error
|
|
991
|
+
def to_hash
|
|
992
|
+
super.merge(
|
|
993
|
+
opening_tag: opening_tag,
|
|
994
|
+
nested_tag_line: nested_tag_line,
|
|
995
|
+
nested_tag_column: nested_tag_column
|
|
996
|
+
) #: Herb::serialized_nested_erb_tag_error
|
|
997
|
+
end
|
|
998
|
+
|
|
999
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
1000
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
1001
|
+
output = +""
|
|
1002
|
+
|
|
1003
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
1004
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
1005
|
+
output += white("├── opening_tag: ")
|
|
1006
|
+
output += opening_tag ? opening_tag.tree_inspect : magenta("∅")
|
|
1007
|
+
output += "\n"
|
|
1008
|
+
output += white("├── nested_tag_line: #{green(nested_tag_line.inspect)}\n")
|
|
1009
|
+
output += white("└── nested_tag_column: #{green(nested_tag_column.inspect)}\n")
|
|
1010
|
+
output += %(\n)
|
|
1011
|
+
|
|
1012
|
+
output.gsub(/^/, " " * indent)
|
|
1013
|
+
end
|
|
1014
|
+
end
|
|
1015
|
+
|
|
1016
|
+
class RenderAmbiguousLocalsError < Error
|
|
1017
|
+
include Colors
|
|
1018
|
+
|
|
1019
|
+
#| partial: String?,
|
|
1020
|
+
#| }
|
|
1021
|
+
|
|
1022
|
+
attr_reader :partial #: String?
|
|
1023
|
+
|
|
1024
|
+
#: (String, Location?, String, String) -> void
|
|
1025
|
+
def initialize(type, location, message, partial)
|
|
1026
|
+
super(type, location, message)
|
|
1027
|
+
@partial = partial
|
|
1028
|
+
end
|
|
1029
|
+
|
|
1030
|
+
#: () -> String
|
|
1031
|
+
def inspect
|
|
1032
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
1033
|
+
end
|
|
1034
|
+
|
|
1035
|
+
#: () -> serialized_render_ambiguous_locals_error
|
|
1036
|
+
def to_hash
|
|
1037
|
+
super.merge(
|
|
1038
|
+
partial: partial
|
|
1039
|
+
) #: Herb::serialized_render_ambiguous_locals_error
|
|
1040
|
+
end
|
|
1041
|
+
|
|
1042
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
1043
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
1044
|
+
output = +""
|
|
1045
|
+
|
|
1046
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
1047
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
1048
|
+
output += white("└── partial: #{green(partial.inspect)}\n")
|
|
1049
|
+
output += %(\n)
|
|
1050
|
+
|
|
1051
|
+
output.gsub(/^/, " " * indent)
|
|
1052
|
+
end
|
|
1053
|
+
end
|
|
1054
|
+
|
|
1055
|
+
class RenderMissingLocalsError < Error
|
|
1056
|
+
include Colors
|
|
1057
|
+
|
|
1058
|
+
#| partial: String?,
|
|
1059
|
+
#| keywords: String?,
|
|
1060
|
+
#| }
|
|
1061
|
+
|
|
1062
|
+
attr_reader :partial #: String?
|
|
1063
|
+
attr_reader :keywords #: String?
|
|
1064
|
+
|
|
1065
|
+
#: (String, Location?, String, String, String) -> void
|
|
1066
|
+
def initialize(type, location, message, partial, keywords)
|
|
1067
|
+
super(type, location, message)
|
|
1068
|
+
@partial = partial
|
|
1069
|
+
@keywords = keywords
|
|
1070
|
+
end
|
|
1071
|
+
|
|
1072
|
+
#: () -> String
|
|
1073
|
+
def inspect
|
|
1074
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
1075
|
+
end
|
|
1076
|
+
|
|
1077
|
+
#: () -> serialized_render_missing_locals_error
|
|
1078
|
+
def to_hash
|
|
1079
|
+
super.merge(
|
|
1080
|
+
partial: partial,
|
|
1081
|
+
keywords: keywords
|
|
1082
|
+
) #: Herb::serialized_render_missing_locals_error
|
|
1083
|
+
end
|
|
1084
|
+
|
|
1085
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
1086
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
1087
|
+
output = +""
|
|
1088
|
+
|
|
1089
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
1090
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
1091
|
+
output += white("├── partial: #{green(partial.inspect)}\n")
|
|
1092
|
+
output += white("└── keywords: #{green(keywords.inspect)}\n")
|
|
1093
|
+
output += %(\n)
|
|
1094
|
+
|
|
1095
|
+
output.gsub(/^/, " " * indent)
|
|
1096
|
+
end
|
|
1097
|
+
end
|
|
1098
|
+
|
|
1099
|
+
class RenderNoArgumentsError < Error
|
|
1100
|
+
include Colors
|
|
1101
|
+
|
|
1102
|
+
#: () -> String
|
|
1103
|
+
def inspect
|
|
1104
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
1105
|
+
end
|
|
1106
|
+
|
|
1107
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
1108
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
1109
|
+
output = +""
|
|
1110
|
+
|
|
1111
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
1112
|
+
output += white("└── message: #{green(message.inspect)}\n")
|
|
1113
|
+
output += %(\n)
|
|
1114
|
+
|
|
1115
|
+
output.gsub(/^/, " " * indent)
|
|
1116
|
+
end
|
|
1117
|
+
end
|
|
1118
|
+
|
|
1119
|
+
class RenderConflictingPartialError < Error
|
|
1120
|
+
include Colors
|
|
1121
|
+
|
|
1122
|
+
#| positional_partial: String?,
|
|
1123
|
+
#| keyword_partial: String?,
|
|
1124
|
+
#| }
|
|
1125
|
+
|
|
1126
|
+
attr_reader :positional_partial #: String?
|
|
1127
|
+
attr_reader :keyword_partial #: String?
|
|
1128
|
+
|
|
1129
|
+
#: (String, Location?, String, String, String) -> void
|
|
1130
|
+
def initialize(type, location, message, positional_partial, keyword_partial)
|
|
1131
|
+
super(type, location, message)
|
|
1132
|
+
@positional_partial = positional_partial
|
|
1133
|
+
@keyword_partial = keyword_partial
|
|
1134
|
+
end
|
|
1135
|
+
|
|
1136
|
+
#: () -> String
|
|
1137
|
+
def inspect
|
|
1138
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
1139
|
+
end
|
|
1140
|
+
|
|
1141
|
+
#: () -> serialized_render_conflicting_partial_error
|
|
1142
|
+
def to_hash
|
|
1143
|
+
super.merge(
|
|
1144
|
+
positional_partial: positional_partial,
|
|
1145
|
+
keyword_partial: keyword_partial
|
|
1146
|
+
) #: Herb::serialized_render_conflicting_partial_error
|
|
1147
|
+
end
|
|
1148
|
+
|
|
1149
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
1150
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
1151
|
+
output = +""
|
|
1152
|
+
|
|
1153
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
1154
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
1155
|
+
output += white("├── positional_partial: #{green(positional_partial.inspect)}\n")
|
|
1156
|
+
output += white("└── keyword_partial: #{green(keyword_partial.inspect)}\n")
|
|
1157
|
+
output += %(\n)
|
|
1158
|
+
|
|
1159
|
+
output.gsub(/^/, " " * indent)
|
|
1160
|
+
end
|
|
1161
|
+
end
|
|
1162
|
+
|
|
1163
|
+
class RenderInvalidAsOptionError < Error
|
|
1164
|
+
include Colors
|
|
1165
|
+
|
|
1166
|
+
#| as_value: String?,
|
|
1167
|
+
#| }
|
|
1168
|
+
|
|
1169
|
+
attr_reader :as_value #: String?
|
|
1170
|
+
|
|
1171
|
+
#: (String, Location?, String, String) -> void
|
|
1172
|
+
def initialize(type, location, message, as_value)
|
|
1173
|
+
super(type, location, message)
|
|
1174
|
+
@as_value = as_value
|
|
1175
|
+
end
|
|
1176
|
+
|
|
1177
|
+
#: () -> String
|
|
1178
|
+
def inspect
|
|
1179
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
1180
|
+
end
|
|
1181
|
+
|
|
1182
|
+
#: () -> serialized_render_invalid_as_option_error
|
|
1183
|
+
def to_hash
|
|
1184
|
+
super.merge(
|
|
1185
|
+
as_value: as_value
|
|
1186
|
+
) #: Herb::serialized_render_invalid_as_option_error
|
|
1187
|
+
end
|
|
1188
|
+
|
|
1189
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
1190
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
1191
|
+
output = +""
|
|
1192
|
+
|
|
1193
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
1194
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
1195
|
+
output += white("└── as_value: #{green(as_value.inspect)}\n")
|
|
1196
|
+
output += %(\n)
|
|
1197
|
+
|
|
1198
|
+
output.gsub(/^/, " " * indent)
|
|
1199
|
+
end
|
|
1200
|
+
end
|
|
1201
|
+
|
|
1202
|
+
class RenderObjectAndCollectionError < Error
|
|
1203
|
+
include Colors
|
|
1204
|
+
|
|
1205
|
+
#: () -> String
|
|
1206
|
+
def inspect
|
|
1207
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
1208
|
+
end
|
|
1209
|
+
|
|
1210
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
1211
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
1212
|
+
output = +""
|
|
1213
|
+
|
|
1214
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
1215
|
+
output += white("└── message: #{green(message.inspect)}\n")
|
|
1216
|
+
output += %(\n)
|
|
1217
|
+
|
|
1218
|
+
output.gsub(/^/, " " * indent)
|
|
1219
|
+
end
|
|
1220
|
+
end
|
|
1221
|
+
|
|
1222
|
+
class RenderLayoutWithoutBlockError < Error
|
|
1223
|
+
include Colors
|
|
1224
|
+
|
|
1225
|
+
#| layout: String?,
|
|
1226
|
+
#| }
|
|
1227
|
+
|
|
1228
|
+
attr_reader :layout #: String?
|
|
1229
|
+
|
|
1230
|
+
#: (String, Location?, String, String) -> void
|
|
1231
|
+
def initialize(type, location, message, layout)
|
|
1232
|
+
super(type, location, message)
|
|
1233
|
+
@layout = layout
|
|
1234
|
+
end
|
|
1235
|
+
|
|
1236
|
+
#: () -> String
|
|
1237
|
+
def inspect
|
|
1238
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
1239
|
+
end
|
|
1240
|
+
|
|
1241
|
+
#: () -> serialized_render_layout_without_block_error
|
|
1242
|
+
def to_hash
|
|
1243
|
+
super.merge(
|
|
1244
|
+
layout: layout
|
|
1245
|
+
) #: Herb::serialized_render_layout_without_block_error
|
|
1246
|
+
end
|
|
1247
|
+
|
|
1248
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
1249
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
|
|
1250
|
+
output = +""
|
|
1251
|
+
|
|
1252
|
+
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
|
|
1253
|
+
output += white("├── message: #{green(message.inspect)}\n")
|
|
1254
|
+
output += white("└── layout: #{green(layout.inspect)}\n")
|
|
1255
|
+
output += %(\n)
|
|
1256
|
+
|
|
1257
|
+
output.gsub(/^/, " " * indent)
|
|
1258
|
+
end
|
|
1259
|
+
end
|
|
1260
|
+
|
|
541
1261
|
end
|
|
542
1262
|
end
|