Ruby Programming/Standard Library/Ripper< Ruby Programming
Ripper is a C-based Ruby parser available in MRI 1.9+
It parses ruby code into an AST, including comments. YARD for example, uses it, as does the assert2 gem.
Note that there are some other ruby parsers available (some written in ruby), for example the Redparse gem.