(feature request) need a better separation of prototype and implementation sections in {...} sections
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Stephen_Silber
Posted On:   Sunday, July 22, 2001 02:36 AM

Hi everybody, As I've been cruising through an ANTLR project (in C++, no less--thanks Peter and Ric!), it occurs to me that the anonymous {...} section of an ANTLR class definition, used to put arbitrary members into said class, really needs to be flexible enough to handle languages where the prototype and implementation of a method or function might be found in two separate files. The current code generator works fine, of course, but I am uncomfortable with the fact that any C++ methods I put in there are automatically going to be marked for inlining. I'd love to hear what anyone else thinks about this. Thanks, JSRS    More>>

Hi everybody,



As I've been cruising through an ANTLR project (in C++, no less--thanks Peter and Ric!), it occurs to me that the anonymous {...} section of an ANTLR class definition, used to put arbitrary members into said class, really needs to be flexible enough to handle languages where the prototype and implementation of a method or function might be found in two separate files.



The current code generator works fine, of course, but I am uncomfortable with the fact that any C++ methods I put in there are automatically going to be marked for inlining.



I'd love to hear what anyone else thinks about this.



Thanks,

JSRS

   <<Less

Re: (feature request) need a better separation of prototype and implementation sections in {...} sections

Posted By:   Ric_Klaren  
Posted On:   Wednesday, August 1, 2001 12:42 AM

For the sake of completeness a bit of copy paste
from the mailinglist.


Here's a template for C++ input files.
You can reach the requested effect with the [pre|post]_include_[ch]pp header sections.

In short:


{ // this gets inserted in the generated cpp file
void MyParser::some_custom_method()
{
...
}

}

class MyParser extends Parser
options { .. }
tokens { .. }
{ // stuff for the class definition
void some_custom_method();
}

About | Sitemap | Contact