Looks like you need:

group           :       (OPEN
                                space*
                                (
                                sg=group space* |
                                p=plaintext space* |
                                ((c1=command)+ space) |
                                (e=escape) space*
                                )+
                                ((c2=command)+)?
                        CLOSE) -> ^(GROUP ^(GROUP $sg)* $p+ $c1+ $e+ $c2+)

At a rough guess.


Jim


> -----Original Message-----
> From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
> boun...@antlr.org] On Behalf Of Yves Weißig
> Sent: Tuesday, October 18, 2011 12:11 AM
> To: antlr-interest@antlr.org
> Subject: [antlr-interest] Beginner needing help with rewrite rules
>
> Hi ANTLR list,
> I'm using ANTLR within my master's thesis in order to parse the RTF
> file format. Everything is fine so far, I can parse simple RTF
> documents. The next step is to generate an AST. Here is where the
> problems start, it seems as if I have an error in one of my rewrite-
> rules. If you look at the grammar, what I want to do, is nest the
> groups. This means, a "group" is child of a "group" if the subrule
> group in the rule group is
> called: sg=group space* -> ^(GROUP $sg+). Maybe you try the grammar
> using a simple RTF snippet, e.g.
>   {\pard\fs32\b NOTES\par}
>   {\pard\fs26 Recently I skimmed {\i Structure and Interpretation of
>    Computer Programs}, by Sussman and Abelson, and I think there should
>    have been more pictures.
>   \line I like pictures.  Is that so na\'efve?
>   \par}
> from: http://search.cpan.org/~sburke/RTF-Writer/lib/RTF/Cookbook.pod
> Do you have any comments or ideas what I'm doing wrong?
> Best regards, Yves

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to