herb 0.8.10-arm-linux-gnu → 0.9.0-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.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +11 -3
  3. data/README.md +64 -34
  4. data/Rakefile +48 -40
  5. data/config.yml +317 -34
  6. data/ext/herb/error_helpers.c +367 -140
  7. data/ext/herb/error_helpers.h +1 -0
  8. data/ext/herb/extconf.rb +67 -28
  9. data/ext/herb/extension.c +317 -51
  10. data/ext/herb/extension.h +1 -0
  11. data/ext/herb/extension_helpers.c +23 -14
  12. data/ext/herb/extension_helpers.h +2 -2
  13. data/ext/herb/nodes.c +537 -270
  14. data/ext/herb/nodes.h +1 -0
  15. data/herb.gemspec +3 -2
  16. data/lib/herb/3.0/herb.so +0 -0
  17. data/lib/herb/3.1/herb.so +0 -0
  18. data/lib/herb/3.2/herb.so +0 -0
  19. data/lib/herb/3.3/herb.so +0 -0
  20. data/lib/herb/3.4/herb.so +0 -0
  21. data/lib/herb/4.0/herb.so +0 -0
  22. data/lib/herb/ast/helpers.rb +3 -3
  23. data/lib/herb/ast/node.rb +15 -2
  24. data/lib/herb/ast/nodes.rb +1132 -157
  25. data/lib/herb/bootstrap.rb +87 -0
  26. data/lib/herb/cli.rb +341 -31
  27. data/lib/herb/configuration.rb +248 -0
  28. data/lib/herb/defaults.yml +32 -0
  29. data/lib/herb/engine/compiler.rb +78 -11
  30. data/lib/herb/engine/debug_visitor.rb +13 -3
  31. data/lib/herb/engine/error_formatter.rb +13 -9
  32. data/lib/herb/engine/parser_error_overlay.rb +10 -6
  33. data/lib/herb/engine/validator.rb +8 -3
  34. data/lib/herb/engine/validators/nesting_validator.rb +2 -2
  35. data/lib/herb/engine.rb +82 -35
  36. data/lib/herb/errors.rb +563 -88
  37. data/lib/herb/lex_result.rb +1 -0
  38. data/lib/herb/location.rb +7 -3
  39. data/lib/herb/parse_result.rb +12 -2
  40. data/lib/herb/parser_options.rb +57 -0
  41. data/lib/herb/position.rb +1 -0
  42. data/lib/herb/prism_inspect.rb +116 -0
  43. data/lib/herb/project.rb +923 -331
  44. data/lib/herb/range.rb +1 -0
  45. data/lib/herb/token.rb +7 -1
  46. data/lib/herb/version.rb +1 -1
  47. data/lib/herb/visitor.rb +37 -2
  48. data/lib/herb/warnings.rb +6 -1
  49. data/lib/herb.rb +35 -3
  50. data/sig/herb/ast/helpers.rbs +2 -2
  51. data/sig/herb/ast/node.rbs +12 -2
  52. data/sig/herb/ast/nodes.rbs +641 -128
  53. data/sig/herb/bootstrap.rbs +31 -0
  54. data/sig/herb/configuration.rbs +89 -0
  55. data/sig/herb/engine/compiler.rbs +9 -1
  56. data/sig/herb/engine/debug_visitor.rbs +2 -0
  57. data/sig/herb/engine/validator.rbs +5 -1
  58. data/sig/herb/engine.rbs +17 -3
  59. data/sig/herb/errors.rbs +258 -63
  60. data/sig/herb/location.rbs +4 -0
  61. data/sig/herb/parse_result.rbs +4 -2
  62. data/sig/herb/parser_options.rbs +42 -0
  63. data/sig/herb/position.rbs +1 -0
  64. data/sig/herb/prism_inspect.rbs +28 -0
  65. data/sig/herb/range.rbs +1 -0
  66. data/sig/herb/token.rbs +6 -0
  67. data/sig/herb/visitor.rbs +25 -4
  68. data/sig/herb/warnings.rbs +6 -1
  69. data/sig/herb.rbs +14 -0
  70. data/sig/herb_c_extension.rbs +5 -2
  71. data/sig/serialized_ast_errors.rbs +54 -6
  72. data/sig/serialized_ast_nodes.rbs +60 -6
  73. data/src/analyze/action_view/attribute_extraction_helpers.c +290 -0
  74. data/src/analyze/action_view/content_tag.c +70 -0
  75. data/src/analyze/action_view/link_to.c +143 -0
  76. data/src/analyze/action_view/registry.c +60 -0
  77. data/src/analyze/action_view/tag.c +64 -0
  78. data/src/analyze/action_view/tag_helper_node_builders.c +305 -0
  79. data/src/analyze/action_view/tag_helpers.c +748 -0
  80. data/src/analyze/action_view/turbo_frame_tag.c +88 -0
  81. data/src/analyze/analyze.c +882 -0
  82. data/src/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
  83. data/src/analyze/builders.c +343 -0
  84. data/src/analyze/conditional_elements.c +594 -0
  85. data/src/analyze/conditional_open_tags.c +640 -0
  86. data/src/analyze/control_type.c +250 -0
  87. data/src/{analyze_helpers.c → analyze/helpers.c} +48 -23
  88. data/src/analyze/invalid_structures.c +193 -0
  89. data/src/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
  90. data/src/analyze/parse_errors.c +84 -0
  91. data/src/analyze/prism_annotate.c +397 -0
  92. data/src/{analyze_transform.c → analyze/transform.c} +17 -3
  93. data/src/ast_node.c +17 -7
  94. data/src/ast_nodes.c +662 -387
  95. data/src/ast_pretty_print.c +190 -6
  96. data/src/errors.c +1076 -520
  97. data/src/extract.c +145 -49
  98. data/src/herb.c +52 -34
  99. data/src/html_util.c +241 -12
  100. data/src/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
  101. data/src/include/analyze/action_view/tag_helper_handler.h +41 -0
  102. data/src/include/analyze/action_view/tag_helper_node_builders.h +70 -0
  103. data/src/include/analyze/action_view/tag_helpers.h +38 -0
  104. data/src/include/{analyze.h → analyze/analyze.h} +14 -4
  105. data/src/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
  106. data/src/include/analyze/builders.h +27 -0
  107. data/src/include/analyze/conditional_elements.h +9 -0
  108. data/src/include/analyze/conditional_open_tags.h +9 -0
  109. data/src/include/analyze/control_type.h +14 -0
  110. data/src/include/{analyze_helpers.h → analyze/helpers.h} +4 -2
  111. data/src/include/analyze/invalid_structures.h +11 -0
  112. data/src/include/analyze/prism_annotate.h +16 -0
  113. data/src/include/ast_node.h +11 -5
  114. data/src/include/ast_nodes.h +117 -38
  115. data/src/include/ast_pretty_print.h +5 -0
  116. data/src/include/element_source.h +3 -8
  117. data/src/include/errors.h +148 -55
  118. data/src/include/extract.h +21 -5
  119. data/src/include/herb.h +18 -6
  120. data/src/include/herb_prism_node.h +13 -0
  121. data/src/include/html_util.h +7 -2
  122. data/src/include/io.h +3 -1
  123. data/src/include/lex_helpers.h +29 -0
  124. data/src/include/lexer.h +1 -1
  125. data/src/include/lexer_peek_helpers.h +87 -13
  126. data/src/include/lexer_struct.h +2 -0
  127. data/src/include/location.h +2 -1
  128. data/src/include/parser.h +27 -2
  129. data/src/include/parser_helpers.h +19 -3
  130. data/src/include/pretty_print.h +10 -5
  131. data/src/include/prism_context.h +45 -0
  132. data/src/include/prism_helpers.h +10 -7
  133. data/src/include/prism_serialized.h +12 -0
  134. data/src/include/token.h +16 -4
  135. data/src/include/token_struct.h +10 -3
  136. data/src/include/utf8.h +2 -1
  137. data/src/include/util/hb_allocator.h +78 -0
  138. data/src/include/util/hb_arena.h +6 -1
  139. data/src/include/util/hb_arena_debug.h +12 -1
  140. data/src/include/util/hb_array.h +7 -3
  141. data/src/include/util/hb_buffer.h +6 -4
  142. data/src/include/util/hb_foreach.h +79 -0
  143. data/src/include/util/hb_narray.h +8 -4
  144. data/src/include/util/hb_string.h +56 -9
  145. data/src/include/util.h +6 -3
  146. data/src/include/version.h +1 -1
  147. data/src/io.c +3 -2
  148. data/src/lexer.c +42 -30
  149. data/src/lexer_peek_helpers.c +12 -74
  150. data/src/location.c +2 -2
  151. data/src/main.c +53 -28
  152. data/src/parser.c +783 -247
  153. data/src/parser_helpers.c +110 -23
  154. data/src/parser_match_tags.c +109 -48
  155. data/src/pretty_print.c +29 -24
  156. data/src/prism_helpers.c +30 -27
  157. data/src/ruby_parser.c +2 -0
  158. data/src/token.c +151 -66
  159. data/src/token_matchers.c +0 -1
  160. data/src/utf8.c +7 -6
  161. data/src/util/hb_allocator.c +341 -0
  162. data/src/util/hb_arena.c +81 -56
  163. data/src/util/hb_arena_debug.c +32 -17
  164. data/src/util/hb_array.c +30 -15
  165. data/src/util/hb_buffer.c +17 -21
  166. data/src/util/hb_narray.c +22 -7
  167. data/src/util/hb_string.c +49 -35
  168. data/src/util.c +21 -11
  169. data/src/visitor.c +47 -0
  170. data/templates/ext/herb/error_helpers.c.erb +24 -11
  171. data/templates/ext/herb/error_helpers.h.erb +1 -0
  172. data/templates/ext/herb/nodes.c.erb +50 -16
  173. data/templates/ext/herb/nodes.h.erb +1 -0
  174. data/templates/java/error_helpers.c.erb +1 -1
  175. data/templates/java/nodes.c.erb +30 -8
  176. data/templates/java/org/herb/ast/Errors.java.erb +24 -1
  177. data/templates/java/org/herb/ast/Nodes.java.erb +80 -21
  178. data/templates/javascript/packages/core/src/errors.ts.erb +16 -3
  179. data/templates/javascript/packages/core/src/node-type-guards.ts.erb +3 -1
  180. data/templates/javascript/packages/core/src/nodes.ts.erb +109 -32
  181. data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +13 -4
  182. data/templates/javascript/packages/node/extension/nodes.cpp.erb +43 -4
  183. data/templates/lib/herb/ast/nodes.rb.erb +88 -31
  184. data/templates/lib/herb/errors.rb.erb +15 -3
  185. data/templates/lib/herb/visitor.rb.erb +2 -2
  186. data/templates/rust/src/ast/nodes.rs.erb +97 -44
  187. data/templates/rust/src/errors.rs.erb +2 -1
  188. data/templates/rust/src/nodes.rs.erb +167 -15
  189. data/templates/rust/src/union_types.rs.erb +60 -0
  190. data/templates/rust/src/visitor.rs.erb +81 -0
  191. data/templates/src/{analyze_missing_end.c.erb → analyze/missing_end.c.erb} +9 -6
  192. data/templates/src/{analyze_transform.c.erb → analyze/transform.c.erb} +2 -2
  193. data/templates/src/ast_nodes.c.erb +34 -26
  194. data/templates/src/ast_pretty_print.c.erb +24 -5
  195. data/templates/src/errors.c.erb +60 -54
  196. data/templates/src/include/ast_nodes.h.erb +6 -2
  197. data/templates/src/include/ast_pretty_print.h.erb +5 -0
  198. data/templates/src/include/errors.h.erb +15 -11
  199. data/templates/src/include/util/hb_foreach.h.erb +20 -0
  200. data/templates/src/parser_match_tags.c.erb +10 -4
  201. data/templates/src/visitor.c.erb +2 -2
  202. data/templates/template.rb +204 -29
  203. data/templates/wasm/error_helpers.cpp.erb +9 -5
  204. data/templates/wasm/nodes.cpp.erb +41 -4
  205. metadata +57 -16
  206. data/src/analyze.c +0 -1608
  207. data/src/element_source.c +0 -12
  208. data/src/include/util/hb_system.h +0 -9
  209. data/src/util/hb_system.c +0 -30
