From: Florian Gross Date: 2005-03-25T05:44:48+09:00 Subject: Re: [ANN] Syntax 0.7.0 Sam Roberts wrote: >>Ripper basically is Ruby's integrated Ruby parser. It will invoke >>callbacks for every kind of construct it encounters. > > Hm, look like it returns whitespace, and other non-syntactic elements. > Good. Does it return end-of-line, and is it just a lexer, or is it a > parser, too? > > I.e., does > > MyParser.new.parse("class Foo; Bar = 4; end;") > > tell me that the Foo is a class name, and Bar is a constant name, or do > I have to deduce that? > > If so, maybe i'll try. The above produces quite a few events. Here's a few which seem to be relevant to you: on__ASSIGN: ["="] on__assignable: [:Bar, nil] [...] on__assign: [nil, 4] [...] on__class: [:Foo, nil, nil] on__set_line: [nil, 1] It's probably best to try this out on your own. > The rubyforge page makes it look as if it may be written in C based on > ruby's parser, using lex&yacc. If so, that would be sweet, because it > might be fast. I still think that it is build directly into Ruby and that it also comes with it. It reuses the same parser as Ruby and thus ought to be very fast.