Sha256: e12ef4da44f54d65d1328a5fdb3a41e91376f9c992afa61f0be04f46929fc762

Contents?: true

Size: 640 Bytes

Versions: 8

Compression:

Stored size: 640 Bytes

Contents

module Treetop
  module Compiler    
    class Terminal < AtomicExpression
      def compile(address, builder, parent_expression = nil)
        super
        string_length = eval(text_value).length
        
        builder.if__ "input.index(#{text_value}, index) == index" do
          assign_result "instantiate_node(#{node_class_name},input, index...(index + #{string_length}))"
          extend_result_with_inline_module
          builder << "@index += #{string_length}"
        end
        builder.else_ do
          builder << "terminal_parse_failure(#{text_value})"
          assign_result 'nil'
        end
      end
    end
 end
end

Version data entries

8 entries across 8 versions & 4 rubygems

Version Path
skylinecms-3.1.0 vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb
personify-1.0.0 vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb
westarete-skylinecms-3.0.8.20100329 vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb
westarete-skylinecms-3.0.8.20100330 vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb
skylinecms-3.0.8 vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb
skylinecms-3.0.7 vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb
treetop-1.2.6 lib/treetop/compiler/node_classes/terminal.rb
treetop-1.2.5 lib/treetop/compiler/node_classes/terminal.rb