[antlr-interest] Labels Expanded w/in Action Comments

Raphael Reitzig r_reitzi at cs.uni-kl.de
Wed Aug 13 16:10:11 PDT 2008


Hi!

I guess all you need to prevent that kind of thing is some static  
information about target language, right?

I specify my target language in gramar header. I ANTLR would have a  
file per target installed to look up some stuff (like line comment  
indicator, of course) once per code generation, it could sort this out  
at runtime. Would be a generic solution, also, for target developers  
could update the information file as they like, ANTLR would look it up.

I don't know how target developing goes. Perhaps each target could  
take care of this on its own entirely.

Regards

Raphael

"Johannes Luber" <jaluber at gmx.de> wrote (Wed Aug 13 12:14:13 2008):

> Foust schrieb:
>> $references are being expanded within action code comments.
>>
>> Did this issue get added to the bug database?
>>
>> I received some responses that this is the intended behavior, but surely you
>> don't expect people to delete their action code when debugging, rather than
>> just commenting it out?
>>
>> The issue here is the line comment (//), since some attribute references
>> (like 'text') are expanded to several lines, making the resultant code not
>> compilable.
>>
>> I'm sure that there are several possible solutions, but one would be to
>> directly support the C/C++/Java line comment in Antlr, unless turned off by
>> an option. Another solution would be to allow language specific definition
>> of line and block comments. Good editors do this.
>>
>> Brent
>
> Well, it is possible to fix this behaviour, but ANTLR has to be  
> bootstrapped first. Currently the tool is maintained in a ANTLR 2  
> grammar, which has some limitations. Only if we have an ANTLR in an  
> ANTLR 3 grammar, we can use grammar inheritance to adapt the target  
> code recognition to recognize the comments correctly. I don't know  
> when Ter will finish this task, but he said it was too much work to  
> include it in 3.1. Maybe he finishes it for 3.2?
>
> Johannes
>
> P.S.: Please don't use another email to create a reply email and  
> change the subject line to something different. There are people who  
> use mailing list threading to order related emails in handy trees  
> and not creating a an entirely new email for new subjects screws  
> that up. Any good email client should allow to create a new email  
> from any email address - Thunderbird can do this over a context menu.
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: PGP Digital Signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080814/37339160/attachment.bin 


More information about the antlr-interest mailing list