Sha256: 10c593b0091ce02c52b04d16caac0355cf7f7d29289a83e656cfbb978430f62a

Contents?: true

Size: 341 Bytes

Versions: 19

Compression:

Stored size: 341 Bytes

Contents

# A small example that shows a really small parser and what happens on parser
# errors. 

$:.unshift File.dirname(__FILE__) + "/../lib"

require 'pp'
require 'parslet'

class MyParser < Parslet::Parser
  rule(:a) { str('a').repeat }
  
  def parse(str)
    a.parse(str)
  end
end

pp MyParser.new.parse('aaaa')
pp MyParser.new.parse('bbbb')

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
parslet-2.0.0 example/documentation.rb
parslet-1.8.2 example/documentation.rb
parslet-1.8.1 example/documentation.rb
parslet-1.8.0 example/documentation.rb
swift-pyrite-0.1.1 vendor/bundle/ruby/2.0.0/gems/parslet-1.7.1/example/documentation.rb
swift-pyrite-0.1.0 vendor/bundle/ruby/2.0.0/gems/parslet-1.7.1/example/documentation.rb
parslet-1.7.1 example/documentation.rb
parslet-1.7.0 example/documentation.rb
parslet-1.6.2 example/documentation.rb
parslet-1.6.1 example/documentation.rb
parslet-1.6.0 example/documentation.rb
parslet-1.5.0 example/documentation.rb
ghazel-parslet-1.4.0.2 example/documentation.rb
ghazel-parslet-1.4.0.1 example/documentation.rb
parslet-1.4.0 example/documentation.rb
parslet-1.3.0 example/documentation.rb
parslet-1.2.3 example/documentation.rb
parslet-1.2.1 example/documentation.rb
parslet-1.2.0 example/documentation.rb