Sha256: 051196575d3066db34dd340fd124011dd3014dad7fbf645fcb16358458ba477c

Contents?: true

Size: 315 Bytes

Versions: 3

Compression:

Stored size: 315 Bytes

Contents

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

$:.unshift '../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

3 entries across 3 versions & 1 rubygems

Version Path
parslet-1.1.1 example/documentation.rb
parslet-1.1.0 example/documentation.rb
parslet-1.0.1 example/documentation.rb