[antlr-interest] Changing Symbol

Sarayooth Chittratanawat sarayooth at gmail.com
Tue Aug 9 05:34:00 PDT 2005


Sorry about my previous message that not clear :(

I want to build the CSV parser. The delimiter, text qualifier and row 
separator must be changable during runtime. Anyway, I was really new to 
Antlr. I am sure how can I do that.

class CSVLexer extends Lexer;
options { k = 1; charVocabulary = '\1'..'\377'; } 

WITHINQUOTE : ('"'(~'"')* '"')+ ;
WITHOUTQUOTE : ( ~( ',' | '\r' | '\n' | '"' ) ( ~( ',' | '\r' | '\n' ) )* );
EOL : ( '\n' | '\r' ) {newline();};
DELIM : ',' ; 

After I use antlr.Tool to generate the parser, how can I change the ',' to 
some thing else such as Tab delimit without to regenerate the parser by the 
antlr.Tool. 




On 8/9/05, Prashant Deva <prashant.deva at gmail.com> wrote:
> 
> Hi Sarayooth,
> 
> 
> On 8/8/05, Sarayooth Chittratanawat <sarayooth at gmail.com> wrote:
> > Hi,
> >
> > I want to generate the CSV parser. Anyway, my CSV parser requires to be
> > changed the delimit, quote, and row sperator.
> You are not quite clear. Please state again what exactly do u want to do?
> 
> PRASHANT
> 
> 
> >After I use the Antlr to
> > generate the code, I try to modify those charater with the parameter in 
> the
> > code. However, I saw the BitSet. How can I deal with that. Is there 
> anyway,
> > we do something like JLex that we used the skeleton for those parameter
> > (delimit, quote, row separator)
> >
> > Thanks
> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050809/c34d9032/attachment-0001.html


More information about the antlr-interest mailing list