Class: Treetop::Compiler::Sequence
- Inherits:
-
ParsingExpression
show all
- Defined in:
- lib/puppet_x/wildfly/gems/treetop-1.6.8/lib/treetop/compiler/node_classes/sequence.rb
Instance Attribute Summary
#address, #builder, #parent_expression, #subexpression_address, #var_symbols
#input, #interval, #parent
Instance Method Summary
collapse
#accumulate_subexpression_result, #accumulator_var, #assign_failure, #assign_lazily_instantiated_node, #assign_result, #begin_comment, #declared_module_name, #decorated?, #end_comment, #epsilon_node, #extend_result, #extend_result_with_declared_module, #extend_result_with_inline_module, #init_value, #inline_module_name, #obtain_new_subexpression_address, #on_one_line, #optional_arg, #reset_index, #result_var, #start_index_var, #subexpression_result_var, #subexpression_success?, #use_vars, #var, #var_initialization
#<=>, #dot_id, #elements, #empty?, #extension_modules, #initialize, #inspect, #inspect_children, #inspect_self, #nonterminal?, #terminal?, #text_value, #write_dot, #write_dot_file
Instance Method Details
#compile(address, builder, parent_expression = nil) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/puppet_x/wildfly/gems/treetop-1.6.8/lib/treetop/compiler/node_classes/sequence.rb', line 4
def compile(address, builder, parent_expression = nil)
super
(self)
use_vars :result, :start_index, :accumulator
compile_sequence_elements(sequence_elements)
builder.if__ "#{accumulator_var}.last" do
assign_result "instantiate_node(#{node_class_name},input, #{start_index_var}...index, #{accumulator_var})"
extend_result sequence_element_accessor_module_name if sequence_element_accessor_module_name
extend_result_with_inline_module parent_expression
end
builder.else_ do
reset_index
assign_failure start_index_var
end
(self)
end
|
#compile_sequence_elements(elements) ⇒ Object
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/puppet_x/wildfly/gems/treetop-1.6.8/lib/treetop/compiler/node_classes/sequence.rb', line 25
def compile_sequence_elements(elements)
obtain_new_subexpression_address
elements.first.compile(subexpression_address, builder)
accumulate_subexpression_result
if elements.size > 1
builder.if_ subexpression_success? do
compile_sequence_elements(elements[1..-1])
end
end
end
|
#expected ⇒ Object
44
45
46
|
# File 'lib/puppet_x/wildfly/gems/treetop-1.6.8/lib/treetop/compiler/node_classes/sequence.rb', line 44
def expected
'"<a sequence>"'
end
|
#node_class_name ⇒ Object
21
22
23
|
# File 'lib/puppet_x/wildfly/gems/treetop-1.6.8/lib/treetop/compiler/node_classes/sequence.rb', line 21
def node_class_name
node_class_declarations.node_class_name || 'SyntaxNode'
end
|
#sequence_element_accessor_module ⇒ Object
36
37
38
|
# File 'lib/puppet_x/wildfly/gems/treetop-1.6.8/lib/treetop/compiler/node_classes/sequence.rb', line 36
def sequence_element_accessor_module
@sequence_element_accessor_module ||= SequenceElementAccessorModule.new(sequence_elements)
end
|
#sequence_element_accessor_module_name ⇒ Object
40
41
42
|
# File 'lib/puppet_x/wildfly/gems/treetop-1.6.8/lib/treetop/compiler/node_classes/sequence.rb', line 40
def sequence_element_accessor_module_name
sequence_element_accessor_module.module_name
end
|