Thomas Dill wrote:

Hi there.

 

I still got the following Problem:

 

In the syntax, I want to parse, a comment line starts with “-*” and ends at the end of the line. It’s possible that an asterisk can appear in a “text”, too.

 

I can’t find a solution. Below there’s what I tried (and many other things)… Can somebody help me?

 

Example:

 

TABLE FILE CAR

PRINT * -* prtints all fields

BY MODEL

END

 

ANTLR Code:

 

grammar FexParser;

options {k=3; backtrack=true; memoize=true;}

 

report    :    (comment | text | NEWLINE)+ ;

 

comment   :    (COMMENT_START ~(NEWLINE))* ;

Here you are trying to use the parser to do the lexer's job. Move your comment in to the lexer and rather than have COMMENT_START, just have COMMENT (which you usually hide from the parser, though you don't have to).

Jim

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

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

Reply via email to