tigerlily/solid — pull request #5 by byroot (2013-09-14 19:59:50+00:00)
Title: Add support for parsing using ruby_parser

Now multiple parser implementations are supported. The builtin implementations are `Solid::Parser::Ripper` and `Solid::Parser::RubyParser`, the default being `Solid::Parser::RubyParser`, but you can chose the implementation you want with `Solid::Parser.parser = Solid::Parser::Ripper`.

And anybody can implement his own, or subclass an existing one to limit the allowed constructs / syntaxes.

Both parsers are now tested by the same shared examples to assert some kind of compatibility.

Relying on `ruby_parser` instead of `ripper` should allow to target jRuby and Rubinius.
For now the security model do not work on Rubinius, it seems that some methods are not owned by the same classes.
And jRuby seems to have some troubles with syntaxes like `map(&method(:foo))` ...

It's also better than relying on an undocumented internal API.

Regards,

@etiennebarrie: I think `Solid::Parser::RubyParser` has the same amount of support than `Solid::Parser::Ripper`, at least all specs pass, but it would be great if you could test it on real world templates.