herbst 0.0.1 → 0.1.0

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.
@@ -0,0 +1,101 @@
1
+ # Generated from lib/herbst/cli.rb with RBS::Inline
2
+
3
+ module Herbst
4
+ # The `herbst` command.
5
+ #
6
+ # herbst convert app/views/posts/show.html.haml # prints the ERB
7
+ # herbst convert app/views # writes show.html.erb next to show.html.haml or .slim
8
+ #
9
+ # A single file is printed to stdout unless `--write` is given. Directories and multiple
10
+ # files are written next to their sources, replacing the `.haml` or `.slim` extension with `.erb`.
11
+ # Existing ERB files are skipped unless `--force` is given. A file without a format gets
12
+ # `html`, so `show.haml` becomes `show.html.erb`, while `welcome.text.haml` keeps its format.
13
+ class CLI
14
+ class Conversion
15
+ attr_reader path: String
16
+
17
+ attr_reader warnings: Array[String]
18
+
19
+ attr_reader error: String?
20
+
21
+ attr_reader difference: String?
22
+
23
+ attr_accessor erb: String?
24
+
25
+ # : (String, ?erb: String?, ?warnings: Array[String], ?error: String?, ?difference: String?) -> void
26
+ def initialize: (String, ?erb: String?, ?warnings: Array[String], ?error: String?, ?difference: String?) -> void
27
+
28
+ # : () -> bool
29
+ def failed?: () -> bool
30
+ end
31
+
32
+ @option_parser: OptionParser?
33
+
34
+ @version: bool
35
+
36
+ @help: bool
37
+
38
+ @default_format: String?
39
+
40
+ @force: bool
41
+
42
+ @write: bool
43
+
44
+ @verify: bool
45
+
46
+ @format: bool
47
+
48
+ @stderr: IO
49
+
50
+ @stdout: IO
51
+
52
+ @arguments: Array[String]
53
+
54
+ # : (Array[String], ?stdout: IO, ?stderr: IO) -> void
55
+ def initialize: (Array[String], ?stdout: IO, ?stderr: IO) -> void
56
+
57
+ # : () -> Integer
58
+ def run: () -> Integer
59
+
60
+ private
61
+
62
+ # : (Array[String]) -> Integer
63
+ def convert: (Array[String]) -> Integer
64
+
65
+ # : () -> OptionParser
66
+ def option_parser: () -> OptionParser
67
+
68
+ # : (?Integer, ?String?) -> Integer
69
+ def help: (?Integer, ?String?) -> Integer
70
+
71
+ # : () -> Integer
72
+ def version: () -> Integer
73
+
74
+ # : (String) -> Conversion
75
+ def convert_file: (String) -> Conversion
76
+
77
+ # : (String) -> Herbst::Converter
78
+ def converter_for: (String) -> Herbst::Converter
79
+
80
+ # : (Array[Conversion]) -> void
81
+ def format: (Array[Conversion]) -> void
82
+
83
+ # : (Conversion) -> Integer
84
+ def print_file: (Conversion) -> Integer
85
+
86
+ # : (Array[Conversion]) -> Integer
87
+ def write_files: (Array[Conversion]) -> Integer
88
+
89
+ # : (String) -> String
90
+ def target_path: (String) -> String
91
+
92
+ # : (Conversion) -> void
93
+ def report: (Conversion) -> void
94
+
95
+ # : (Integer, Integer, Integer, Integer) -> String
96
+ def summary: (Integer, Integer, Integer, Integer) -> String
97
+
98
+ # : (String) -> Integer
99
+ def fail_with: (String) -> Integer
100
+ end
101
+ end
@@ -0,0 +1,59 @@
1
+ # Generated from lib/herbst/converter.rb with RBS::Inline
2
+
3
+ module Herbst
4
+ class Converter
5
+ include Builder
6
+
7
+ INDENT: String
8
+
9
+ type clause = [ String, String?, Array[Herb::AST::Node], Integer? ]
10
+
11
+ attr_reader warnings: Array[String]
12
+
13
+ @markup: bool
14
+
15
+ # : () -> void
16
+ def initialize: () -> void
17
+
18
+ # : (String) -> Herb::AST::DocumentNode
19
+ def convert: (String) -> Herb::AST::DocumentNode
20
+
21
+ # : (String) -> Array[Herb::AST::Node]
22
+ def text_nodes: (String) -> Array[Herb::AST::Node]
23
+
24
+ # : (Integer?, String) -> void
25
+ def warn: (Integer?, String) -> void
26
+
27
+ private
28
+
29
+ # : (Herb::AST::DocumentNode) -> Herb::AST::DocumentNode
30
+ def finish: (Herb::AST::DocumentNode) -> Herb::AST::DocumentNode
31
+
32
+ # : (Integer) -> String
33
+ def newline: (Integer) -> String
34
+
35
+ # : (String) -> String?
36
+ def keyword: (String) -> String?
37
+
38
+ # : (String, String?, Array[Herb::AST::Node], Array[clause], Integer, ?line: Integer?) -> Herb::AST::Node
39
+ def control: (String, String?, Array[Herb::AST::Node], Array[clause], Integer, ?line: Integer?) -> Herb::AST::Node
40
+
41
+ # : (String, Array[Herb::AST::Node], Array[clause]) -> Herb::AST::ERBIfNode
42
+ def control_if: (String, Array[Herb::AST::Node], Array[clause]) -> Herb::AST::ERBIfNode
43
+
44
+ # : (String, Array[Herb::AST::Node], Array[clause]) -> Herb::AST::ERBUnlessNode
45
+ def control_unless: (String, Array[Herb::AST::Node], Array[clause]) -> Herb::AST::ERBUnlessNode
46
+
47
+ # : (String, Array[Herb::AST::Node], Array[clause], Integer, Integer?) -> Herb::AST::ERBCaseNode
48
+ def control_case: (String, Array[Herb::AST::Node], Array[clause], Integer, Integer?) -> Herb::AST::ERBCaseNode
49
+
50
+ # : (String, Array[Herb::AST::Node], Array[clause]) -> Herb::AST::ERBBeginNode
51
+ def control_begin: (String, Array[Herb::AST::Node], Array[clause]) -> Herb::AST::ERBBeginNode
52
+
53
+ # : (String, Array[Herb::AST::Node], Array[clause]) -> Herb::AST::ERBBlockNode
54
+ def control_block: (String, Array[Herb::AST::Node], Array[clause]) -> Herb::AST::ERBBlockNode
55
+
56
+ # : (String?, String, Integer?) -> bot
57
+ def unsupported_clause: (String?, String, Integer?) -> bot
58
+ end
59
+ end
@@ -0,0 +1,49 @@
1
+ # Generated from lib/herbst/haml/attributes.rb with RBS::Inline
2
+
3
+ module Herbst
4
+ module Haml
5
+ class Attributes
6
+ include Builder
7
+
8
+ @warnings: Array[String]
9
+
10
+ # : (Array[String]) -> void
11
+ def initialize: (Array[String]) -> void
12
+
13
+ # : (::Haml::Parser::ParseNode) -> Array[Herb::AST::Node]
14
+ def compile: (::Haml::Parser::ParseNode) -> Array[Herb::AST::Node]
15
+
16
+ private
17
+
18
+ # : (String, Array[[Symbol, untyped]]) -> Array[Herb::AST::Node]
19
+ def compile_attribute: (String, Array[[ Symbol, untyped ]]) -> Array[Herb::AST::Node]
20
+
21
+ # : (String, Array[[Symbol, untyped]], String) { (String) -> String } -> Array[Herb::AST::Node]
22
+ def compile_joined: (String, Array[[ Symbol, untyped ]], String) { (String) -> String } -> Array[Herb::AST::Node]
23
+
24
+ # : (String, [Symbol, untyped]) -> Array[Herb::AST::Node]
25
+ def compile_hash: (String, [ Symbol, untyped ]) -> Array[Herb::AST::Node]
26
+
27
+ # : (String, [Symbol, untyped]) -> Array[Herb::AST::Node]
28
+ def compile_single: (String, [ Symbol, untyped ]) -> Array[Herb::AST::Node]
29
+
30
+ # : (::Haml::Parser::ParseNode, Array[String]) -> Array[Herb::AST::Node]
31
+ def fallback: (::Haml::Parser::ParseNode, Array[String]) -> Array[Herb::AST::Node]
32
+
33
+ # : (String) -> bool
34
+ def literal?: (String) -> bool
35
+
36
+ # : (String) -> bool
37
+ def array_literal?: (String) -> bool
38
+
39
+ # : (String) -> bool
40
+ def boolean?: (String) -> bool
41
+
42
+ # : (String) -> String
43
+ def escape: (String) -> String
44
+
45
+ # : (::Haml::Parser::ParseNode, String) -> void
46
+ def warn: (::Haml::Parser::ParseNode, String) -> void
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,78 @@
1
+ # Generated from lib/herbst/haml/converter.rb with RBS::Inline
2
+
3
+ module Herbst
4
+ module Haml
5
+ # Converts the tree produced by Haml::Parser into a Herb AST.
6
+ #
7
+ # The resulting tree prints to ERB that renders the same HTML as the Haml
8
+ # template (modulo insignificant whitespace).
9
+ class Converter < Herbst::Converter
10
+ MID_BLOCK_KEYWORDS: Array[String]
11
+
12
+ ESCAPED_INTERPOLATION: Regexp
13
+
14
+ type haml_clause = [ ::Haml::Parser::ParseNode, Array[::Haml::Parser::ParseNode] ]
15
+
16
+ @nuke_inner: Array[bool?]
17
+
18
+ @filters: Filters
19
+
20
+ @attributes: Attributes
21
+
22
+ @options: Hash[Symbol, untyped]
23
+
24
+ # : (?Hash[Symbol, untyped]) -> void
25
+ def initialize: (?Hash[Symbol, untyped]) -> void
26
+
27
+ # : (String) -> Herb::AST::DocumentNode
28
+ def convert: (String) -> Herb::AST::DocumentNode
29
+
30
+ # : (Array[::Haml::Parser::ParseNode], Integer) -> Array[Herb::AST::Node]
31
+ def join: (Array[::Haml::Parser::ParseNode], Integer) -> Array[Herb::AST::Node]
32
+
33
+ # : (Array[::Haml::Parser::ParseNode], Integer, ?nuke_edges: bool) -> Array[Herb::AST::Node]
34
+ def block_body: (Array[::Haml::Parser::ParseNode], Integer, ?nuke_edges: bool) -> Array[Herb::AST::Node]
35
+
36
+ # : (String, escape: bool?) -> Array[Herb::AST::Node]
37
+ def interpolate: (String, escape: bool?) -> Array[Herb::AST::Node]
38
+
39
+ private
40
+
41
+ # : (::Haml::Parser::ParseNode, Integer) -> (Herb::AST::Node | Array[Herb::AST::Node])
42
+ def convert_node: (::Haml::Parser::ParseNode, Integer) -> (Herb::AST::Node | Array[Herb::AST::Node])
43
+
44
+ # : (::Haml::Parser::ParseNode, Integer) -> (Herb::AST::Node | Array[Herb::AST::Node])
45
+ def convert_script: (::Haml::Parser::ParseNode, Integer) -> (Herb::AST::Node | Array[Herb::AST::Node])
46
+
47
+ # : (::Haml::Parser::ParseNode, Integer) -> Herb::AST::Node
48
+ def convert_silent_script: (::Haml::Parser::ParseNode, Integer) -> Herb::AST::Node
49
+
50
+ # : (::Haml::Parser::ParseNode) -> [Array[::Haml::Parser::ParseNode], Array[haml_clause]]
51
+ def segments: (::Haml::Parser::ParseNode) -> [ Array[::Haml::Parser::ParseNode], Array[haml_clause] ]
52
+
53
+ # : (::Haml::Parser::ParseNode) -> bool
54
+ def mid_block?: (::Haml::Parser::ParseNode) -> bool
55
+
56
+ # : (::Haml::Parser::ParseNode, Integer) -> (Herb::AST::HTMLElementNode | Array[Herb::AST::Node])
57
+ def convert_tag: (::Haml::Parser::ParseNode, Integer) -> (Herb::AST::HTMLElementNode | Array[Herb::AST::Node])
58
+
59
+ # : (::Haml::Parser::ParseNode, Integer) -> (Herb::AST::Node | Array[Herb::AST::Node])
60
+ def convert_comment: (::Haml::Parser::ParseNode, Integer) -> (Herb::AST::Node | Array[Herb::AST::Node])
61
+
62
+ # : (::Haml::Parser::ParseNode) -> (Herb::AST::HTMLDoctypeNode | Array[Herb::AST::Node])
63
+ def convert_doctype: (::Haml::Parser::ParseNode) -> (Herb::AST::HTMLDoctypeNode | Array[Herb::AST::Node])
64
+
65
+ # : (::Haml::Parser::ParseNode) -> (Herb::AST::ERBCommentNode | Array[Herb::AST::Node])
66
+ def convert_haml_comment: (::Haml::Parser::ParseNode) -> (Herb::AST::ERBCommentNode | Array[Herb::AST::Node])
67
+
68
+ # : (::Haml::Parser::ParseNode) -> bool
69
+ def nuke_whitespace?: (::Haml::Parser::ParseNode) -> bool
70
+
71
+ # : (::Haml::Parser::ParseNode, ::Haml::Parser::ParseNode) -> bool
72
+ def whitespace_between?: (::Haml::Parser::ParseNode, ::Haml::Parser::ParseNode) -> bool
73
+
74
+ # : [T] (bool?) { () -> T } -> T
75
+ def with_nuke_inner: [T] (bool?) { () -> T } -> T
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,25 @@
1
+ # Generated from lib/herbst/haml/filters.rb with RBS::Inline
2
+
3
+ module Herbst
4
+ module Haml
5
+ class Filters
6
+ include Builder
7
+
8
+ @converter: Converter
9
+
10
+ # : (Converter) -> void
11
+ def initialize: (Converter) -> void
12
+
13
+ # : (::Haml::Parser::ParseNode, Integer) -> (Herb::AST::Node | Array[Herb::AST::Node])
14
+ def convert: (::Haml::Parser::ParseNode, Integer) -> (Herb::AST::Node | Array[Herb::AST::Node])
15
+
16
+ private
17
+
18
+ # : (String, Integer) -> Array[Herb::AST::Node]
19
+ def wrapped: (String, Integer) -> Array[Herb::AST::Node]
20
+
21
+ # : (String) -> Array[Herb::AST::Node]
22
+ def text_nodes: (String) -> Array[Herb::AST::Node]
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ # Generated from lib/herbst/haml.rb with RBS::Inline
2
+
3
+ module Herbst
4
+ # Converts Haml templates into Herb's syntax tree and ERB.
5
+ #
6
+ # Herbst::Haml.parse("%p= greeting") # => Herb::AST::DocumentNode
7
+ # Herbst::Haml.to_erb("%p= greeting") # => "<p><%= greeting %></p>\n"
8
+ #
9
+ # To compile Haml, compile its ERB with Herb::Engine:
10
+ #
11
+ # Herb::Engine.new(Herbst::Haml.to_erb(source), escape: true).src
12
+ #
13
+ # Use Herbst::Haml::Converter directly to read the warnings of a conversion. The haml gem is
14
+ # only needed when converting Haml, so it isn't a dependency of Herbst.
15
+ module Haml
16
+ # : (String, **untyped) -> Herb::AST::DocumentNode
17
+ def self.parse: (String, **untyped) -> Herb::AST::DocumentNode
18
+
19
+ # : (String, ?format: bool, **untyped) -> String
20
+ def self.to_erb: (String, ?format: bool, **untyped) -> String
21
+ end
22
+ end
@@ -0,0 +1,206 @@
1
+ # Generated from lib/herbst/identity_printer.rb with RBS::Inline
2
+
3
+ module Herbst
4
+ class IdentityPrinter < Herb::Visitor
5
+ interface _ERBTag
6
+ def tag_opening: () -> Herb::Token?
7
+
8
+ def content: () -> Herb::Token?
9
+
10
+ def tag_closing: () -> Herb::Token?
11
+ end
12
+
13
+ interface _Delimited
14
+ def tag_opening: () -> Herb::Token?
15
+
16
+ def children: () -> Array[Herb::AST::Node]
17
+
18
+ def tag_closing: () -> Herb::Token?
19
+ end
20
+
21
+ @line_offsets: Array[Integer]?
22
+
23
+ @output: String
24
+
25
+ @source: String?
26
+
27
+ # : (Herb::AST::Node, ?source: String?) -> String
28
+ def self.print: (Herb::AST::Node, ?source: String?) -> String
29
+
30
+ # : (?source: String?) -> void
31
+ def initialize: (?source: String?) -> void
32
+
33
+ # : (Herb::AST::Node) -> String
34
+ def print: (Herb::AST::Node) -> String
35
+
36
+ # : (Herb::AST::DocumentNode) -> void
37
+ def visit_document_node: (Herb::AST::DocumentNode) -> void
38
+
39
+ # : (Herb::AST::LiteralNode) -> void
40
+ def visit_literal_node: (Herb::AST::LiteralNode) -> void
41
+
42
+ # : (Herb::AST::HTMLTextNode) -> void
43
+ def visit_html_text_node: (Herb::AST::HTMLTextNode) -> void
44
+
45
+ # : (Herb::AST::WhitespaceNode) -> void
46
+ def visit_whitespace_node: (Herb::AST::WhitespaceNode) -> void
47
+
48
+ # : (Herb::AST::HTMLOpenTagNode) -> void
49
+ def visit_html_open_tag_node: (Herb::AST::HTMLOpenTagNode) -> void
50
+
51
+ # : (Herb::AST::HTMLConditionalOpenTagNode) -> void
52
+ def visit_html_conditional_open_tag_node: (Herb::AST::HTMLConditionalOpenTagNode) -> void
53
+
54
+ # : (Herb::AST::HTMLCloseTagNode) -> void
55
+ def visit_html_close_tag_node: (Herb::AST::HTMLCloseTagNode) -> void
56
+
57
+ # : (Herb::AST::HTMLOmittedCloseTagNode) -> void
58
+ def visit_html_omitted_close_tag_node: (Herb::AST::HTMLOmittedCloseTagNode) -> void
59
+
60
+ # : (Herb::AST::HTMLVirtualCloseTagNode) -> void
61
+ def visit_html_virtual_close_tag_node: (Herb::AST::HTMLVirtualCloseTagNode) -> void
62
+
63
+ # : (Herb::AST::HTMLElementNode) -> void
64
+ def visit_html_element_node: (Herb::AST::HTMLElementNode) -> void
65
+
66
+ # : (Herb::AST::HTMLConditionalElementNode) -> void
67
+ def visit_html_conditional_element_node: (Herb::AST::HTMLConditionalElementNode) -> void
68
+
69
+ # : (Herb::AST::HTMLAttributeNode) -> void
70
+ def visit_html_attribute_node: (Herb::AST::HTMLAttributeNode) -> void
71
+
72
+ # : (Herb::AST::HTMLAttributeNameNode) -> void
73
+ def visit_html_attribute_name_node: (Herb::AST::HTMLAttributeNameNode) -> void
74
+
75
+ # : (Herb::AST::HTMLAttributeValueNode) -> void
76
+ def visit_html_attribute_value_node: (Herb::AST::HTMLAttributeValueNode) -> void
77
+
78
+ # : (Herb::AST::RubyLiteralNode) -> void
79
+ def visit_ruby_literal_node: (Herb::AST::RubyLiteralNode) -> void
80
+
81
+ # : (Herb::AST::RubyHTMLAttributesSplatNode) -> void
82
+ def visit_ruby_html_attributes_splat_node: (Herb::AST::RubyHTMLAttributesSplatNode) -> void
83
+
84
+ # : (Herb::AST::HTMLCommentNode) -> void
85
+ def visit_html_comment_node: (Herb::AST::HTMLCommentNode) -> void
86
+
87
+ # : (Herb::AST::HTMLDoctypeNode) -> void
88
+ def visit_html_doctype_node: (Herb::AST::HTMLDoctypeNode) -> void
89
+
90
+ # : (Herb::AST::XMLDeclarationNode) -> void
91
+ def visit_xml_declaration_node: (Herb::AST::XMLDeclarationNode) -> void
92
+
93
+ # : (Herb::AST::CDATANode) -> void
94
+ def visit_cdata_node: (Herb::AST::CDATANode) -> void
95
+
96
+ # : (Herb::AST::XMLProcessingInstructionNode) -> void
97
+ def visit_xml_processing_instruction_node: (Herb::AST::XMLProcessingInstructionNode) -> void
98
+
99
+ # : (Herb::AST::ERBOpenTagNode) -> void
100
+ def visit_erb_open_tag_node: (Herb::AST::ERBOpenTagNode) -> void
101
+
102
+ # : (Herb::AST::ERBContentNode) -> void
103
+ def visit_erb_content_node: (Herb::AST::ERBContentNode) -> void
104
+
105
+ # : (Herb::AST::ERBCommentNode) -> void
106
+ def visit_erb_comment_node: (Herb::AST::ERBCommentNode) -> void
107
+
108
+ # : (Herb::AST::ERBIfNode) -> void
109
+ def visit_erb_if_node: (Herb::AST::ERBIfNode) -> void
110
+
111
+ # : (Herb::AST::ERBElseNode) -> void
112
+ def visit_erb_else_node: (Herb::AST::ERBElseNode) -> void
113
+
114
+ # : (Herb::AST::ERBEndNode) -> void
115
+ def visit_erb_end_node: (Herb::AST::ERBEndNode) -> void
116
+
117
+ # : (Herb::AST::ERBBlockNode) -> void
118
+ def visit_erb_block_node: (Herb::AST::ERBBlockNode) -> void
119
+
120
+ # : (Herb::AST::ERBIterationBlockNode) -> void
121
+ def visit_erb_iteration_block_node: (Herb::AST::ERBIterationBlockNode) -> void
122
+
123
+ # : (Herb::AST::ERBCaseNode) -> void
124
+ def visit_erb_case_node: (Herb::AST::ERBCaseNode) -> void
125
+
126
+ # : (Herb::AST::ERBWhenNode) -> void
127
+ def visit_erb_when_node: (Herb::AST::ERBWhenNode) -> void
128
+
129
+ # : (Herb::AST::ERBWhileNode) -> void
130
+ def visit_erb_while_node: (Herb::AST::ERBWhileNode) -> void
131
+
132
+ # : (Herb::AST::ERBUntilNode) -> void
133
+ def visit_erb_until_node: (Herb::AST::ERBUntilNode) -> void
134
+
135
+ # : (Herb::AST::ERBForNode) -> void
136
+ def visit_erb_for_node: (Herb::AST::ERBForNode) -> void
137
+
138
+ # : (Herb::AST::ERBBeginNode) -> void
139
+ def visit_erb_begin_node: (Herb::AST::ERBBeginNode) -> void
140
+
141
+ # : (Herb::AST::ERBRescueNode) -> void
142
+ def visit_erb_rescue_node: (Herb::AST::ERBRescueNode) -> void
143
+
144
+ # : (Herb::AST::ERBEnsureNode) -> void
145
+ def visit_erb_ensure_node: (Herb::AST::ERBEnsureNode) -> void
146
+
147
+ # : (Herb::AST::ERBUnlessNode) -> void
148
+ def visit_erb_unless_node: (Herb::AST::ERBUnlessNode) -> void
149
+
150
+ # : (Herb::AST::ERBRenderNode) -> void
151
+ def visit_erb_render_node: (Herb::AST::ERBRenderNode) -> void
152
+
153
+ # : (Herb::AST::RubyRenderKeywordsNode) -> void
154
+ def visit_ruby_render_keywords_node: (Herb::AST::RubyRenderKeywordsNode) -> void
155
+
156
+ # : (Herb::AST::RubyRenderLocalNode) -> void
157
+ def visit_ruby_render_local_node: (Herb::AST::RubyRenderLocalNode) -> void
158
+
159
+ # : (Herb::AST::ERBStrictLocalsNode) -> void
160
+ def visit_erb_strict_locals_node: (Herb::AST::ERBStrictLocalsNode) -> void
161
+
162
+ # : (Herb::AST::HerbDirectiveNode) -> void
163
+ def visit_herb_directive_node: (Herb::AST::HerbDirectiveNode) -> void
164
+
165
+ # : (Herb::AST::HerbStateDirectiveNode) -> void
166
+ def visit_herb_state_directive_node: (Herb::AST::HerbStateDirectiveNode) -> void
167
+
168
+ # : (Herb::AST::HerbStateDeclarationNode) -> void
169
+ def visit_herb_state_declaration_node: (Herb::AST::HerbStateDeclarationNode) -> void
170
+
171
+ # : (Herb::AST::RubyParameterNode) -> void
172
+ def visit_ruby_parameter_node: (Herb::AST::RubyParameterNode) -> void
173
+
174
+ # : (Herb::AST::ERBYieldNode) -> void
175
+ def visit_erb_yield_node: (Herb::AST::ERBYieldNode) -> void
176
+
177
+ # : (Herb::AST::ERBInNode) -> void
178
+ def visit_erb_in_node: (Herb::AST::ERBInNode) -> void
179
+
180
+ # : (Herb::AST::ERBCaseMatchNode) -> void
181
+ def visit_erb_case_match_node: (Herb::AST::ERBCaseMatchNode) -> void
182
+
183
+ private
184
+
185
+ # : (String?) -> void
186
+ def write: (String?) -> void
187
+
188
+ # : () -> bool
189
+ def ends_with_whitespace?: () -> bool
190
+
191
+ # : (_ERBTag) -> void
192
+ def print_erb: (_ERBTag) -> void
193
+
194
+ # : (_Delimited) -> void
195
+ def print_delimited: (_Delimited) -> void
196
+
197
+ # : (Herb::Position, Herb::Position) -> String
198
+ def separator_between: (Herb::Position, Herb::Position) -> String
199
+
200
+ # : (String, Herb::Position, Herb::Position) -> String?
201
+ def slice_between: (String, Herb::Position, Herb::Position) -> String?
202
+
203
+ # : (String, Herb::Position) -> Integer?
204
+ def offset: (String, Herb::Position) -> Integer?
205
+ end
206
+ end
@@ -0,0 +1,25 @@
1
+ # Generated from lib/herbst/printer.rb with RBS::Inline
2
+
3
+ module Herbst
4
+ module Printer
5
+ FORMATTER: Array[String]
6
+
7
+ class Error < Herbst::Error
8
+ end
9
+
10
+ # : (Herb::AST::DocumentNode, ?format: bool) -> String
11
+ def self.print: (Herb::AST::DocumentNode, ?format: bool) -> String
12
+
13
+ # : (Array[Herb::AST::DocumentNode], ?format: bool) -> Array[String]
14
+ def self.print_all: (Array[Herb::AST::DocumentNode], ?format: bool) -> Array[String]
15
+
16
+ # : (String) -> String
17
+ def self.format: (String) -> String
18
+
19
+ # : (Array[String]) -> Array[String]
20
+ def self.format_all: (Array[String]) -> Array[String]
21
+
22
+ # : (*String, **untyped) -> String
23
+ def self.run: (*String, **untyped) -> String
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ # Generated from lib/herbst/round_trip.rb with RBS::Inline
2
+
3
+ module Herbst
4
+ # Checks that printed ERB parses back into exactly the tree it was printed from.
5
+ #
6
+ # The ERB is parsed with `track_whitespace: true`, and every node, field, token value and
7
+ # whitespace node is compared. Only source positions and Prism data are ignored, since a
8
+ # built tree doesn't have them.
9
+ #
10
+ # Herbst::RoundTrip.difference(document, erb) # => nil, or where the trees differ
11
+ module RoundTrip
12
+ POSITIONAL_FIELDS: Array[String]
13
+
14
+ # : (Herb::AST::DocumentNode, String) -> String?
15
+ def self.difference: (Herb::AST::DocumentNode, String) -> String?
16
+
17
+ # : (Herb::AST::Node) -> untyped
18
+ def self.comparable: (Herb::AST::Node) -> untyped
19
+
20
+ # : (untyped) -> untyped
21
+ def self.strip_positions: (untyped) -> untyped
22
+
23
+ # : (untyped, untyped, String) -> String?
24
+ def self.tree_difference: (untyped, untyped, String) -> String?
25
+ end
26
+ end