Comments production.

Power Java
Parsing With JavaCC
by Steve Kapp
Listing 2. Comments production.


01    MORE : {
02        "%" : IN_NORMAL_COMMENT
03      | "%%" : IN_DSC_COMMENT
04    }
05    <IN_NORMAL_COMMENT,IN_DSC_COMMENT>MORE : {
06        < ~["\r","\n"] >
07    }
08    <IN_NORMAL_COMMENT>SPECIAL_TOKEN : {
09        <NORMAL_COMMENT: "\n" | "\r" | "\r\n" >
10        { } : DEFAULT
11    }
12    <IN_DSC_COMMENT>SPECIAL_TOKEN : {
13        <DSC_COMMENT: "\n" | "\r" | "\r\n" >
14        { } : DEFAULT
15    }

About the Author

Steve Kapp is a client partner at EMRT in Rochester, NY. Steve can be contacted at [email protected].