[antlr-interest] options greedy : getting the tokens consumed during the greedy match

Vijay Raj call.vijayraj at yahoo.com
Mon May 30 11:08:38 PDT 2011

Hi -
   I am trying to parse a given java file, with a code fragment that consumes comments as below: ( Code fragment got from Java.g , pasted in the antlr site, to give credit where it is due). 

            boolean isJavaDoc = false;
            System.out.println("Entering comment");
    :   '/*'
                if((char)input.LA(1) == '*'){
                    isJavaDoc = true;
        (options {greedy=false;} : . )* 

I am trying to get all the characters mapped by the wildcard regex , as in 'options greedy' line in the grammar file and get the string into the Java world for further processing.   What hidden system variables/ grammar should I use to take care of the same ? 

More information about the antlr-interest mailing list