@@ -0,0 +1,42 @@
1
+ # Generated from lib/herb/parser_options.rb with RBS::Inline
2
+
3
+ module Herb
4
+ class ParserOptions
5
+ attr_reader strict: bool
6
+
7
+ attr_reader track_whitespace: bool
8
+
9
+ attr_reader analyze: bool
10
+
11
+ attr_reader action_view_helpers: bool
12
+
13
+ attr_reader prism_program: bool
14
+
15
+ attr_reader prism_nodes: bool
16
+
17
+ attr_reader prism_nodes_deep: bool
18
+
19
+ DEFAULT_STRICT: bool
20
+
21
+ DEFAULT_TRACK_WHITESPACE: bool
22
+
23
+ DEFAULT_ANALYZE: bool
24
+
25
+ DEFAULT_ACTION_VIEW_HELPERS: bool
26
+
27
+ DEFAULT_PRISM_PROGRAM: bool
28
+
29
+ DEFAULT_PRISM_NODES: bool
30
+
31
+ DEFAULT_PRISM_NODES_DEEP: bool
32
+
33
+ # : (?strict: bool, ?track_whitespace: bool, ?analyze: bool, ?action_view_helpers: bool, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool) -> void
34
+ def initialize: (?strict: bool, ?track_whitespace: bool, ?analyze: bool, ?action_view_helpers: bool, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool) -> void
35
+
36
+ # : () -> Hash[Symbol, bool]
37
+ def to_h: () -> Hash[Symbol, bool]
38
+
39
+ # : () -> String
40
+ def inspect: () -> String
41
+ end
42
+ end
@@ -1,6 +1,7 @@
1
1
  # Generated from lib/herb/position.rb with RBS::Inline
