José Romildo Malaquias wrote:
> On Mon, Apr 19, 2010 at 12:25:08PM -0400, Steve Rowe wrote:
> [...]
>> > 3. Can a JFlex comment appear anywhere a space is allowed?
>>
>> Not everywhere; for your specific questions, though:
>>
>> > For instance, are the following allowed?
>> >
>> > %% // end of section 1
>> >
>> > %{ // the following will be inserted into the generated class
>>
>> Yes, both of the above are allowed. After '%%' and '%{' all text is
>> ignored until end of line - no comment syntax is required. So these are
>> allowed too:
>>
>> %% end of section 1
>>
>> %{ the following will be inserted into the generated class
>
> I suppose this applies to every option of the form
>
> %[a-z]{
> %[a-z]}
>
> like %eofval{ and %eofval}. Right?
Yes.
Starting at line 274 of LexScan.flex:
<MACROS>
("%{"|"%init{"|"%initthrow{"|"%eof{"|"%eofthrow{"|"%yylexthrow{"|"%eofval{").*{NL}
{ string.setLength(0); yybegin(COPY); }
<COPY> {
"%}".*{NL} { classCode = conc(classCode,string); yybegin(MACROS); }
"%init}".*{NL} { initCode = conc(initCode,string); yybegin(MACROS); }
"%initthrow}".*{NL} { initThrow = concExc(initThrow,string);
yybegin(MACROS); }
"%eof}".*{NL} { eofCode = conc(eofCode,string); yybegin(MACROS); }
"%eofthrow}".*{NL} { eofThrow = concExc(eofThrow,string);
yybegin(MACROS); }
"%yylexthrow}".*{NL} { lexThrow = concExc(lexThrow,string);
yybegin(MACROS); }
"%eofval}".*{NL} { eofVal = string.toString(); yybegin(MACROS); }
.*{NL} { string.append(yytext()); }
Steve
|