# parslet-1.5.0 Documentation

INTRODUCTION

Parslet makes developing complex parsers easy. It does so by

- providing the best error reporting possible

- not generating reams of code for you to debug

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: kschiess.github.com/parslet

SYNOPSIS

    require 'parslet'
    include Parslet

    # parslet parses strings
    str('foo').
      parse('foo') # => "foo"@0

    # it matches character sets
    match['abc'].parse('a') # => "a"@0
    match['abc'].parse('b') # => "b"@0
    match['abc'].parse('c') # => "c"@0

    # and it annotates its output
    str('foo').as(:important_bit).
      parse('foo') # => {:important_bit=>"foo"@0}

    # you can construct parsers with just a few lines
    quote = str('"')
    simple_string = quote >> (quote.absent? >> any).repeat >> quote

    simple_string.
      parse('"Simple Simple Simple"') # => "\"Simple Simple Simple\""@0

    # or by making a fuss about it
    class Smalltalk < Parslet::Parser
      root :smalltalk

      rule(:smalltalk) { statements }
      rule(:statements) {
        # insert smalltalk parser here (outside of the scope of this readme)
      }
    end

    # and then
    Smalltalk.new.parse('smalltalk')

COMPATIBILITY

This library should work with most rubies. I've tested it with MRI 1.8 (except 1.8.6), 1.9, rbx-head, jruby. Please report as a bug if you encounter issues.

Note that due to Ruby 1.8 internals, Unicode parsing is not supported on that version.

On Mac OS X Lion, ruby-1.8.7-p352 has been known to segfault. Use ruby-1.8.7-p334 for better results.

STATUS

Production worthy.

(c) 2010, 2011, 2012 Kaspar Schiess

## Files

- README

## Classes/Modules

- Parslet
- Parslet::Atoms
- Parslet::Atoms::Alternative
- Parslet::Atoms::Base
- Parslet::Atoms::CanFlatten
- Parslet::Atoms::Capture
- Parslet::Atoms::Context
- Parslet::Atoms::DSL
- Parslet::Atoms::Dynamic
- Parslet::Atoms::Entity
- Parslet::Atoms::Lookahead
- Parslet::Atoms::Named
- Parslet::Atoms::Precedence
- Parslet::Atoms::Re
- Parslet::Atoms::Repetition
- Parslet::Atoms::Scope
- Parslet::Atoms::Sequence
- Parslet::Atoms::Str
- Parslet::Cause
- Parslet::ClassMethods
- Parslet::DelayedMatchConstructor
- Parslet::ErrorReporter
- Parslet::ErrorReporter::Deepest
- Parslet::ErrorReporter::Tree
- Parslet::Expression
- Parslet::Expression::Treetop
- Parslet::Expression::Treetop::Parser
- Parslet::Expression::Treetop::Transform
- Parslet::ParseFailed
- Parslet::Parser
- Parslet::Parser::PrettyPrinter
- Parslet::Parser::Visitors
- Parslet::Parser::Visitors::Citrus
- Parslet::Parser::Visitors::Treetop
- Parslet::Pattern
- Parslet::Pattern::SequenceBind
- Parslet::Pattern::SimpleBind
- Parslet::Pattern::SubtreeBind
- Parslet::Scope
- Parslet::Scope::Binding
- Parslet::Scope::NotFound
- Parslet::Slice
- Parslet::Source
- Parslet::Source::LineCache
- Parslet::Source::RangeSearch
- Parslet::Transform
- Parslet::Transform::Context

## Methods

