Preprocess at least one character of the input.
Preprocessor must always preprocess at least one input character
per invocation but only a minimum necessary number of characters
should be preprocessed by each invocation of this method.
Example:
public void preprocessChar() {
switch (ch = inputRead()) {
case '\\': // possible start of sequence
switch (ch = inputRead()) {
case 'u': // start of escape sequence
... // read the whole sequence
outputPreprocessed(prepCh, extraInputLength);
break;
default:
outputOriginal('\\');
outputOriginal(ch);
break;
}
break;
default:
outputOriginal(ch);
}
}
The processor is only designed to do several-chars-to-one translation.
It is not designed to return more than one character for a single input char.
Also if the character is really preprocessed it must be composed
from at least two input characters (see extraInputLength parameter
of
CharPreprocessor.outputPreprocessed(char,int) .
The preprocessor must be able to process all the characters
given to it on input.
However it should not preprocess EOF in any way
- the EOF is just information that there is an end of the input
and any possibly unfinished escape sequence needs to be translated
in a reasonable way.
Once all the characters prior EOF were preprocessed the EOF
should be returned by
CharPreprocessor.outputOriginal(int) .
|