# class Treetop::Compiler::Sequence

### Public Instance Methods

compile(address, builder, parent_expression = nil) click to toggle source
Calls superclass method Treetop::Compiler::ParsingExpression#compile

    # File lib/treetop/compiler/node_classes/sequence.rb, line 4
    def compile(address, builder, parent_expression = nil)
      super
      begin_comment(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
      end
      builder.else_ do
        reset_index
        assign_failure start_index_var
      end
      end_comment(self)
    end

compile_sequence_elements(elements) click to toggle source

    # File 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

node_class_name() click to toggle source

    # File 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() click to toggle source

    # File 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() click to toggle source

    # File lib/treetop/compiler/node_classes/sequence.rb, line 40
    def sequence_element_accessor_module_name
      sequence_element_accessor_module.module_name
    end