2
2
 
3
3
  module Herb
4
+ # : type serialized_position = { line: Integer, column: Integer }
4
5
  class Position
5
6
  attr_reader line: Integer
6
7
 
@@ -0,0 +1,28 @@
1
+ # Generated from lib/herb/prism_inspect.rb with RBS::Inline
2
+
3
+ module Herb
4
+ module PrismInspect
5
+ SKIP_FIELDS: untyped
6
+
7
+ # : (String, String, String) -> String
8
+ def self.inspect_prism_serialized: (String, String, String) -> String
9
+
10
+ # : (Prism::Node, String, String) -> String
11
+ def self.inspect_prism_node: (Prism::Node, String, String) -> String
12
+
13
+ # : (Symbol, untyped, String, String, String, String) -> String
14
+ private def self.inspect_field: (Symbol, untyped, String, String, String, String) -> String
15
+
16
+ # : (Symbol, Prism::Node, String, String, String, String) -> String
17
+ private def self.inspect_node_field: (Symbol, Prism::Node, String, String, String, String) -> String
18
+
19
+ # : (Symbol, Array[untyped], String, String, String, String) -> String
20
+ private def self.inspect_array_field: (Symbol, Array[untyped], String, String, String, String) -> String
21
+
22
+ # : (untyped) -> Array[[Symbol, untyped]]
23
+ private def self.display_fields: (untyped) -> Array[[ Symbol, untyped ]]
24
+
25
+ # : (Prism::Location) -> String
26
+ private def self.format_location: (Prism::Location) -> String
27
+ end
28
+ end
data/sig/herb/range.rbs CHANGED
@@ -1,6 +1,7 @@
1
1
  # Generated from lib/herb/range.rb with RBS::Inline
