> Hello Eric,
> Have you considered using StringTokenizer instead of StreamTokenizer.
> It's constructor StringTokenizer(String str, String delim, boolean
> returnDelims) allows you to choose whether to return the delimiters as
> tokens or not. Just set the returnDelims flag to true.
>
> Regards,
> Perica
thanx for your suggestion
but, I want to parse the java program source code
the java code is so complex that I need powerful function to do this
job
1.I need more than one delimiter to get token once a time (e.g. '
','\t','\n')
2.comments in java code must ignore
3.white space char mention in 1. must ignore
4.some delimiter(';','{','}') must be reserve, and others must
discard(e.g. ' ','\t','\n')
StringTokenizer has not enough functionality for my requirement
StreamTokenizer is "almost" perfect, but can't return the delimiters
as tokens
any one can give more help?
Regards, Eric
|