INTRODUCTION
Parslet makes developing complex parsers easy. It does so by
Parslet takes the long way around to make your job easier. It allows for incremental language construction. Often, you start out small, implementing the atoms of your language first; parslet takes pride in making this possible.
Eager to try this out? Please see the associated web site: https://kschiess.github.io/parslet/
SYNOPSIS
require 'parslet' include Parslet
str('foo'). parse('foo') # => "foo"@0
match['abc'].parse('a') # => "a"@0 match['abc'].parse('b') # => "b"@0 match['abc'].parse('c') # => "c"@0
str('foo').as(:important_bit). parse('foo') # => {:important_bit=>"foo"@0}
quote = str('"') simple_string = quote >> (quote.absent? >> any).repeat >> quote
simple_string. parse('"Simple Simple Simple"') # => "\"Simple Simple Simple\""@0
class Smalltalk < Parslet::Parser root :smalltalk
rule(:smalltalk) { statements }
rule(:statements) {
# insert smalltalk parser here (outside of the scope of this readme)
}
end
Smalltalk.new.parse('smalltalk')
FEATURES
COMPATIBILITY
This library is intended to work with Ruby variants >= 1.9. I've tested it on MRI 1.9, rbx-head, jruby. Please report as a bug if you encounter issues.
STATUS
Production worthy.
(c) 2010-today Kaspar Schiess