2
2
 
3
3
  module Herb
4
+ # : type serialized_range = [Integer, Integer]
4
5
  class Range
5
6
  attr_reader from: Integer
6
7
 
data/sig/herb/token.rbs CHANGED
@@ -1,6 +1,12 @@
1
1
  # Generated from lib/herb/token.rb with RBS::Inline
2
2
 
3
3
  module Herb
4
+ # : type serialized_token = {
5
+ # | value: String,
6
+ # | range: serialized_range?,
7
+ # | location: serialized_location?,
8
+ # | type: String
9
+ # | }
4
10
  class Token
5
11
  include Colors
6
12
 
data/sig/herb/visitor.rbs CHANGED
@@ -4,11 +4,11 @@ module Herb
4
4
  class Visitor
5
5
  include AST::Helpers
6
6
 
7
- # : (Herb::AST::Node) -> void
8
- def visit: (Herb::AST::Node) -> void
7
+ # : (Herb::AST::Node?) -> void
8
+ def visit: (Herb::AST::Node?) -> void
9
9
 
10
- # : (Array[Herb::AST::Node]) -> void
11
- def visit_all: (Array[Herb::AST::Node]) -> void
10
+ # : (Array[Herb::AST::Node?]) -> void
11
+ def visit_all: (Array[Herb::AST::Node?]) -> void
12
12
 
