Hello all,
maybe someone can help me to get this done with ANTLR 3.2

My file has a header starting with 'test', some comments and then 
several blocks named 'Page 1',  'Page 2' etc. with integers, i.e.

test This is a comment and    
        we are not interested in.        
            Today is friday.

Page 1:
    123
    456
    789


I want to have a rule that consumes everything of the header until the 
word 'Page'.
'Page' should not be consumed by the header, it be consumed by another rule.

So I tried the following:

grammar TestNot;

options {
   language = Java;
}

rule :
   file;

file :
   header PAGE INT ':' INT+ EOF;

header :
   'test' ~PAGE;

PAGE :
   'Page';

INT :
   DIGIT+;

fragment
DIGIT :
   '0'..'9';


Any idea? Thanks in advance.


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 [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.


Reply via email to