Sha256: fad3720467ef22c21f226f779a4236f8819fc889bd31ceb0257b3ae18a8e7a8f

Contents?: true

Size: 613 Bytes

Versions: 7

Compression:

Stored size: 613 Bytes

Contents

require 'spec_helper'

describe "Unconsumed input:" do
  class RepeatingBlockParser < Parslet::Parser
    root :expressions
    rule(:expressions) { expression.repeat }
    rule(:expression) { str('(') >> aab >> str(')') }
    rule(:aab) { str('a').repeat(1) >> str('b') }
  end
  describe RepeatingBlockParser do
    let(:parser) { described_class.new }
    it "throws annotated error" do
      error = catch_failed_parse { parser.parse('(aaac)') }
    end
    it "doesn't error out if prefix is true" do
      expect {
        parser.parse('(aaac)', :prefix => true)
      }.not_to raise_error
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
parslet-2.0.0 spec/acceptance/unconsumed_input_spec.rb
parslet-1.8.2 spec/acceptance/unconsumed_input_spec.rb
parslet-1.8.1 spec/acceptance/unconsumed_input_spec.rb
parslet-1.8.0 spec/acceptance/unconsumed_input_spec.rb
swift-pyrite-0.1.1 vendor/bundle/ruby/2.0.0/gems/parslet-1.7.1/spec/acceptance/unconsumed_input_spec.rb
swift-pyrite-0.1.0 vendor/bundle/ruby/2.0.0/gems/parslet-1.7.1/spec/acceptance/unconsumed_input_spec.rb
parslet-1.7.1 spec/acceptance/unconsumed_input_spec.rb