13
13
  # : (Herb::AST::Node) -> void
14
14
  def visit_child_nodes: (Herb::AST::Node) -> void
@@ -22,12 +22,24 @@ module Herb
22
22
  # : (Herb::AST::HTMLOpenTagNode) -> void
23
23
  def visit_html_open_tag_node: (Herb::AST::HTMLOpenTagNode) -> void
24
24
 
25
+ # : (Herb::AST::HTMLConditionalOpenTagNode) -> void
26
+ def visit_html_conditional_open_tag_node: (Herb::AST::HTMLConditionalOpenTagNode) -> void
27
+
25
28
  # : (Herb::AST::HTMLCloseTagNode) -> void
26
29
  def visit_html_close_tag_node: (Herb::AST::HTMLCloseTagNode) -> void
27
30
 
31
+ # : (Herb::AST::HTMLOmittedCloseTagNode) -> void
32
+ def visit_html_omitted_close_tag_node: (Herb::AST::HTMLOmittedCloseTagNode) -> void
33
+
34
+ # : (Herb::AST::HTMLVirtualCloseTagNode) -> void
35
+ def visit_html_virtual_close_tag_node: (Herb::AST::HTMLVirtualCloseTagNode) -> void
36
+
28
37
  # : (Herb::AST::HTMLElementNode) -> void
29
38
  def visit_html_element_node: (Herb::AST::HTMLElementNode) -> void
30
39
 
40
+ # : (Herb::AST::HTMLConditionalElementNode) -> void
41
+ def visit_html_conditional_element_node: (Herb::AST::HTMLConditionalElementNode) -> void
42
+
31
43
  # : (Herb::AST::HTMLAttributeValueNode) -> void
32
44
  def visit_html_attribute_value_node: (Herb::AST::HTMLAttributeValueNode) -> void
33
45
 
@@ -37,6 +49,15 @@ module Herb
37
49
  # : (Herb::AST::HTMLAttributeNode) -> void
38
50
  def visit_html_attribute_node: (Herb::AST::HTMLAttributeNode) -> void
39
51
 
52
+ # : (Herb::AST::RubyLiteralNode) -> void
53
+ def visit_ruby_literal_node: (Herb::AST::RubyLiteralNode) -> void
54
+
55
+ # : (Herb::AST::RubyHTMLAttributesSplatNode) -> void
56
+ def visit_ruby_html_attributes_splat_node: (Herb::AST::RubyHTMLAttributesSplatNode) -> void
57
+
58
+ # : (Herb::AST::ERBOpenTagNode) -> void
59
+ def visit_erb_open_tag_node: (Herb::AST::ERBOpenTagNode) -> void
60
+
40
61
  # : (Herb::AST::HTMLTextNode) -> void
41
62
  def visit_html_text_node: (Herb::AST::HTMLTextNode) -> void
42
63
 
@@ -2,10 +2,15 @@
2
2
 
3
3
  module Herb
4
4
  module Warnings
5
+ # : type serialized_warning = {
6
+ # | type: String,
7
+ # | location: serialized_location?,
8
+ # | message: String
9
+ # | }
5
10
  class Warning
6
11
  attr_reader type: String
7
12
 
8
- attr_reader location: Location
13
+ attr_reader location: Location?
9
14
 
10
15
  attr_reader message: String
11
16
 
data/sig/herb.rbs CHANGED
@@ -1,4 +1,18 @@
1
1
  # Generated from lib/herb.rb with RBS::Inline
