KoheAsano / franca

Automatically exported from code.google.com/p/franca
0 stars 0 forks source link

Method parameter named "error" not accepted as in-parameter #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
when specifying the Genivi audiomanager D-Bus interfaces using Franca 0.83, 
Eclipse showed syntax errors within the Franca editor:

The Franca language specs does not accept “error” as parameter name of a 
method´s in parameter in an interface.
See attached example idl.
This is bad because there might be existing interfaces that use “error” as 
parameter name. 
Generally the name of a parameter should be freely selectable.

Original issue reported on code.google.com by manfred....@bmw.de on 21 Jan 2013 at 11:51

Attachments:

GoogleCodeExporter commented 9 years ago
This is a common problem with ANTLR-based DSLs (and Xtext is based on ANTLR). 
The lexer will identify "error" as keyword, the parser of Franca expects an ID, 
not a keyword. This may occur with any ID (e.g., method name, struct element, 
etc.) and any keyword. 

Fortunately, there is a simple solution: If the clash occurs, the identifier 
has to be escaped by a ^ sign, this tells the lexer that this is no keyword, 
but an ID. Excerpt from your example:

        in 
        {
            am.am_Handle_s handle
            am.am_connectionID_t connectionID
            am.am_Error_e ^error        
        }

Original comment by klaus.birken@gmail.com on 21 Jan 2013 at 12:27