Class PackEmitter
java.lang.Object
jflex.generator.PackEmitter
- Direct Known Subclasses:
CountEmitter, HiLowEmitter
Encodes
int arrays as strings.
Also splits up strings when longer than 64K in UTF8 encoding. Subclasses emit unpacking code.
Usage protocol: p.emitInit();
for each data: p.emitData(data);
p.emitUnpack();
- Version:
- JFlex 1.9.1
- Author:
- Gerwin Klein
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intnumber of existing string chunksprotected Stringname of the generated array (mixed case, no yy prefix)protected StringBuilderoutput buffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbreaks()Execute line/chunk break if necessary.protected StringConvert array name into all uppercase internal scanner constant name.voidemitInit()Emit declaration of decoded member and open first chunk.voidemitUC(int i) Emit single unicode character.abstract voidEmit the unpacking code.protected voidnl()emit newlineprotected voidprintln.toString()Return current output buffer.
-
Field Details
-
name
name of the generated array (mixed case, no yy prefix) -
out
output buffer -
chunks
protected int chunksnumber of existing string chunks
-
-
Constructor Details
-
PackEmitter
Create new emitter for an array.- Parameters:
name- the name of the generated array
-
-
Method Details
-
constName
Convert array name into all uppercase internal scanner constant name.- Returns:
nameas a internal constant name.- See Also:
-
toString
-
emitInit
public void emitInit()Emit declaration of decoded member and open first chunk. -
emitUC
public void emitUC(int i) Emit single unicode character.Updates length, position, etc.
- Parameters:
i- the character to emit.
-
breaks
public void breaks()Execute line/chunk break if necessary. Leave space for at least two chars. -
emitUnpack
public abstract void emitUnpack()Emit the unpacking code. -
nl
protected void nl()emit newline -
println
-