2
2
 
3
3
  module Herb
4
+ # : (String path, ?arena_stats: bool) -> LexResult
5
+ def self.lex_file: (String path, ?arena_stats: bool) -> LexResult
6
+
7
+ # : (String path, ?track_whitespace: bool, ?analyze: bool, ?strict: bool, ?arena_stats: bool) -> ParseResult
8
+ def self.parse_file: (String path, ?track_whitespace: bool, ?analyze: bool, ?strict: bool, ?arena_stats: bool) -> ParseResult
9
+
10
+ # : (String source) -> Prism::ParseResult
11
+ def self.parse_ruby: (String source) -> Prism::ParseResult
12
+
13
+ def self.configuration: (?untyped project_path) -> untyped
14
+
15
+ def self.configure: (?untyped project_path) -> untyped
16
+
17
+ def self.reset_configuration!: () -> untyped
4
18
  end
@@ -2,6 +2,9 @@
2
2
  # This file is manually maintained - not generated
3
3
 
4
4
  module Herb
5
- def self.parse: (String input, ?track_whitespace: bool) -> ParseResult
6
- def self.lex: (String input) -> LexResult
5
+ def self.parse: (String input, ?track_whitespace: bool, ?analyze: bool, ?strict: bool, ?arena_stats: bool) -> ParseResult
6
+ def self.lex: (String input, ?arena_stats: bool) -> LexResult
7
+ def self.extract_ruby: (String source, ?semicolons: bool, ?comments: bool, ?preserve_positions: bool) -> String
8
+ def self.extract_html: (String source) -> String
9
+ def self.version: () -> String
7
10
  end
@@ -29,11 +29,6 @@ module Herb
29
29
  closing_tag: Herb::Token,
30
30
  }
31
31
 
32
- type serialized_quotes_mismatch_error = serialized_error & {
33
- opening_quote: Herb::Token,
34
- closing_quote: Herb::Token,
35
- }
36
-
37
32
  type serialized_void_element_closing_tag_error = serialized_error & {
38
33
  tag_name: Herb::Token,
39
34
  expected: String,
@@ -54,7 +49,7 @@ module Herb
54
49
  keyword: String,
55
50
  }
56
51
 
