sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

Parslet::Parser.root

Define the parsers #root function. This is the place where you start 
parsing; if you have a rule for 'file' that describes what should be 
in a file, this would be your root declaration: 

  class Parser
    root :file
    rule(:file) { ... }
  end

#root declares a 'parse' function that works just like the parse 
function that you can call on a simple parslet, taking a string as input
and producing parse output. 

In a way, #root is a shorthand for: 

  def parse(str)
    your_parser_root.parse(str)
  end

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/parslet/lib/parslet/parser.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Parslet--Parser-root-for-pr


# Commit to git

git add app/server/ruby/vendor/parslet/lib/parslet/parser.rbgit commit -m "better docs for Parslet::Parser.root"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Parslet--Parser-root-for-pr

hub pull-request


# Celebrate!