Parslet 1.5.0

parslet is many peoples favorite parser construction toolkit. It uses a
grammar system called Parsing Expression Grammar (PEG)[1]. With parslet,
you can create neat parsers, from big to small. parslet has unit testing
support and spits out error messages for human beings.


gem install parslet


require ‘parslet’
class Mini < Parslet::Parser
rule(:integer) { match(‘[0-9]’).repeat(1) }
end“132432”) # => “132432”@0


Why the new release? So soon? Here’s why: parslet 1.5 features Ruby
HEREDOC support! Please look at the documentation or the ‘capture.rb’ in
the examples folder[2].

This also includes a few bugfixes, notably to EOF support - end of file
conditions are now normal error conditions that are handled by the same
code that handles other parse errors. As a consequence of this, you
might notice improved messages on premature EOF.

[1] Parsing expression grammar - Wikipedia