On Sun, 07 May 2006, Thomas Corbat defenestrated me:
>
> Thomas E Enebo wrote:
> >On Tue, 25 Apr 2006, Mirko Stocker defenestrated me:
> >>On Tuesday 25 April 2006 19:44, Thomas E Enebo wrote:
> >>
> >The biggest challenge is determining where in grammar we should accept
> >the token. It seems it is possible anywhere we can get a newlineNode.
> >Off the top of my head, I think primary may be the right place.
> >
> >We are busy trying to get Rails working by JavaOne, but if I get frustrated
> >and want to take a break I may add this. If you want to take a shot at
> >it then go for it. The previous steps outlines all tasks neccesary.
> >I can provide guidance if need be (and teach you how to build grammar
> >using Jay).
>
> I'm working together with Mirko on the ruby refactoring plugin for
> Eclipse. At the moment my part in this project is to introduce the
> comment nodes into jruby. I'm poring over this issue for several hours
> but I've not been able to succeed.
> I followed the steps above:
> 1. I managed to get the lexer to return a new token: tCOMMENT by
> changing the case '#' block that jumped the comments . The token
> contains the position and the content of the comment.
> [...]
> I'm not quite sure whether I understood the mode of operation of the
> lexer completely but I think this code should return the necessary
> information about the comment token.
Looks good so far
> 2. This is the point where I'm stuck. I extended the production rule for
> primary by adding the following line:
> | tCOMMENT { $$ = new CommentNode(getPosition($<ISourcePositionHolder>1)); }
> In the debugger I can see that the rule is applied but when the parser
> proceeds the errorFlag gets set with the result of a syntax error.
> Actually I'm a bit confused about this production rule thing as it's the
> first time I'm working with it.
This may be a weak reference, but jay does not have much written
about it. Basically it is a LALR grammar parser. It is largely a
port of Yacc/Bison to Java with some Java typing stuff added. Here
is something which introduces yacc (lex is a formalized lexer --
we do lexing by hand):
http://ds9a.nl/lex-yacc/cvs/lexyacc.txt
This should help give a better understanding of productions in
a grammar file. It is more than close enough to help give a
better understanding of grammar specifications. As you can see
Ruby's grammar is quite a bit more complex than a calculator
language :)
My only direct comment that may or may not be helpful is that
the '|' in a production is an 'OR' and the order of your alternate
production rule is important. So where you inject the
|tCOMMENT rule could be important.
-Tom
PS - I will try and help as best I can but I have a lot on my plate the
next two weeks.
--
+ http://www.tc.umn.edu/~enebo +---- mailto:[EMAIL PROTECTED] ----+
| Thomas E Enebo, Protagonist | "Luck favors the prepared |
| | mind." -Louis Pasteur |
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jruby-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jruby-devel