This content has been marked as final. Show 7 replies
If you look in the bug db most reports againstYup, I read a lot of the relevant articles in the bugbase; Sun didn't fix
StreamTokenizer have the evaluation:
"Due to compatibility restraints we will not further
evolve this legacy class."
anything anymore starting at +- 1998. I changed my code, I use a
Scanner now. Thank you for your reply.
I've come to dislike Scanners too. I want to scan several different types
of tokens; think of Java tokens. The following is a nice RE for a bunch
When I do this:
Pattern operators= Pattern.compile("==|!=|>=|<=");
This only works if the delimeter pattern 'eats' at least one character.
if (scanner.hasNext(operators)) return new Token(scanner.next(operators), OPERATOR); ...
It fails miserably when I set the delimeter pattern to "\\s*;
Sabre and uncle Alice owe me an explanation. duh.
Sorry Jos,Well, as long as you realize that it's all your fault you're excused ;-)
I don't do Scanner so you will have to wait until
uncle_alice comes on line.
Sabre (apprentice buck passer)
The question isn't that unreasonable though: I want to scan a stream
as if it were a bunch of, say, Java tokens; spaces aren't mandatory
in Java and that's the way I want it too. I have my home brew tokenizer
but I decided to give it a try, first using a StreamTokenizer (which won't
do it) but as of now: a Scanner doesn't do it either.
Unless uncle Alice comes up with a couple of KB regex of course ;-)