[antlr-interest] Re: Request enhancement ANTLR
    Ric Klaren 
    klaren at cs.utwente.nl
       
    Mon Sep 16 01:54:58 PDT 2002
    
    
  
Hi,
On Sat, Sep 14, 2002 at 09:20:57PM -0700, Terence Parr wrote:
> I've added getFilename/setFilename methods (empty impl) to Token.java, 
> but I'm not sure about adding the ctor to NoViableAltException and the 
> code generator.  Seems that now you'll get the filename but unless I 
> add real functionality to Token it will have a bogus default filename.  
> Hmm...plus, what about other exceptions?  Seems I'd have to make wide 
> changes.  I'll add the basic interface for now and see what happens I 
> guess.
Maybe in the long run we should remove the column/line/filename stuff and
replace it by a user definable class, with according set/get methods. This
would add most flexibility in possiblities to store stuff with the token.
Something like this:
public NoViableAltException( Token t, Parser p ) {
   super("NoViableAlt", p.getFilename(), p.getLine(), p.getColumn());
   token = t;
}
Then if we add options to specify the name of the used NoViableException or
a factory or something like it, then we have all the tools to customize
easily at will.
If I ever get time for a C++ backend TNG then I'll probably go that way,
for a first prototype.
Cheers,
Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
     Innovation makes enemies of all those who prospered under the old
   regime, and only lukewarm support is forthcoming from those who would
               prosper under the new. --- Niccolò Machiavelli
 
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
    
    
More information about the antlr-interest
mailing list