Sha256: ee304d4776902de50602ab7805e238e644ec865ee2563e22791b30f5c1842687

Contents?: true

Size: 711 Bytes

Versions: 3

Compression:

Stored size: 711 Bytes

Contents

module Treetop
  module Compiler    
    class AnythingSymbol < AtomicExpression
      def compile(address, builder, parent_expression = nil)
        super
        builder.if__ "index < input_length" do
          if address == 0 || decorated?
	    assign_result "instantiate_node(#{node_class_name},input, index...(index + 1))"
	    extend_result_with_inline_module parent_expression
          else
            assign_lazily_instantiated_node
          end
          builder << "@index += 1"
        end
        builder.else_ do
          builder << 'terminal_parse_failure("any character")'
          assign_result 'nil'
        end
      end

      def expected
	'"any character"'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
treetop-1.6.5 lib/treetop/compiler/node_classes/anything_symbol.rb
treetop-1.6.4 lib/treetop/compiler/node_classes/anything_symbol.rb
treetop-1.6.2 lib/treetop/compiler/node_classes/anything_symbol.rb