[antlr-interest] Re: FEATURE REQUEST: std::stream -- remove

lgcraymer lgc at mail1.jpl.nasa.gov
Tue Feb 17 01:07:50 PST 2004


--- In antlr-interest at yahoogroups.com, Ruslan Zasukhin <sunshine at p...>
wrote:
> As far as I see, in the constructor of Lexer we must give stream.
> 
> I have code in our project
> 
> Importer_Text::Importer_Text(
>     I_Table_Ptr            inTable,
>     I_Location_Ptr         inLocation,
>     Const_I_PropertyContainer_Ptr inProperties )
> :    
>     mTable( inTable ),
>     
>     mStream( U2A( inLocation->get_Path() ).c_str() ),           <<<<<
>     mLexer( mStream )                                           <<<<<

ANTLR generates three different constructors:

Lexer(istream &)
Lexer(InputBuffer &)
and
Lexer(LexerSharedInputState)

The first is the one usually used, but neither of the other two
require an istream.  It is the only function in the generated .cpp
file to require an istream.

> But I will look more deeply on what you mean.
> May be I miss that point.
> 
> > Getting rid of std::string would be another matter--doable, but
> > probably not worth it.
> 
> Well, we use IBM ICU library, so we have unicode class String from ICU.
> And therefore we DO NOT use std::string anywhere in the project.
> Only place where we are FOCRED to do this -- ANTLR
> 
> Do you think it is good design of framework (I mean ANTLR)
> If I cannot tune it?  IMHO this means BAD OO design.

Take a closer look at the lib/cpp/antlr headers.  The C++ support
library could be modified to replace string with String without too
much effort.  Full unicode support is trickier--it might require
modification of the CppCodeGenerator--but not out of the question. 
It's just never quite made it to the top of Ric's "to do" list--his
support of ANTLR C++ is a public service provided as a side-effect of
his use of ANTLR in his research.

ANTLR's support libraries are replaceable/tunable--it just takes
effort.  ANTLR 2 is pretty messy internally, but the libraries (except
for Java) are cleanly abstracted from the code generator.

--Loring



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list