57
- type serialized_missingerb_end_tag_error = serialized_error & {
52
+ type serialized_missing_erb_end_tag_error = serialized_error & {
58
53
  keyword: String,
59
54
  }
60
55
 
@@ -64,4 +59,57 @@ module Herb
64
59
  type serialized_erb_case_with_conditions_error = serialized_error & {
65
60
  }
66
61
 
62
+ type serialized_conditional_element_multiple_tags_error = serialized_error & {
63
+ line: Integer,
64
+ column: Integer,
65
+ }
66
+
67
+ type serialized_conditional_element_condition_mismatch_error = serialized_error & {
68
+ tag_name: String,
69
+ open_condition: String,
70
+ open_line: Integer,
71
+ open_column: Integer,
72
+ close_condition: String,
73
+ close_line: Integer,
74
+ close_column: Integer,
75
+ }
76
+
77
+ type serialized_invalid_comment_closing_tag_error = serialized_error & {
78
+ closing_tag: Herb::Token,
79
+ }
80
+
81
+ type serialized_omitted_closing_tag_error = serialized_error & {
82
+ opening_tag: Herb::Token,
83
+ insertion_point: Herb::Position,
84
+ }
85
+
86
+ type serialized_unclosed_open_tag_error = serialized_error & {
87
+ tag_name: Herb::Token,
88
+ }
89
+
90
+ type serialized_unclosed_close_tag_error = serialized_error & {
91
+ tag_name: Herb::Token,
92
+ }
93
+
94
+ type serialized_unclosed_quote_error = serialized_error & {
95
+ opening_quote: Herb::Token,
96
+ }
97
+
98
+ type serialized_missing_attribute_value_error = serialized_error & {
99
+ attribute_name: String,
100
+ }
101
+
102
+ type serialized_unclosed_erb_tag_error = serialized_error & {
103
+ opening_tag: Herb::Token,
104
+ }
105
+
106
+ type serialized_stray_erb_closing_tag_error = serialized_error & {
107
+ }
108
+
109
+ type serialized_nested_erb_tag_error = serialized_error & {
110
+ opening_tag: Herb::Token,
111
+ nested_tag_line: Integer,
112
+ nested_tag_column: Integer,
113
+ }
114
+
67
115
  end
@@ -7,6 +7,8 @@
7
7
  module Herb
8
8
  type serialized_document_node = serialized_node & {
9
9
  children: Array[Herb::AST::Node],
10
+ prism_context: nil,
11
+ prism_node: String,
10
12
  }
11
13
 
12
14
  type serialized_literal_node = serialized_node & {
@@ -21,20 +23,45 @@ module Herb
21
23
  is_void: bool,
22
24
  }
23
25
 
26
+ type serialized_html_conditional_open_tag_node = serialized_node & {
27
+ conditional: (Herb::AST::ERBIfNode | Herb::AST::ERBUnlessNode),
28
+ tag_name: Herb::Token,
29
+ is_void: bool,
30
+ }
31
+
24
32
  type serialized_html_close_tag_node = serialized_node & {
25
33
  tag_opening: Herb::Token,
26
34
  tag_name: Herb::Token,
27
- children: Array[Herb::AST::Node],
35
+ children: Array[Herb::AST::WhitespaceNode],
28
36
  tag_closing: Herb::Token,
29
37
  }
30
38
 
39
+ type serialized_html_omitted_close_tag_node = serialized_node & {
40
+ tag_name: Herb::Token,
41
+ }
42
+
43
+ type serialized_html_virtual_close_tag_node = serialized_node & {
44
+ tag_name: Herb::Token,
45
+ }
46
+
31
47
  type serialized_html_element_node = serialized_node & {
32
- open_tag: Herb::AST::HTMLOpenTagNode,
48
+ open_tag: (Herb::AST::HTMLOpenTagNode | Herb::AST::HTMLConditionalOpenTagNode | Herb::AST::ERBOpenTagNode),
33
49
  tag_name: Herb::Token,
34
50
  body: Array[Herb::AST::Node],
35
- close_tag: Herb::AST::HTMLCloseTagNode,
51
+ close_tag: (Herb::AST::HTMLCloseTagNode | Herb::AST::HTMLOmittedCloseTagNode | Herb::AST::HTMLVirtualCloseTagNode | Herb::AST::ERBEndNode),
36
52
  is_void: bool,
37
- source: String,
53
+ element_source: String,
54
+ }
55
+
56
+ type serialized_html_conditional_element_node = serialized_node & {
57
+ condition: String,
58
+ open_conditional: (Herb::AST::ERBIfNode | Herb::AST::ERBUnlessNode),
59
+ open_tag: Herb::AST::HTMLOpenTagNode,
60
+ body: Array[Herb::AST::Node],
61
+ close_tag: (Herb::AST::HTMLCloseTagNode | Herb::AST::HTMLOmittedCloseTagNode),
62
+ close_conditional: (Herb::AST::ERBIfNode | Herb::AST::ERBUnlessNode),
63
+ tag_name: Herb::Token,
64
+ element_source: String,
38
65
  }
39
66
 
40
67
  type serialized_html_attribute_value_node = serialized_node & {
@@ -45,7 +72,7 @@ module Herb
45
72
  }
46
73
 
47
74
  type serialized_html_attribute_name_node = serialized_node & {
48
- children: Array[Herb::AST::Node],
75
+ children: Array[(Herb::AST::LiteralNode | Herb::AST::ERBContentNode)],
49
76
  }
50
77
 
51
78
  type serialized_html_attribute_node = serialized_node & {
@@ -54,6 +81,23 @@ module Herb
54
81
  value: Herb::AST::HTMLAttributeValueNode,
55
82
  }
56
83
 
84
+ type serialized_ruby_literal_node = serialized_node & {
85
+ content: String,
86
+ }
87
+
88
+ type serialized_ruby_html_attributes_splat_node = serialized_node & {
89
+ content: String,
90
+ prefix: String,
91
+ }
92
+
93
+ type serialized_erb_open_tag_node = serialized_node & {
94
+ tag_opening: Herb::Token,
95
+ content: Herb::Token,
96
+ tag_closing: Herb::Token,
97
+ tag_name: Herb::Token,
98
+ children: Array[Herb::AST::Node],
99
+ }
100
+
57
101
  type serialized_html_text_node = serialized_node & {
58
102
  content: String,
59
103
  }
@@ -93,6 +137,7 @@ module Herb
93
137
  analyzed_ruby: nil,
94
138
  parsed: bool,
95
139
  valid: bool,
140
+ prism_node: String,
96
141
  }
