Sha256: d5a713c066b28c8fbe70f40b73a674832653848fc023c526cbce315597d547eb

Contents?: true

Size: 1014 Bytes

Versions: 350

Compression:

Stored size: 1014 Bytes

Contents

module Treetop
  module Compiler
    class Predicate < ParsingExpression
      def compile(address, builder, parent_expression)
        super
        begin_comment(parent_expression)
        use_vars :result, :start_index
        obtain_new_subexpression_address
        parent_expression.prefixed_expression.compile(subexpression_address, builder)
        builder.if__(subexpression_success?) { when_success }
        builder.else_ { when_failure }
        end_comment(parent_expression)
      end
      
      def assign_failure
        super(start_index_var)
      end
      
      def assign_success
        reset_index
        assign_result epsilon_node
      end
    end
    
    class AndPredicate < Predicate
      def when_success
        assign_success
      end

      def when_failure
        assign_failure
      end
    end
    
    class NotPredicate < Predicate
      def when_success
        assign_failure
      end
      
      def when_failure
        assign_success
      end
    end
  end
end

Version data entries

350 entries across 305 versions & 42 rubygems

Version Path
logstash-output-scalyr-0.1.9 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-output-scalyr-0.1.8 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-output-scalyr-0.1.7 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-output-scalyr-0.1.6 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-output-newrelic-1.2.0 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.3.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.3.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-output-scalyr-0.1.5 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-output-scalyr-0.1.4 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-output-scalyr-0.1.3 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-output-scalyr-0.1.2 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-filter-device_detection-1.0.7-java vendor/bundle/jruby/1.9/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
mrcooper-logstash-output-azuresearch-0.2.2 vendor/jruby/2.5.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-output-icinga-1.1.0 vendor/jruby/2.3.0/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/treetop-1.4.15/lib/treetop/compiler/node_classes/predicate.rb