- ::any — Parslet
- ::dynamic — Parslet
- ::exp — Parslet
- ::format — Parslet::Cause
- ::included — Parslet
- ::match — Parslet
- ::new — Parslet::Atoms::Entity
- ::new — Parslet::Slice
- ::new — Parslet::Atoms::Context
- ::new — Parslet::Source
- ::new — Parslet::Source::LineCache
- ::new — Parslet::Parser::Visitors::Citrus
- ::new — Parslet::ErrorReporter::Deepest
- ::new — Parslet::Atoms::Dynamic
- ::new — Parslet::Transform::Context
- ::new — Parslet::Scope
- ::new — Parslet::Cause
- ::new — Parslet::Parser::PrettyPrinter
- ::new — Parslet::Expression
- ::new — Parslet::Atoms::Repetition
- ::new — Parslet::Atoms::Sequence
- ::new — Parslet::Transform
- ::new — Parslet::Atoms::Lookahead
- ::new — Parslet::ParseFailed
- ::new — Parslet::Atoms::Scope
- ::new — Parslet::Atoms::Str
- ::new — Parslet::Atoms::Named
- ::new — Parslet::Scope::Binding
- ::new — Parslet::Pattern
- ::new — Parslet::Atoms::Capture
- ::new — Parslet::Atoms::Re
- ::new — Parslet::Atoms::Alternative
- ::root — Parslet::Parser
- ::rule — Parslet::Transform
- ::rules — Parslet::Transform
- ::scope — Parslet
- ::sequence — Parslet
- ::simple — Parslet
- ::str — Parslet
- ::subtree — Parslet
- #+ — Parslet::Slice
- #== — Parslet::Slice
- #>> — Parslet::Atoms::DSL
- #>> — Parslet::Atoms::Sequence
- #[] — Parslet::DelayedMatchConstructor
- #[] — Parslet::Scope::Binding
- #[] — Parslet::Scope
- #[]= — Parslet::Scope::Binding
- #[]= — Parslet::Scope
- #absent? — Parslet::Atoms::DSL
- #absnt? — Parslet::Atoms::DSL
- #accept — Parslet::Atoms::Entity
- #accept — Parslet::Atoms::Lookahead
- #accept — Parslet::Atoms::Sequence
- #accept — Parslet::Atoms::Alternative
- #accept — Parslet::Atoms::Base
- #accept — Parslet::Atoms::Named
- #accept — Parslet::Atoms::Re
- #accept — Parslet::Atoms::Str
- #accept — Parslet::Atoms::Repetition
- #accept — Parslet::Parser
- #apply — Parslet::Atoms::Scope
- #apply — Parslet::Atoms::Capture
- #apply — Parslet::Transform
- #apply — Parslet::Atoms::Named
- #as — Parslet::Atoms::DSL
- #ascii_tree — Parslet::Cause
- #cached? — Parslet::Atoms::Dynamic
- #cached? — Parslet::Atoms::Scope
- #call_on_match — Parslet::Transform
- #can_bind? — Parslet::Pattern::SimpleBind
- #can_bind? — Parslet::Pattern::SequenceBind
- #can_bind? — Parslet::Pattern::SubtreeBind
- #capture — Parslet::Atoms::DSL
- #chars_left — Parslet::Source
- #children — Parslet::Cause
- #consume — Parslet::Source
- #deepest — Parslet::ErrorReporter::Deepest
- #deferred — Parslet::Parser::PrettyPrinter
- #element_match — Parslet::Pattern
- #element_match_ary_single — Parslet::Pattern
- #element_match_binding — Parslet::Pattern
- #element_match_hash — Parslet::Pattern
- #err — Parslet::ErrorReporter::Deepest
- #err — Parslet::ErrorReporter::Tree
- #err — Parslet::Atoms::Context
- #err_at — Parslet::ErrorReporter::Deepest
- #err_at — Parslet::Atoms::Context
- #err_at — Parslet::ErrorReporter::Tree
- #find_mid — Parslet::Source::RangeSearch
- #flatten — Parslet::Atoms::CanFlatten
- #flatten_repetition — Parslet::Atoms::CanFlatten
- #flatten_sequence — Parslet::Atoms::CanFlatten
- #foldl — Parslet::Atoms::CanFlatten
- #inspect — Parslet::Pattern::SubtreeBind
- #inspect — Parslet::Slice
- #lbound — Parslet::Source::RangeSearch
- #line_and_column — Parslet::Slice
- #line_and_column — Parslet::Source
- #line_and_column — Parslet::Source::LineCache
- #mangle_name — Parslet::Parser::PrettyPrinter
- #match — Parslet::Slice
- #match — Parslet::Pattern
- #match — Parslet::Source
- #matches? — Parslet::Source
- #maybe — Parslet::Atoms::DSL
- #merge_fold — Parslet::Atoms::CanFlatten
- #meta_def — Parslet::Transform::Context
- #parse — Parslet::Expression
- #parse_with_debug — Parslet::Atoms::Base
- #parslet — Parslet::Atoms::Entity
- #pop — Parslet::Scope
- #present? — Parslet::Atoms::DSL
- #pretty_print — Parslet::Parser::PrettyPrinter
- #prsnt? — Parslet::Atoms::DSL
- #push — Parslet::Scope
- #raise — Parslet::Cause
- #recurse_array — Parslet::Transform
- #recurse_hash — Parslet::Transform
- #repeat — Parslet::Atoms::DSL
- #rule — Parslet::Transform
- #rule — Parslet::Parser::PrettyPrinter
- #rule — Parslet::ClassMethods
- #rules — Parslet::Transform
- #scan_for_line_endings — Parslet::Source::LineCache
- #scope — Parslet::Atoms::Context
- #size — Parslet::Slice
- #spaced — Parslet::Expression::Treetop::Parser
- #to_citrus — Parslet::Parser
- #to_f — Parslet::Slice
- #to_i — Parslet::Slice
- #to_int — Parslet::Slice
- #to_parslet — Parslet::Expression
- #to_s — Parslet::Cause
- #to_s — Parslet::Slice
- #to_s_inner — Parslet::Atoms::Entity
- #to_s_inner — Parslet::Parser
- #to_s_inner — Parslet::Atoms::Named
- #to_s_inner — Parslet::Atoms::Dynamic
- #to_s_inner — Parslet::Atoms::Re
- #to_s_inner — Parslet::Atoms::Capture
- #to_s_inner — Parslet::Atoms::Repetition
- #to_s_inner — Parslet::Atoms::Alternative
- #to_s_inner — Parslet::Atoms::Str
- #to_s_inner — Parslet::Atoms::Sequence
- #to_s_inner — Parslet::Atoms::Lookahead
- #to_s_inner — Parslet::Atoms::Scope
- #to_slice — Parslet::Slice
- #to_str — Parslet::Slice
- #to_sym — Parslet::Slice
- #to_treetop — Parslet::Parser
- #transform — Parslet::Expression
- #transform_elt — Parslet::Transform
- #try — Parslet::Atoms::Re
- #try — Parslet::Atoms::Repetition
- #try — Parslet::Parser
- #try — Parslet::Atoms::Dynamic
- #try — Parslet::Atoms::Lookahead
- #try — Parslet::Atoms::Sequence
- #try — Parslet::Atoms::Alternative
- #try — Parslet::Atoms::Entity
- #try — Parslet::Atoms::Str
- #try_with_cache — Parslet::Atoms::Context
- #variable_name — Parslet::Pattern::SubtreeBind
- #visit_alternative — Parslet::Parser::Visitors::Treetop
- #visit_alternative — Parslet::Parser::Visitors::Citrus
- #visit_entity — Parslet::Parser::Visitors::Citrus
- #visit_lookahead — Parslet::Parser::Visitors::Citrus
- #visit_named — Parslet::Parser::Visitors::Citrus
- #visit_re — Parslet::Parser::Visitors::Citrus
- #visit_repetition — Parslet::Parser::Visitors::Citrus
- #visit_repetition — Parslet::Parser::Visitors::Treetop
- #visit_sequence — Parslet::Parser::Visitors::Citrus
- #visit_str — Parslet::Parser::Visitors::Citrus
- #warn_about_duplicate_keys — Parslet::Atoms::CanFlatten
- #| — Parslet::Atoms::Alternative
- #| — Parslet::Atoms::DSL

[Validate]

Generated with the Darkfish Rdoc Generator 2.