97
142
 
98
143
  type serialized_erb_end_node = serialized_node & {
@@ -113,8 +158,9 @@ module Herb
113
158
  content: Herb::Token,
114
159
  tag_closing: Herb::Token,
115
160
  then_keyword: Herb::Location,
161
+ prism_node: String,
116
162
  statements: Array[Herb::AST::Node],
117
- subsequent: Herb::AST::Node,
163
+ subsequent: (Herb::AST::ERBIfNode | Herb::AST::ERBElseNode),
118
164
  end_node: Herb::AST::ERBEndNode,
119
165
  }
120
166
 
@@ -122,6 +168,7 @@ module Herb
122
168
  tag_opening: Herb::Token,
123
169
  content: Herb::Token,
124
170
  tag_closing: Herb::Token,
171
+ prism_node: String,
125
172
  body: Array[Herb::AST::Node],
126
173
  end_node: Herb::AST::ERBEndNode,
127
174
  }
@@ -139,6 +186,7 @@ module Herb
139
186
  content: Herb::Token,
140
187
  tag_closing: Herb::Token,
141
188
  children: Array[Herb::AST::Node],
189
+ prism_node: String,
142
190
  conditions: Array[Herb::AST::ERBWhenNode],
143
191
  else_clause: Herb::AST::ERBElseNode,
144
192
  end_node: Herb::AST::ERBEndNode,
@@ -149,6 +197,7 @@ module Herb
149
197
  content: Herb::Token,
150
198
  tag_closing: Herb::Token,
151
199
  children: Array[Herb::AST::Node],
200
+ prism_node: String,
152
201
  conditions: Array[Herb::AST::ERBInNode],
153
202
  else_clause: Herb::AST::ERBElseNode,
154
203
  end_node: Herb::AST::ERBEndNode,
@@ -158,6 +207,7 @@ module Herb
158
207
  tag_opening: Herb::Token,
159
208
  content: Herb::Token,
160
209
  tag_closing: Herb::Token,
210
+ prism_node: String,
161
211
  statements: Array[Herb::AST::Node],
162
212
  end_node: Herb::AST::ERBEndNode,
163
213
  }
@@ -166,6 +216,7 @@ module Herb
166
216
  tag_opening: Herb::Token,
167
217
  content: Herb::Token,
168
218
  tag_closing: Herb::Token,
219
+ prism_node: String,
169
220
  statements: Array[Herb::AST::Node],
170
221
  end_node: Herb::AST::ERBEndNode,
171
222
  }
@@ -174,6 +225,7 @@ module Herb
174
225
  tag_opening: Herb::Token,
175
226
  content: Herb::Token,
176
227
  tag_closing: Herb::Token,
228
+ prism_node: String,
177
229
  statements: Array[Herb::AST::Node],
178
230
  end_node: Herb::AST::ERBEndNode,
179
231
  }
@@ -197,6 +249,7 @@ module Herb
197
249
  tag_opening: Herb::Token,
198
250
  content: Herb::Token,
199
251
  tag_closing: Herb::Token,
252
+ prism_node: String,
200
253
  statements: Array[Herb::AST::Node],
201
254
  rescue_clause: Herb::AST::ERBRescueNode,
202
255
  else_clause: Herb::AST::ERBElseNode,
@@ -209,6 +262,7 @@ module Herb
209
262
  content: Herb::Token,
210
263
  tag_closing: Herb::Token,
211
264
  then_keyword: Herb::Location,
265
+ prism_node: String,
212
266
  statements: Array[Herb::AST::Node],
213
267
  else_clause: Herb::AST::ERBElseNode,
214
268
  end_node: Herb::AST::ERBEndNode,