sonic-pi
https://github.com/sonic-pi-net/sonic-pi
C++
Code. Music. Live.
Parslet::Atoms::Base#parse_with_debug
Packages the common idiom
begin
tree = parser.parse('something')
rescue Parslet::ParseFailed => error
puts parser.cause.ascii_tree
end
into a convenient method.
Usage:
require 'parslet'
require 'parslet/convenience'
class FooParser < Parslet::Parser
rule(:foo) { str('foo') }
root(:foo)
end
FooParser.new.parse_with_debug('bar')Edit
git clone [email protected]:sonic-pi-net/sonic-pi.git
cd sonic-pi
open app/server/ruby/vendor/parslet/lib/parslet/convenience.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Parslet--Atoms--Base-parse_with_debug-for-pr
# Commit to gitgit add app/server/ruby/vendor/parslet/lib/parslet/convenience.rbgit commit -m "better docs for Parslet::Atoms::Base#parse_with_debug"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Parslet--Atoms--Base-parse_with_debug-for-pr
hub pull-request
# Celebrate!