[ragel-users] Re: [newbie] parsing CSS style

Christer Sandberg chr... at gmail.com
Thu Oct 18 18:06:06 UTC 2007


I haven't followed the discussion closely because I'm at work.
But to my knowledge (out of my head), properties in CSS dosen't have to
en in a ';' if it's the only one for the selector.

I've been/am constructing a CSS parser with ragel and it's almost CSS
2.1 grammar complete, except for the error handling. Which I have in
my workspace but not in the SVN repository.

You can have a look at http://code.google.com/p/ruby-cssparser
It's coded in C as a Ruby module.

Christer

On 10/18/07, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
> Sounds to me that Ragel is not the right tool for you. Ragel is designed
> for single-pass parsing where actions are executed as you move over the
> data. Perhaps a more traditional approach where you build the parse tree
> first, then walk it would be more appropriate in your case. Something
> like ANTLR or Lex+YACC might be better.
>
> Adrian
>
> Mat| wrote:
> > Hello,
> >
> > First of all thanks for the quick answer!!!
> >
> > On Oct 18, 4:13 pm, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
> >>> - I have got a problem (maybe more than one but I could only
> >>> detect one !) with my machines, indeed in my expressions I always
> >>> have a terminating ";" character but for some reason the style_item
> >>> action is executed even if there is no terminating ";". For example,
> >>> if I use "background: green" as an input string, the style_item is
> >>> going to be executed but it should not because there is no ";" at
> >>> the end.
> >> Do you mean style_item_value action? The style_item action will get
> >> executed when leaving the name portion, in this case on the colon.
> >>
> >
> > I am talking about the style_item action. I want it to be executed
> > only
> > when it's "complete", for me it means that everything has been
> > processed up to a ";". For the moment as your are pointing out it
> > is executed on the colon even if there is no ";" at the end (when
> > there
> > is no ";" the style machine should raise an error).
> >
> > How can I change the .rl file to obey to this behaviour ?
> > I am a bit lost.
> >
> > Cheers
> >
> >
> > > >
> >
>
>
>



More information about the ragel-users mailing list