Package jflex.generator
Class PackEmitter
- java.lang.Object
-
- jflex.generator.PackEmitter
-
- Direct Known Subclasses:
CountEmitter
,HiLowEmitter
public abstract class PackEmitter extends Object
Encodesint
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.8.1
- Author:
- Gerwin Klein
-
-
Field Summary
Fields Modifier and Type Field Description protected int
chunks
number of existing string chunksprotected String
name
name of the generated array (mixed case, no yy prefix)protected StringBuilder
out
output buffer
-
Constructor Summary
Constructors Constructor Description PackEmitter(String name)
Create new emitter for an array.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
breaks()
Execute line/chunk break if necessary.protected String
constName()
Convert array name into all uppercase internal scanner constant name.void
emitInit()
Emit declaration of decoded member and open first chunk.void
emitUC(int i)
Emit single unicode character.abstract void
emitUnpack()
Emit the unpacking code.protected void
nl()
emit newlineprotected void
println(String s)
println.String
toString()
Return current output buffer.
-
-
-
Field Detail
-
name
protected String name
name of the generated array (mixed case, no yy prefix)
-
out
protected StringBuilder out
output buffer
-
chunks
protected int chunks
number of existing string chunks
-
-
Constructor Detail
-
PackEmitter
public PackEmitter(String name)
Create new emitter for an array.- Parameters:
name
- the name of the generated array
-
-
Method Detail
-
constName
protected String constName()
Convert array name into all uppercase internal scanner constant name.- Returns:
name
as a internal constant name.- See Also:
name
-
toString
public String toString()
Return current output buffer.
-
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
-
-