herb 0.11.1-aarch64-linux-gnu → 0.11.3-aarch64-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 +2 -0
- data/Rakefile +4 -2
- data/config.yml +13 -8
- data/ext/herb/error_helpers.c +3 -3
- data/ext/herb/extconf.rb +8 -31
- data/ext/herb/nodes.c +75 -75
- data/ext/herb/parser_options_helpers.c +26 -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/analysis/partial_index.rb +1 -1
- data/lib/herb/analysis/partial_resolution.rb +27 -0
- data/lib/herb/ast/erb_render_node.rb +6 -2
- data/lib/herb/ast/helpers.rb +1 -1
- data/lib/herb/cli.rb +7 -3
- data/lib/herb/configuration.rb +11 -1
- data/lib/herb/dev/classifier.rb +1 -1
- data/lib/herb/dev/runner.rb +5 -2
- data/lib/herb/engine/compiler.rb +44 -12
- data/lib/herb/engine/slots/dynamics_compiler.rb +54 -15
- data/lib/herb/engine/slots/state_compiler.rb +9 -1
- data/lib/herb/engine/slots/state_overrides.rb +17 -3
- data/lib/herb/engine/slots/subtree_compiler.rb +1 -1
- data/lib/herb/engine/slots/visitor.rb +69 -11
- data/lib/herb/engine/visitors/instrumentation_visitor.rb +18 -6
- data/lib/herb/engine.rb +11 -1
- data/lib/herb/errors.rb +7 -7
- data/lib/herb/parser_options.rb +6 -3
- data/lib/herb/project.rb +19 -8
- data/lib/herb/version.rb +1 -1
- data/lib/herb.rb +1 -1
- data/sig/herb/analysis/partial_resolution.rbs +8 -0
- data/sig/herb/ast/erb_render_node.rbs +2 -0
- data/sig/herb/configuration.rbs +3 -0
- data/sig/herb/dev/runner.rbs +2 -2
- data/sig/herb/engine/compiler.rbs +9 -0
- data/sig/herb/engine/slots/dynamics_compiler.rbs +24 -7
- data/sig/herb/engine/slots/state_compiler.rbs +3 -0
- data/sig/herb/engine/slots/state_overrides.rbs +11 -2
- data/sig/herb/engine/slots/visitor.rbs +21 -0
- data/sig/herb/engine/visitors/instrumentation_visitor.rbs +5 -1
- data/sig/herb/engine.rbs +2 -0
- data/sig/herb/errors.rbs +2 -2
- data/sig/herb/parser_options.rbs +6 -4
- data/sig/herb.rbs +2 -2
- data/sig/serialized_ast_errors.rbs +1 -1
- data/src/analyze/action_view/attribute_extraction_helpers.c +40 -21
- data/src/analyze/action_view/generated_handlers.c +36 -36
- data/src/analyze/action_view/image_tag.c +7 -3
- data/src/analyze/action_view/javascript_include_tag.c +6 -3
- data/src/analyze/action_view/link_to.c +23 -23
- data/src/analyze/action_view/registry.c +7 -3
- data/src/analyze/action_view/tag_helper_node_builders.c +6 -13
- data/src/analyze/action_view/tag_helpers.c +160 -97
- data/src/analyze/action_view/turbo_frame_tag.c +5 -4
- data/src/analyze/analyze.c +52 -29
- data/src/analyze/analyze_helpers.c +161 -188
- data/src/analyze/analyzed_ruby.c +8 -7
- data/src/analyze/control_type.c +29 -22
- data/src/analyze/herb_directives.c +16 -20
- data/src/analyze/iteration_nodes.c +69 -24
- data/src/analyze/parse_errors.c +32 -22
- data/src/analyze/postfix_conditionals.c +23 -13
- data/src/analyze/prism_annotate.c +29 -28
- data/src/analyze/render_nodes.c +239 -78
- data/src/analyze/strict_locals.c +14 -15
- data/src/analyze/ternary_conditionals.c +14 -10
- data/src/diff/herb_diff_children.c +1 -1
- data/src/diff/herb_diff_nodes.c +1 -9
- data/src/diff/herb_hash_tree.c +1 -1
- data/src/errors.c +17 -22
- data/src/extract.c +47 -7
- data/src/herb.c +10 -8
- data/src/include/analyze/action_view/tag_helper_handler.h +1 -1
- data/src/include/analyze/action_view/tag_helper_node_builders.h +1 -0
- data/src/include/analyze/action_view/tag_helpers.h +1 -1
- data/src/include/analyze/analyze.h +3 -2
- data/src/include/analyze/analyzed_ruby.h +4 -2
- data/src/include/analyze/helpers.h +6 -6
- data/src/include/errors.h +3 -3
- data/src/include/herb.h +3 -2
- data/src/include/parser/parser_options.h +5 -0
- data/src/include/prism/prism_context.h +12 -12
- data/src/include/prism/prism_helpers.h +30 -0
- data/src/include/prism_version.h +11 -0
- data/src/include/version.h +1 -1
- data/src/lexer/token.c +2 -2
- data/src/parser/dot_notation.c +15 -5
- data/src/parser/parser_helpers.c +1 -2
- data/src/parser.c +9 -8
- data/src/parser_options_defaults.c +1 -0
- data/src/prism/prism_helpers.c +84 -50
- data/src/prism/ruby_parser.c +20 -20
- data/templates/ext/herb/nodes.c.erb +5 -5
- data/templates/ext/herb/parser_options_helpers.c.erb +33 -0
- data/templates/java/nodes.c.erb +6 -6
- data/templates/java/parser_options_helpers.c.erb +41 -2
- data/templates/java/parser_options_helpers.h.erb +2 -1
- data/templates/javascript/packages/node/extension/nodes.cpp.erb +5 -5
- data/templates/javascript/packages/node/extension/parser_options_helpers.cpp.erb +34 -2
- data/templates/javascript/packages/node/extension/parser_options_helpers.h.erb +1 -1
- data/templates/lib/herb/parser_options.rb.erb +1 -1
- data/templates/rust/src/prism/generated_deserialize.rs.erb +90 -44
- data/templates/rust/src/prism/generated_prettyprint.rs.erb +18 -27
- data/templates/src/analyze/action_view/generated_handlers.c.erb +23 -22
- data/templates/src/diff/herb_diff_nodes.c.erb +1 -9
- data/templates/src/diff/herb_hash_tree.c.erb +1 -1
- data/templates/src/errors.c.erb +2 -2
- data/templates/src/include/parser/parser_options.h.erb +10 -0
- data/templates/src/include/prism_version.h.erb +17 -0
- data/templates/src/parser_options_defaults.c.erb +1 -1
- data/templates/template.rb +17 -2
- data/templates/wasm/nodes.cpp.erb +5 -5
- data/templates/wasm/parser_options_helpers.cpp.erb +24 -0
- data/vendor/prism/Rakefile +76 -7
- data/vendor/prism/config.yml +174 -161
- data/vendor/prism/include/prism/arena.h +45 -0
- data/vendor/prism/include/prism/arena.hpp +42 -0
- data/vendor/prism/include/prism/ast.h +2738 -611
- data/vendor/prism/include/prism/ast.hpp +641 -0
- data/vendor/prism/include/prism/buffer.h +60 -0
- data/vendor/prism/include/prism/buffer.hpp +55 -0
- data/vendor/prism/include/prism/comments.h +72 -0
- data/vendor/prism/include/prism/compiler/accel.h +26 -0
- data/vendor/prism/include/prism/compiler/align.h +36 -0
- data/vendor/prism/include/prism/compiler/assume.h +25 -0
- data/vendor/prism/include/prism/compiler/branch.h +26 -0
- data/vendor/prism/include/prism/compiler/bswap.h +46 -0
- data/vendor/prism/include/prism/compiler/cplusplus.hpp +16 -0
- data/vendor/prism/include/prism/compiler/endianness.h +34 -0
- data/vendor/prism/include/prism/compiler/exceptions.hpp +17 -0
- data/vendor/prism/include/prism/compiler/exported.h +24 -0
- data/vendor/prism/include/prism/compiler/fallthrough.h +22 -0
- data/vendor/prism/include/prism/compiler/filesystem.h +32 -0
- data/vendor/prism/include/prism/compiler/flex_array.h +19 -0
- data/vendor/prism/include/prism/compiler/force_inline.h +21 -0
- data/vendor/prism/include/prism/compiler/format.h +27 -0
- data/vendor/prism/include/prism/compiler/inline.h +17 -0
- data/vendor/prism/include/prism/compiler/lifetimebound.hpp +25 -0
- data/vendor/prism/include/prism/compiler/nodiscard.h +22 -0
- data/vendor/prism/include/prism/compiler/nonnull.h +18 -0
- data/vendor/prism/include/prism/compiler/unused.h +18 -0
- data/vendor/prism/include/prism/constant_pool.h +106 -0
- data/vendor/prism/include/prism/diagnostic.h +55 -402
- data/vendor/prism/include/prism/errors_format.h +61 -0
- data/vendor/prism/include/prism/excludes.h +29 -0
- data/vendor/prism/include/prism/integer.h +41 -0
- data/vendor/prism/include/prism/internal/allocator.h +68 -0
- data/vendor/prism/include/prism/internal/allocator_debug.h +88 -0
- data/vendor/prism/include/prism/internal/arena.h +108 -0
- data/vendor/prism/include/prism/internal/bit.h +42 -0
- data/vendor/prism/include/prism/internal/buffer.h +94 -0
- data/vendor/prism/include/prism/internal/char.h +145 -0
- data/vendor/prism/include/prism/internal/comments.h +54 -0
- data/vendor/prism/include/prism/internal/constant_pool.h +152 -0
- data/vendor/prism/include/prism/internal/diagnostic.h +389 -0
- data/vendor/prism/include/prism/{encoding.h → internal/encoding.h} +27 -68
- data/vendor/prism/include/prism/internal/integer.h +68 -0
- data/vendor/prism/include/prism/internal/isinf.h +16 -0
- data/vendor/prism/include/prism/internal/line_offset_list.h +34 -0
- data/vendor/prism/include/prism/{util/pm_list.h → internal/list.h} +11 -52
- data/vendor/prism/include/prism/internal/magic_comments.h +23 -0
- data/vendor/prism/include/prism/internal/memchr.h +15 -0
- data/vendor/prism/include/prism/internal/node.h +42 -0
- data/vendor/prism/include/prism/internal/options.h +232 -0
- data/vendor/prism/include/prism/internal/parser.h +1015 -0
- data/vendor/prism/include/prism/internal/regexp.h +26 -0
- data/vendor/prism/include/prism/internal/serialize.h +39 -0
- data/vendor/prism/include/prism/internal/source.h +72 -0
- data/vendor/prism/include/prism/internal/static_literals.h +60 -0
- data/vendor/prism/include/prism/internal/stringy.h +30 -0
- data/vendor/prism/include/prism/{util/pm_strncasecmp.h → internal/strncasecmp.h} +3 -17
- data/vendor/prism/include/prism/{util/pm_strpbrk.h → internal/strpbrk.h} +7 -20
- data/vendor/prism/include/prism/internal/tokens.h +11 -0
- data/vendor/prism/include/prism/internal/xxh3.h +16 -0
- data/vendor/prism/include/prism/json.h +40 -0
- data/vendor/prism/include/prism/line_offset_list.h +69 -0
- data/vendor/prism/include/prism/magic_comments.h +53 -0
- data/vendor/prism/include/prism/node.h +59 -49
- data/vendor/prism/include/prism/node.hpp +272 -0
- data/vendor/prism/include/prism/node_type.hpp +38 -0
- data/vendor/prism/include/prism/options.h +154 -279
- data/vendor/prism/include/prism/options.hpp +43 -0
- data/vendor/prism/include/prism/parser.h +367 -870
- data/vendor/prism/include/prism/parser.hpp +274 -0
- data/vendor/prism/include/prism/prettyprint.h +14 -9
- data/vendor/prism/include/prism/serialize.h +123 -0
- data/vendor/prism/include/prism/source.h +163 -0
- data/vendor/prism/include/prism/stream.h +36 -0
- data/vendor/prism/include/prism/string_query.h +82 -0
- data/vendor/prism/include/prism/stringy.h +61 -0
- data/vendor/prism/include/prism/stringy.hpp +31 -0
- data/vendor/prism/include/prism/version.h +20 -3
- data/vendor/prism/include/prism.h +35 -320
- data/vendor/prism/include/prism.hpp +24 -0
- data/vendor/prism/src/arena.c +122 -0
- data/vendor/prism/src/{util/pm_buffer.c → buffer.c} +53 -21
- data/vendor/prism/src/{util/pm_char.c → char.c} +28 -57
- data/vendor/prism/src/comments.c +455 -0
- data/vendor/prism/src/constant_pool.c +406 -0
- data/vendor/prism/src/diagnostic.c +120 -68
- data/vendor/prism/src/encoding.c +8 -3
- data/vendor/prism/src/errors_format.c +519 -0
- data/vendor/prism/src/{util/pm_integer.c → integer.c} +38 -22
- data/vendor/prism/src/json.c +5733 -0
- data/vendor/prism/src/line_offset_list.c +100 -0
- data/vendor/prism/src/list.c +24 -0
- data/vendor/prism/src/{util/pm_memchr.c → memchr.c} +8 -6
- data/vendor/prism/src/node.c +3465 -7787
- data/vendor/prism/src/options.c +161 -54
- data/vendor/prism/src/parser.c +371 -0
- data/vendor/prism/src/prettyprint.c +421 -354
- data/vendor/prism/src/prism.c +8522 -7280
- data/vendor/prism/src/regexp.c +960 -45
- data/vendor/prism/src/serialize.c +2434 -2048
- data/vendor/prism/src/source.c +524 -0
- data/vendor/prism/src/static_literals.c +303 -360
- data/vendor/prism/src/string_query.c +180 -0
- data/vendor/prism/src/stringy.c +61 -0
- data/vendor/prism/src/{util/pm_strncasecmp.c → strncasecmp.c} +5 -4
- data/vendor/prism/src/strpbrk.c +447 -0
- data/vendor/prism/src/{token_type.c → tokens.c} +39 -18
- data/vendor/prism/src/xxh3.c +292 -0
- data/vendor/prism/templates/ext/prism/api_node.c.erb +58 -44
- data/vendor/prism/templates/include/prism/ast.h.erb +67 -17
- data/vendor/prism/templates/include/prism/ast.hpp.erb +31 -0
- data/vendor/prism/templates/include/prism/internal/diagnostic.h.erb +60 -0
- data/vendor/prism/templates/java/{org → api/src/main/java-templates/org/ruby_lang}/prism/AbstractNodeVisitor.java.erb +1 -1
- data/vendor/prism/templates/java/{org → api/src/main/java-templates/org/ruby_lang}/prism/Loader.java.erb +232 -133
- data/vendor/prism/templates/java/{org → api/src/main/java-templates/org/ruby_lang}/prism/Nodes.java.erb +62 -23
- data/vendor/prism/templates/javascript/src/deserialize.js.erb +153 -146
- data/vendor/prism/templates/javascript/src/nodes.js.erb +4 -9
- data/vendor/prism/templates/lib/prism/compiler.rb.erb +14 -5
- data/vendor/prism/templates/lib/prism/dispatcher.rb.erb +20 -12
- data/vendor/prism/templates/lib/prism/dot_visitor.rb.erb +37 -11
- data/vendor/prism/templates/lib/prism/dsl.rb.erb +43 -4
- data/vendor/prism/templates/lib/prism/inspect_visitor.rb.erb +26 -10
- data/vendor/prism/templates/lib/prism/mutation_compiler.rb.erb +5 -2
- data/vendor/prism/templates/lib/prism/node.rb.erb +283 -105
- data/vendor/prism/templates/lib/prism/reflection.rb.erb +11 -2
- data/vendor/prism/templates/lib/prism/serialize.rb.erb +291 -134
- data/vendor/prism/templates/lib/prism/visitor.rb.erb +18 -0
- data/vendor/prism/templates/src/diagnostic.c.erb +114 -63
- data/vendor/prism/templates/src/json.c.erb +130 -0
- data/vendor/prism/templates/src/node.c.erb +79 -236
- data/vendor/prism/templates/src/prettyprint.c.erb +24 -13
- data/vendor/prism/templates/src/serialize.c.erb +369 -183
- data/vendor/prism/templates/src/{token_type.c.erb → tokens.c.erb} +22 -11
- data/vendor/prism/templates/template.rb +193 -91
- metadata +100 -42
- data/vendor/prism/include/prism/defines.h +0 -260
- data/vendor/prism/include/prism/pack.h +0 -163
- data/vendor/prism/include/prism/regexp.h +0 -43
- data/vendor/prism/include/prism/static_literals.h +0 -121
- data/vendor/prism/include/prism/util/pm_buffer.h +0 -236
- data/vendor/prism/include/prism/util/pm_char.h +0 -204
- data/vendor/prism/include/prism/util/pm_constant_pool.h +0 -218
- data/vendor/prism/include/prism/util/pm_integer.h +0 -130
- data/vendor/prism/include/prism/util/pm_memchr.h +0 -29
- data/vendor/prism/include/prism/util/pm_newline_list.h +0 -113
- data/vendor/prism/include/prism/util/pm_string.h +0 -200
- data/vendor/prism/src/pack.c +0 -509
- data/vendor/prism/src/util/pm_constant_pool.c +0 -342
- data/vendor/prism/src/util/pm_list.c +0 -49
- data/vendor/prism/src/util/pm_newline_list.c +0 -125
- data/vendor/prism/src/util/pm_string.c +0 -381
- data/vendor/prism/src/util/pm_strpbrk.c +0 -206
- data/vendor/prism/templates/include/prism/diagnostic.h.erb +0 -130
- data/vendor/prism/templates/rbi/prism/dsl.rbi.erb +0 -68
- data/vendor/prism/templates/rbi/prism/node.rbi.erb +0 -167
- data/vendor/prism/templates/rbi/prism/visitor.rbi.erb +0 -18
- data/vendor/prism/templates/sig/prism/_private/dot_visitor.rbs.erb +0 -45
- data/vendor/prism/templates/sig/prism/dsl.rbs.erb +0 -31
- data/vendor/prism/templates/sig/prism/mutation_compiler.rbs.erb +0 -7
- data/vendor/prism/templates/sig/prism/node.rbs.erb +0 -136
- data/vendor/prism/templates/sig/prism/visitor.rbs.erb +0 -17
- data/vendor/prism/templates/sig/prism.rbs.erb +0 -92
|
@@ -140,6 +140,8 @@ module Herb
|
|
|
140
140
|
|
|
141
141
|
instrument(node)
|
|
142
142
|
|
|
143
|
+
return [node] if literal?(node)
|
|
144
|
+
|
|
143
145
|
if framed?(node)
|
|
144
146
|
[enter_node(node), node, leave_node(node)]
|
|
145
147
|
elsif erb_outputs?(node)
|
|
@@ -158,6 +160,12 @@ module Herb
|
|
|
158
160
|
replacement
|
|
159
161
|
end
|
|
160
162
|
|
|
163
|
+
def literal?(node)
|
|
164
|
+
return false unless node.respond_to?(:tag_opening) && node.tag_opening
|
|
165
|
+
|
|
166
|
+
erb_escaped?(node.tag_opening.value)
|
|
167
|
+
end
|
|
168
|
+
|
|
161
169
|
def framed?(node)
|
|
162
170
|
return true if node.is_a?(Herb::AST::ERBRenderNode)
|
|
163
171
|
|
|
@@ -197,9 +205,9 @@ module Herb
|
|
|
197
205
|
body = code(node)
|
|
198
206
|
call = captured?(node) ? "output" : "at"
|
|
199
207
|
|
|
200
|
-
return
|
|
208
|
+
return rewrapped(node, "#{SESSION}.#{call}(#{position(node)}) {\n#{body}\n}") if spans_lines?(body)
|
|
201
209
|
|
|
202
|
-
|
|
210
|
+
rewrapped(node, "#{SESSION}.#{call}(#{position(node)}) { #{body} }")
|
|
203
211
|
end
|
|
204
212
|
|
|
205
213
|
def captured?(node)
|
|
@@ -221,10 +229,10 @@ module Herb
|
|
|
221
229
|
body = code(node)
|
|
222
230
|
|
|
223
231
|
if spans_lines?(body)
|
|
224
|
-
return
|
|
232
|
+
return rewrapped(node, "#{SESSION}.enter(#{position(node)}); begin\n#{body}\nensure; #{SESSION}.leave; end")
|
|
225
233
|
end
|
|
226
234
|
|
|
227
|
-
|
|
235
|
+
rewrapped(node, "#{SESSION}.enter(#{position(node)}); begin; #{body}; ensure; #{SESSION}.leave; end")
|
|
228
236
|
end
|
|
229
237
|
|
|
230
238
|
#: (String) -> bool
|
|
@@ -276,11 +284,15 @@ module Herb
|
|
|
276
284
|
node.content&.value.to_s.strip
|
|
277
285
|
end
|
|
278
286
|
|
|
279
|
-
def
|
|
287
|
+
def rewrapped(node, code)
|
|
288
|
+
erb_node(node, node.tag_opening.value, code, closing: node.tag_closing&.value || "%>")
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
def erb_node(node, opening, code, closing: "%>")
|
|
280
292
|
Herb::AST::ERBContentNode.build(
|
|
281
293
|
tag_opening: Herb::Token.from("TOKEN_ERB_START", opening),
|
|
282
294
|
content: Herb::Token.from("TOKEN_ERB_CONTENT", " #{code} "),
|
|
283
|
-
tag_closing: Herb::Token.from("TOKEN_ERB_END",
|
|
295
|
+
tag_closing: Herb::Token.from("TOKEN_ERB_END", closing),
|
|
284
296
|
valid: true,
|
|
285
297
|
location: node.location
|
|
286
298
|
)
|
data/lib/herb/engine.rb
CHANGED
|
@@ -175,7 +175,7 @@ module Herb
|
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
def self.js(value)
|
|
178
|
-
value.to_s.gsub(/[\\'"
|
|
178
|
+
value.to_s.gsub(/[\\'"`$<>&\n\r\t\f\b]/) do |char|
|
|
179
179
|
case char
|
|
180
180
|
when "\n" then "\\n"
|
|
181
181
|
when "\r" then "\\r"
|
|
@@ -257,6 +257,16 @@ module Herb
|
|
|
257
257
|
end
|
|
258
258
|
end
|
|
259
259
|
|
|
260
|
+
def add_context_aware_expression_block(indicator, code, context)
|
|
261
|
+
escapefunc = context_escape_function(context)
|
|
262
|
+
|
|
263
|
+
return add_expression_block(indicator, code) if escapefunc.nil?
|
|
264
|
+
|
|
265
|
+
@_expression_block_open_paren = true
|
|
266
|
+
|
|
267
|
+
with_buffer { @src << " << #{escapefunc}((" << code << trailing_newline(code) }
|
|
268
|
+
end
|
|
269
|
+
|
|
260
270
|
def context_escape_function(context)
|
|
261
271
|
case context
|
|
262
272
|
when :attribute_value then @attrfunc
|
data/lib/herb/errors.rb
CHANGED
|
@@ -1449,14 +1449,14 @@ module Herb
|
|
|
1449
1449
|
class RenderMissingLocalsError < Error
|
|
1450
1450
|
include Colors
|
|
1451
1451
|
|
|
1452
|
-
attr_reader :partial #: String?
|
|
1453
1452
|
attr_reader :keywords #: String?
|
|
1453
|
+
attr_reader :suggestion #: String?
|
|
1454
1454
|
|
|
1455
1455
|
#: (String, Location?, String, String, String) -> void
|
|
1456
|
-
def initialize(type, location, message,
|
|
1456
|
+
def initialize(type, location, message, keywords, suggestion)
|
|
1457
1457
|
super(type, location, message)
|
|
1458
|
-
@partial = partial
|
|
1459
1458
|
@keywords = keywords
|
|
1459
|
+
@suggestion = suggestion
|
|
1460
1460
|
end
|
|
1461
1461
|
|
|
1462
1462
|
#: () -> String
|
|
@@ -1467,8 +1467,8 @@ module Herb
|
|
|
1467
1467
|
#: () -> serialized_render_missing_locals_error
|
|
1468
1468
|
def to_hash
|
|
1469
1469
|
super.merge(
|
|
1470
|
-
|
|
1471
|
-
|
|
1470
|
+
keywords: keywords,
|
|
1471
|
+
suggestion: suggestion
|
|
1472
1472
|
) #: Herb::serialized_render_missing_locals_error
|
|
1473
1473
|
end
|
|
1474
1474
|
|
|
@@ -1478,8 +1478,8 @@ module Herb
|
|
|
1478
1478
|
|
|
1479
1479
|
output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect || "∅"})\n")}")
|
|
1480
1480
|
output += white("├── message: #{green(message.inspect)}\n")
|
|
1481
|
-
output += white("├──
|
|
1482
|
-
output += white("└──
|
|
1481
|
+
output += white("├── keywords: #{green(keywords.inspect)}\n")
|
|
1482
|
+
output += white("└── suggestion: #{green(suggestion.inspect)}\n")
|
|
1483
1483
|
output += %(\n)
|
|
1484
1484
|
|
|
1485
1485
|
output.gsub(/^/, " " * indent)
|
data/lib/herb/parser_options.rb
CHANGED
|
@@ -19,6 +19,7 @@ module Herb
|
|
|
19
19
|
attr_reader :prism_nodes_deep #: bool
|
|
20
20
|
attr_reader :prism_program #: bool
|
|
21
21
|
attr_reader :render_nodes #: bool
|
|
22
|
+
attr_reader :ruby_version #: String?
|
|
22
23
|
attr_reader :strict #: bool
|
|
23
24
|
attr_reader :strict_locals #: bool
|
|
24
25
|
attr_reader :timeout #: Numeric
|
|
@@ -45,8 +46,8 @@ module Herb
|
|
|
45
46
|
DEFAULT_TRACK_WHITESPACE = false #: bool
|
|
46
47
|
DEFAULT_TRANSFORM_CONDITIONALS = false #: bool
|
|
47
48
|
|
|
48
|
-
#: (?action_view_helpers: bool, ?analyze: bool, ?arena_stats: bool, ?dot_notation_tags: bool, ?erb_openers: Array[String], ?herb_directives: bool, ?html: bool, ?iteration_nodes: bool, ?max_errors: Integer?, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?render_nodes: bool, ?strict: bool, ?strict_locals: bool, ?timeout: Numeric, ?track_locations: bool, ?track_whitespace: bool, ?transform_conditionals: bool) -> void
|
|
49
|
-
def initialize(action_view_helpers: DEFAULT_ACTION_VIEW_HELPERS, analyze: DEFAULT_ANALYZE, arena_stats: DEFAULT_CAPTURE_ARENA_STATS, dot_notation_tags: DEFAULT_DOT_NOTATION_TAGS, erb_openers: [], herb_directives: DEFAULT_HERB_DIRECTIVES, html: DEFAULT_HTML, iteration_nodes: DEFAULT_ITERATION_NODES, max_errors: DEFAULT_MAX_ERRORS, prism_nodes: DEFAULT_PRISM_NODES, prism_nodes_deep: DEFAULT_PRISM_NODES_DEEP, prism_program: DEFAULT_PRISM_PROGRAM, render_nodes: DEFAULT_RENDER_NODES, strict: DEFAULT_STRICT, strict_locals: DEFAULT_STRICT_LOCALS, timeout: DEFAULT_TIMEOUT, track_locations: DEFAULT_TRACK_LOCATIONS, track_whitespace: DEFAULT_TRACK_WHITESPACE, transform_conditionals: DEFAULT_TRANSFORM_CONDITIONALS)
|
|
49
|
+
#: (?action_view_helpers: bool, ?analyze: bool, ?arena_stats: bool, ?dot_notation_tags: bool, ?erb_openers: Array[String], ?herb_directives: bool, ?html: bool, ?iteration_nodes: bool, ?max_errors: Integer?, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?render_nodes: bool, ?ruby_version: String?, ?strict: bool, ?strict_locals: bool, ?timeout: Numeric, ?track_locations: bool, ?track_whitespace: bool, ?transform_conditionals: bool) -> void
|
|
50
|
+
def initialize(action_view_helpers: DEFAULT_ACTION_VIEW_HELPERS, analyze: DEFAULT_ANALYZE, arena_stats: DEFAULT_CAPTURE_ARENA_STATS, dot_notation_tags: DEFAULT_DOT_NOTATION_TAGS, erb_openers: [], herb_directives: DEFAULT_HERB_DIRECTIVES, html: DEFAULT_HTML, iteration_nodes: DEFAULT_ITERATION_NODES, max_errors: DEFAULT_MAX_ERRORS, prism_nodes: DEFAULT_PRISM_NODES, prism_nodes_deep: DEFAULT_PRISM_NODES_DEEP, prism_program: DEFAULT_PRISM_PROGRAM, render_nodes: DEFAULT_RENDER_NODES, ruby_version: "4.0", strict: DEFAULT_STRICT, strict_locals: DEFAULT_STRICT_LOCALS, timeout: DEFAULT_TIMEOUT, track_locations: DEFAULT_TRACK_LOCATIONS, track_whitespace: DEFAULT_TRACK_WHITESPACE, transform_conditionals: DEFAULT_TRANSFORM_CONDITIONALS)
|
|
50
51
|
@action_view_helpers = action_view_helpers
|
|
51
52
|
@analyze = analyze
|
|
52
53
|
@arena_stats = arena_stats
|
|
@@ -60,6 +61,7 @@ module Herb
|
|
|
60
61
|
@prism_nodes_deep = prism_nodes_deep
|
|
61
62
|
@prism_program = prism_program
|
|
62
63
|
@render_nodes = render_nodes
|
|
64
|
+
@ruby_version = ruby_version
|
|
63
65
|
@strict = strict
|
|
64
66
|
@strict_locals = strict_locals
|
|
65
67
|
@timeout = timeout
|
|
@@ -68,7 +70,7 @@ module Herb
|
|
|
68
70
|
@transform_conditionals = transform_conditionals
|
|
69
71
|
end
|
|
70
72
|
|
|
71
|
-
#: () -> Hash[Symbol, (bool | Numeric | Array[String] | nil)]
|
|
73
|
+
#: () -> Hash[Symbol, (bool | Numeric | String | Array[String] | nil)]
|
|
72
74
|
def to_h
|
|
73
75
|
{
|
|
74
76
|
action_view_helpers: @action_view_helpers,
|
|
@@ -84,6 +86,7 @@ module Herb
|
|
|
84
86
|
prism_nodes_deep: @prism_nodes_deep,
|
|
85
87
|
prism_program: @prism_program,
|
|
86
88
|
render_nodes: @render_nodes,
|
|
89
|
+
ruby_version: @ruby_version,
|
|
87
90
|
strict: @strict,
|
|
88
91
|
strict_locals: @strict_locals,
|
|
89
92
|
timeout: @timeout,
|
data/lib/herb/project.rb
CHANGED
|
@@ -332,7 +332,7 @@ module Herb
|
|
|
332
332
|
return unless issue_type[:key] == :invalid_ruby && file_content
|
|
333
333
|
|
|
334
334
|
begin
|
|
335
|
-
engine = Herb::Engine.new(file_content, filename: file_path, escape: true, visitors: [])
|
|
335
|
+
engine = Herb::Engine.new(file_content, filename: file_path, escape: true, parser_options: engine_parser_options, visitors: [])
|
|
336
336
|
puts ""
|
|
337
337
|
puts "**Compiled Ruby:**"
|
|
338
338
|
puts "```ruby"
|
|
@@ -345,6 +345,16 @@ module Herb
|
|
|
345
345
|
|
|
346
346
|
private
|
|
347
347
|
|
|
348
|
+
#: () -> Hash[Symbol, untyped]
|
|
349
|
+
def parser_options
|
|
350
|
+
@parser_options ||= configuration.parser_options
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
#: () -> Hash[Symbol, untyped]
|
|
354
|
+
def engine_parser_options
|
|
355
|
+
@engine_parser_options ||= configuration.engine_option("parser_options", {}).transform_keys(&:to_sym).merge(parser_options)
|
|
356
|
+
end
|
|
357
|
+
|
|
348
358
|
def process_file(file_path)
|
|
349
359
|
isolate ? process_file_isolated(file_path) : process_file_direct(file_path)
|
|
350
360
|
end
|
|
@@ -362,7 +372,7 @@ module Herb
|
|
|
362
372
|
end
|
|
363
373
|
|
|
364
374
|
Timeout.timeout(file_timeout) do
|
|
365
|
-
parse_result = Herb.parse(file_content)
|
|
375
|
+
parse_result = Herb.parse(file_content, **parser_options)
|
|
366
376
|
|
|
367
377
|
if parse_result.failed?
|
|
368
378
|
result[:file_content] = file_content
|
|
@@ -401,7 +411,7 @@ module Herb
|
|
|
401
411
|
$stderr.reopen(stderr_file.path, "w")
|
|
402
412
|
|
|
403
413
|
begin
|
|
404
|
-
parse_result = Herb.parse(file_content)
|
|
414
|
+
parse_result = Herb.parse(file_content, **parser_options)
|
|
405
415
|
exit!(parse_result.failed? ? 2 : 0)
|
|
406
416
|
rescue StandardError => e
|
|
407
417
|
warn "Ruby exception: #{e.class}: #{e.message}"
|
|
@@ -457,7 +467,7 @@ module Herb
|
|
|
457
467
|
end
|
|
458
468
|
|
|
459
469
|
def classify_parse_errors(file_path, file_content)
|
|
460
|
-
default_result = Herb.parse(file_content)
|
|
470
|
+
default_result = Herb.parse(file_content, **parser_options)
|
|
461
471
|
|
|
462
472
|
diagnostics = if default_result.respond_to?(:errors) && default_result.errors.any?
|
|
463
473
|
default_result.errors.map do |error|
|
|
@@ -470,8 +480,8 @@ module Herb
|
|
|
470
480
|
end
|
|
471
481
|
end
|
|
472
482
|
|
|
473
|
-
no_strict_result = Herb.parse(file_content, strict: false)
|
|
474
|
-
no_analyze_result = Herb.parse(file_content, analyze: false)
|
|
483
|
+
no_strict_result = Herb.parse(file_content, **parser_options, strict: false)
|
|
484
|
+
no_analyze_result = Herb.parse(file_content, **parser_options, analyze: false)
|
|
475
485
|
|
|
476
486
|
if no_strict_result.success?
|
|
477
487
|
{ status: :strict_parse_error, diagnostics: diagnostics,
|
|
@@ -496,6 +506,7 @@ module Herb
|
|
|
496
506
|
file_content,
|
|
497
507
|
filename: file_path,
|
|
498
508
|
escape: true,
|
|
509
|
+
parser_options: engine_parser_options,
|
|
499
510
|
validate_ruby: validate_ruby,
|
|
500
511
|
visitors: Herb::Engine::Validators.all
|
|
501
512
|
)
|
|
@@ -514,7 +525,7 @@ module Herb
|
|
|
514
525
|
|
|
515
526
|
# Retry without validators
|
|
516
527
|
begin
|
|
517
|
-
Herb::Engine.new(file_content, filename: file_path, escape: true, visitors: [], validate_ruby: validate_ruby)
|
|
528
|
+
Herb::Engine.new(file_content, filename: file_path, escape: true, parser_options: engine_parser_options, visitors: [], validate_ruby: validate_ruby)
|
|
518
529
|
error_name = e.is_a?(Herb::Engine::SecurityError) ? "SecurityError" : "ValidationError"
|
|
519
530
|
return { status: :validation_error, file_content: file_content,
|
|
520
531
|
compilation_error: compilation_error,
|
|
@@ -526,7 +537,7 @@ module Herb
|
|
|
526
537
|
|
|
527
538
|
# Retry without strict mode
|
|
528
539
|
begin
|
|
529
|
-
Herb::Engine.new(file_content, filename: file_path, escape: true, strict: false, validate_ruby: validate_ruby)
|
|
540
|
+
Herb::Engine.new(file_content, filename: file_path, escape: true, parser_options: engine_parser_options, strict: false, validate_ruby: validate_ruby)
|
|
530
541
|
return { status: :strict_compilation_failed, file_content: file_content,
|
|
531
542
|
compilation_error: compilation_error,
|
|
532
543
|
diagnostics: [{ name: "CompilationError", message: "#{e.message} (strict mode)" }],
|
data/lib/herb/version.rb
CHANGED
data/lib/herb.rb
CHANGED
|
@@ -67,7 +67,7 @@ rescue LoadError => e
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
module Herb
|
|
70
|
-
#: (String input, ?track_whitespace: bool, ?track_locations: bool, ?analyze: bool, ?strict: bool, ?action_view_helpers: bool, ?transform_conditionals: bool, ?dot_notation_tags: bool, ?render_nodes: bool, ?strict_locals: bool, ?herb_directives: bool, ?iteration_nodes: bool, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?html: bool, ?erb_openers: Array[String], ?arena_stats: bool) -> ParseResult
|
|
70
|
+
#: (String input, ?track_whitespace: bool, ?track_locations: bool, ?analyze: bool, ?strict: bool, ?action_view_helpers: bool, ?transform_conditionals: bool, ?dot_notation_tags: bool, ?render_nodes: bool, ?strict_locals: bool, ?herb_directives: bool, ?iteration_nodes: bool, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?html: bool, ?erb_openers: Array[String], ?ruby_version: String?, ?arena_stats: bool) -> ParseResult
|
|
71
71
|
def self.parse(...)
|
|
72
72
|
Backend.parse(...)
|
|
73
73
|
end
|
|
@@ -5,6 +5,8 @@ module Herb
|
|
|
5
5
|
module PartialResolution
|
|
6
6
|
PARTIAL_PREFIX: String
|
|
7
7
|
|
|
8
|
+
VARIANT_SEPARATOR: String
|
|
9
|
+
|
|
8
10
|
EXTENSIONS: Array[String]
|
|
9
11
|
|
|
10
12
|
EXTENSION_ALTERNATIVES: String
|
|
@@ -41,6 +43,12 @@ module Herb
|
|
|
41
43
|
# : (Array[String]) -> Array[String]
|
|
42
44
|
def self.by_precedence: (Array[String]) -> Array[String]
|
|
43
45
|
|
|
46
|
+
# : (String?) -> String?
|
|
47
|
+
def self.template_variant: (String?) -> String?
|
|
48
|
+
|
|
49
|
+
# : (Array[String], String?) -> String?
|
|
50
|
+
def self.preferred_for: (Array[String], String?) -> String?
|
|
51
|
+
|
|
44
52
|
# : (String, String | Pathname) -> String?
|
|
45
53
|
def self.template_name_for: (String, String | Pathname) -> String?
|
|
46
54
|
|
data/sig/herb/configuration.rbs
CHANGED
data/sig/herb/dev/runner.rbs
CHANGED
|
@@ -16,8 +16,8 @@ module Herb
|
|
|
16
16
|
|
|
17
17
|
SHOW_CURSOR: String
|
|
18
18
|
|
|
19
|
-
# : (?path: String) -> void
|
|
20
|
-
def initialize: (?path: String) -> void
|
|
19
|
+
# : (?path: String, ?port: Integer?) -> void
|
|
20
|
+
def initialize: (?path: String, ?port: Integer?) -> void
|
|
21
21
|
|
|
22
22
|
# : () -> void
|
|
23
23
|
def run: () -> void
|
|
@@ -35,6 +35,13 @@ module Herb
|
|
|
35
35
|
|
|
36
36
|
def visit_html_attribute_value_node: (untyped node) -> untyped
|
|
37
37
|
|
|
38
|
+
def attribute_escaping?: () -> untyped
|
|
39
|
+
|
|
40
|
+
def contains_erb_output?: (untyped node) -> untyped
|
|
41
|
+
|
|
42
|
+
# : (untyped) -> bool
|
|
43
|
+
def erb_output_node?: (untyped) -> bool
|
|
44
|
+
|
|
38
45
|
def visit_erb_open_tag_node: (untyped node) -> untyped
|
|
39
46
|
|
|
40
47
|
def visit_html_virtual_close_tag_node: (untyped node) -> untyped
|
|
@@ -153,6 +160,8 @@ module Herb
|
|
|
153
160
|
|
|
154
161
|
def context_aware_context?: (untyped context) -> untyped
|
|
155
162
|
|
|
163
|
+
def context_escaped?: (untyped context) -> untyped
|
|
164
|
+
|
|
156
165
|
def should_escape_output?: (untyped opening) -> untyped
|
|
157
166
|
|
|
158
167
|
def add_expression_with_escaping: (untyped code, untyped should_escape) -> untyped
|
|
@@ -65,7 +65,8 @@ module Herb
|
|
|
65
65
|
# An item is keyed by the key its template declares, through `herb-key` or `id` or a
|
|
66
66
|
# `<%# herb:key %>` directive, which is what makes it survive being reordered. `Visitor`
|
|
67
67
|
# decides what that key is and this evaluates it, so an item arrives under the same key the
|
|
68
|
-
# marker around it carries. A collection that declares none falls back to position
|
|
68
|
+
# marker around it carries. A collection that declares none falls back to position, counting
|
|
69
|
+
# from the first iteration, so a change re-renders every row from the first one that differs.
|
|
69
70
|
#
|
|
70
71
|
# ## A partial keeps its own values
|
|
71
72
|
#
|
|
@@ -88,7 +89,7 @@ module Herb
|
|
|
88
89
|
#
|
|
89
90
|
# ## Blocks
|
|
90
91
|
#
|
|
91
|
-
# A tag that takes a block, such as `<%= form_with do |f| %>`, owns an entry holding
|
|
92
|
+
# A tag that takes a block, such as `<%= form_with do |f| %>`, owns an entry holding the markup
|
|
92
93
|
# the block rendered, because the helper wraps that output in markup of its own that only the
|
|
93
94
|
# helper can produce. What the template wrote inside the block keeps its own indices alongside:
|
|
94
95
|
#
|
|
@@ -99,6 +100,20 @@ module Herb
|
|
|
99
100
|
# and the whole block. Slot 1 is inside slot 0, which the client already has to reason about
|
|
100
101
|
# for conditionals and collections.
|
|
101
102
|
#
|
|
103
|
+
# A partial inside a block is the exception to that fallback. It keeps its own values on its slot,
|
|
104
|
+
# and the block's entry is a String that cannot hold them, so the entry leaves the partial's
|
|
105
|
+
# markup out:
|
|
106
|
+
#
|
|
107
|
+
# <%= form_with(model: @user) do |f| %><%= render "card" %><% end %>
|
|
108
|
+
# #=> { 0 => "<form></form>", 1 => { template: "app/views/_card.html.erb", ... } }
|
|
109
|
+
#
|
|
110
|
+
# That entry cannot stand in for the block, so it must not be written over a block holding a
|
|
111
|
+
# partial. The client never writes a block's entry while the page marks slots inside that block.
|
|
112
|
+
# It reports the block as deferred instead, even when nothing in the block changed.
|
|
113
|
+
#
|
|
114
|
+
# A render that comes back as markup, because its template is not compiled for slots, is written
|
|
115
|
+
# into the entry as usual, and the entry stays whole.
|
|
116
|
+
#
|
|
102
117
|
# A block yielding more than once is the exception, since one index cannot stand for the several
|
|
103
118
|
# values its interior took. `each` and the other iterations are compiled as collections for that
|
|
104
119
|
# reason, and a helper that yields repeatedly reports the last value its interior took.
|
|
@@ -117,6 +132,8 @@ module Herb
|
|
|
117
132
|
|
|
118
133
|
OCCURRENCE_BUFFER: String
|
|
119
134
|
|
|
135
|
+
RENDERED_BUFFER: String
|
|
136
|
+
|
|
120
137
|
BRANCHING_NODES: Array[String]
|
|
121
138
|
|
|
122
139
|
class Compiler < Herb::Engine::Compiler
|
|
@@ -249,8 +266,8 @@ module Herb
|
|
|
249
266
|
# : (Integer) -> bool
|
|
250
267
|
def boolean_presence?: (Integer) -> bool
|
|
251
268
|
|
|
252
|
-
# : (String, Integer?, bool) -> void
|
|
253
|
-
def add_dynamic_block: (String, Integer?, bool) -> void
|
|
269
|
+
# : (String, Integer?, bool, ?rendering: bool) -> void
|
|
270
|
+
def add_dynamic_block: (String, Integer?, bool, ?rendering: bool) -> void
|
|
254
271
|
|
|
255
272
|
# : (String, ?escaped: bool) -> void
|
|
256
273
|
def add_expression_block_end: (String, ?escaped: bool) -> void
|
|
@@ -305,9 +322,6 @@ module Herb
|
|
|
305
322
|
# : (Integer) -> void
|
|
306
323
|
def scope_item_end: (Integer) -> void
|
|
307
324
|
|
|
308
|
-
# : (Integer) -> bool
|
|
309
|
-
def keyed?: (Integer) -> bool
|
|
310
|
-
|
|
311
325
|
# : (Integer) -> String
|
|
312
326
|
def item_seeds: (Integer) -> String
|
|
313
327
|
|
|
@@ -332,6 +346,9 @@ module Herb
|
|
|
332
346
|
# : (Integer) -> bool
|
|
333
347
|
def interpolated?: (Integer) -> bool
|
|
334
348
|
|
|
349
|
+
# : (String) -> void
|
|
350
|
+
def add_block_render: (String) -> void
|
|
351
|
+
|
|
335
352
|
# : (String) -> void
|
|
336
353
|
def add_block_dynamic: (String) -> void
|
|
337
354
|
|
|
@@ -16,11 +16,20 @@ module Herb
|
|
|
16
16
|
# the frame layers with the client's values. A seed sits under them, since a client that
|
|
17
17
|
# has written the state since it was seeded knows better. A binding sits over them, since
|
|
18
18
|
# the client cannot tell two render sites of one partial apart.
|
|
19
|
+
#
|
|
20
|
+
# A template rendered more than once on a page sends the first copy's values at the top level
|
|
21
|
+
# and every later copy that differs under `@occurrences`, keyed by its render occurrence. A
|
|
22
|
+
# copy's own values layer over the first copy's.
|
|
19
23
|
module StateOverrides
|
|
20
24
|
HOOK: String
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
OCCURRENCES: String
|
|
27
|
+
|
|
28
|
+
# : (untyped, String, ?Integer) -> Hash[String, untyped]?
|
|
29
|
+
def self.resolve: (untyped, String, ?Integer) -> Hash[String, untyped]?
|
|
30
|
+
|
|
31
|
+
# : (Hash[untyped, untyped], Integer) -> Hash[untyped, untyped]
|
|
32
|
+
def self.sent_for: (Hash[untyped, untyped], Integer) -> Hash[untyped, untyped]
|
|
24
33
|
|
|
25
34
|
# : (Hash[String, untyped]?, String, Symbol) { () -> untyped } -> untyped
|
|
26
35
|
def self.fetch: (Hash[String, untyped]?, String, Symbol) { () -> untyped } -> untyped
|
|
@@ -57,6 +57,10 @@ module Herb
|
|
|
57
57
|
|
|
58
58
|
OCCURRENCE: String
|
|
59
59
|
|
|
60
|
+
VALUES_OCCURRENCE: String
|
|
61
|
+
|
|
62
|
+
POSITION: String
|
|
63
|
+
|
|
60
64
|
NAME_ATTRIBUTE: String
|
|
61
65
|
|
|
62
66
|
KEY_ATTRIBUTE: String
|
|
@@ -121,6 +125,15 @@ module Herb
|
|
|
121
125
|
|
|
122
126
|
# : () -> bool
|
|
123
127
|
def interpolated?: () -> bool
|
|
128
|
+
|
|
129
|
+
# : () -> bool
|
|
130
|
+
def positional?: () -> bool
|
|
131
|
+
|
|
132
|
+
# : () -> String
|
|
133
|
+
def position_variable: () -> String
|
|
134
|
+
|
|
135
|
+
# : () -> String?
|
|
136
|
+
def item_key: () -> String?
|
|
124
137
|
end
|
|
125
138
|
|
|
126
139
|
# : (String) -> bool
|
|
@@ -400,6 +413,11 @@ module Herb
|
|
|
400
413
|
|
|
401
414
|
def text_node: (untyped content) -> untyped
|
|
402
415
|
|
|
416
|
+
def raw_text_node: (untyped text) -> untyped
|
|
417
|
+
|
|
418
|
+
# : (Herb::AST::DocumentNode) -> void
|
|
419
|
+
def hold_trailing_newline: (Herb::AST::DocumentNode) -> void
|
|
420
|
+
|
|
403
421
|
def erb_code_node: (untyped code) -> untyped
|
|
404
422
|
|
|
405
423
|
def erb_output_node: (untyped code) -> untyped
|
|
@@ -562,6 +580,9 @@ module Herb
|
|
|
562
580
|
# : (untyped) -> Array[Array[Herb::AST::Node]]
|
|
563
581
|
def branch_bodies: (untyped) -> Array[Array[Herb::AST::Node]]
|
|
564
582
|
|
|
583
|
+
# : (Array[untyped], Integer, Integer?) -> Integer
|
|
584
|
+
def insert_position_counter: (Array[untyped], Integer, Integer?) -> Integer
|
|
585
|
+
|
|
565
586
|
# : (Herb::AST::Node, Integer?, ?Symbol) -> void
|
|
566
587
|
def wrap_items: (Herb::AST::Node, Integer?, ?Symbol) -> void
|
|
567
588
|
|
|
@@ -72,6 +72,8 @@ module Herb
|
|
|
72
72
|
# : (Herb::AST::Node, Herb::AST::Node) -> Herb::AST::Node
|
|
73
73
|
def replacing: (Herb::AST::Node, Herb::AST::Node) -> Herb::AST::Node
|
|
74
74
|
|
|
75
|
+
def literal?: (untyped node) -> untyped
|
|
76
|
+
|
|
75
77
|
def framed?: (untyped node) -> untyped
|
|
76
78
|
|
|
77
79
|
def assignment?: (untyped node) -> untyped
|
|
@@ -105,7 +107,9 @@ module Herb
|
|
|
105
107
|
|
|
106
108
|
def code: (untyped node) -> untyped
|
|
107
109
|
|
|
108
|
-
def
|
|
110
|
+
def rewrapped: (untyped node, untyped code) -> untyped
|
|
111
|
+
|
|
112
|
+
def erb_node: (untyped node, untyped opening, untyped code, ?closing: untyped) -> untyped
|
|
109
113
|
end
|
|
110
114
|
end
|
|
111
115
|
end
|
data/sig/herb/engine.rbs
CHANGED
|
@@ -59,6 +59,8 @@ module Herb
|
|
|
59
59
|
|
|
60
60
|
def add_context_aware_expression: (untyped indicator, untyped code, untyped context) -> untyped
|
|
61
61
|
|
|
62
|
+
def add_context_aware_expression_block: (untyped indicator, untyped code, untyped context) -> untyped
|
|
63
|
+
|
|
62
64
|
def context_escape_function: (untyped context) -> untyped
|
|
63
65
|
|
|
64
66
|
def add_expression_result: (untyped code) -> untyped
|
data/sig/herb/errors.rbs
CHANGED
|
@@ -707,10 +707,10 @@ module Herb
|
|
|
707
707
|
class RenderMissingLocalsError < Error
|
|
708
708
|
include Colors
|
|
709
709
|
|
|
710
|
-
attr_reader partial: String?
|
|
711
|
-
|
|
712
710
|
attr_reader keywords: String?
|
|
713
711
|
|
|
712
|
+
attr_reader suggestion: String?
|
|
713
|
+
|
|
714
714
|
# : (String, Location?, String, String, String) -> void
|
|
715
715
|
def initialize: (String, Location?, String, String, String) -> void
|
|
716
716
|
|
data/sig/herb/parser_options.rbs
CHANGED
|
@@ -28,6 +28,8 @@ module Herb
|
|
|
28
28
|
|
|
29
29
|
attr_reader render_nodes: bool
|
|
30
30
|
|
|
31
|
+
attr_reader ruby_version: String?
|
|
32
|
+
|
|
31
33
|
attr_reader strict: bool
|
|
32
34
|
|
|
33
35
|
attr_reader strict_locals: bool
|
|
@@ -76,11 +78,11 @@ module Herb
|
|
|
76
78
|
|
|
77
79
|
DEFAULT_TRANSFORM_CONDITIONALS: bool
|
|
78
80
|
|
|
79
|
-
# : (?action_view_helpers: bool, ?analyze: bool, ?arena_stats: bool, ?dot_notation_tags: bool, ?erb_openers: Array[String], ?herb_directives: bool, ?html: bool, ?iteration_nodes: bool, ?max_errors: Integer?, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?render_nodes: bool, ?strict: bool, ?strict_locals: bool, ?timeout: Numeric, ?track_locations: bool, ?track_whitespace: bool, ?transform_conditionals: bool) -> void
|
|
80
|
-
def initialize: (?action_view_helpers: bool, ?analyze: bool, ?arena_stats: bool, ?dot_notation_tags: bool, ?erb_openers: Array[String], ?herb_directives: bool, ?html: bool, ?iteration_nodes: bool, ?max_errors: Integer?, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?render_nodes: bool, ?strict: bool, ?strict_locals: bool, ?timeout: Numeric, ?track_locations: bool, ?track_whitespace: bool, ?transform_conditionals: bool) -> void
|
|
81
|
+
# : (?action_view_helpers: bool, ?analyze: bool, ?arena_stats: bool, ?dot_notation_tags: bool, ?erb_openers: Array[String], ?herb_directives: bool, ?html: bool, ?iteration_nodes: bool, ?max_errors: Integer?, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?render_nodes: bool, ?ruby_version: String?, ?strict: bool, ?strict_locals: bool, ?timeout: Numeric, ?track_locations: bool, ?track_whitespace: bool, ?transform_conditionals: bool) -> void
|
|
82
|
+
def initialize: (?action_view_helpers: bool, ?analyze: bool, ?arena_stats: bool, ?dot_notation_tags: bool, ?erb_openers: Array[String], ?herb_directives: bool, ?html: bool, ?iteration_nodes: bool, ?max_errors: Integer?, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?render_nodes: bool, ?ruby_version: String?, ?strict: bool, ?strict_locals: bool, ?timeout: Numeric, ?track_locations: bool, ?track_whitespace: bool, ?transform_conditionals: bool) -> void
|
|
81
83
|
|
|
82
|
-
# : () -> Hash[Symbol, (bool | Numeric | Array[String] | nil)]
|
|
83
|
-
def to_h: () -> Hash[Symbol, bool | Numeric | Array[String] | nil]
|
|
84
|
+
# : () -> Hash[Symbol, (bool | Numeric | String | Array[String] | nil)]
|
|
85
|
+
def to_h: () -> Hash[Symbol, bool | Numeric | String | Array[String] | nil]
|
|
84
86
|
|
|
85
87
|
# : () -> String
|
|
86
88
|
def inspect: () -> String
|
data/sig/herb.rbs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Generated from lib/herb.rb with RBS::Inline
|
|
2
2
|
|
|
3
3
|
module Herb
|
|
4
|
-
# : (String input, ?track_whitespace: bool, ?track_locations: bool, ?analyze: bool, ?strict: bool, ?action_view_helpers: bool, ?transform_conditionals: bool, ?dot_notation_tags: bool, ?render_nodes: bool, ?strict_locals: bool, ?herb_directives: bool, ?iteration_nodes: bool, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?html: bool, ?erb_openers: Array[String], ?arena_stats: bool) -> ParseResult
|
|
5
|
-
def self.parse: (String input, ?track_whitespace: bool, ?track_locations: bool, ?analyze: bool, ?strict: bool, ?action_view_helpers: bool, ?transform_conditionals: bool, ?dot_notation_tags: bool, ?render_nodes: bool, ?strict_locals: bool, ?herb_directives: bool, ?iteration_nodes: bool, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?html: bool, ?erb_openers: Array[String], ?arena_stats: bool) -> ParseResult
|
|
4
|
+
# : (String input, ?track_whitespace: bool, ?track_locations: bool, ?analyze: bool, ?strict: bool, ?action_view_helpers: bool, ?transform_conditionals: bool, ?dot_notation_tags: bool, ?render_nodes: bool, ?strict_locals: bool, ?herb_directives: bool, ?iteration_nodes: bool, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?html: bool, ?erb_openers: Array[String], ?ruby_version: String?, ?arena_stats: bool) -> ParseResult
|
|
5
|
+
def self.parse: (String input, ?track_whitespace: bool, ?track_locations: bool, ?analyze: bool, ?strict: bool, ?action_view_helpers: bool, ?transform_conditionals: bool, ?dot_notation_tags: bool, ?render_nodes: bool, ?strict_locals: bool, ?herb_directives: bool, ?iteration_nodes: bool, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?html: bool, ?erb_openers: Array[String], ?ruby_version: String?, ?arena_stats: bool) -> ParseResult
|
|
6
6
|
|
|
7
7
|
# : (String input, ?erb_openers: Array[String], ?arena_stats: bool) -> LexResult
|
|
8
8
|
def self.lex: (String input, ?erb_openers: Array[String], ?arena_stats: bool) -> LexResult
|