Package jflex.generator
Class Emitter
java.lang.Object
jflex.generator.Emitter
This class manages the actual code generation, putting the scanner together, filling in skeleton
sections etc.
Table compression, String packing etc. is also done here.
- Version:
- JFlex 1.9.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionmaps actions to their switch labelprivate boolean[]private int[]private final DFAprivate Stringprivate Stringprivate static final intprivate final Fileprivate boolean[]private static final intprivate intprivate final PrintWriter(package private) final Stringprivate final LexParseprivate boolean[]private int[]private final AbstractLexScanprivate final Skeletonprivate final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidemit()Main Emitter method.private voidprivate voidemitActionTable.private voidprivate voidprivate voidEmits two-level character translation tables.private voidprivate voidprivate voidprivate voidprivate voidemitConstructorDecl(boolean printCtorArgs) private voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidemitLexFunctHeader(String functionName) private voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidemitTokenSizeLimit(String limit) private voidprivate voidEmityychar,yycolumn,zzAtBOL,zzEOFDonewith warning suppression when needed.private static StringEscapes all " ' \ tabs and newlinesprivate void(package private) static StringgetBaseName(String className) Computes base name of the class name.private booleanprivate voidmapColMap(int[] blocks) Performs an in-place update to map the colMap translation over the char classes in the second-level cmap table.static FileConstructs a file in Options.getDir() or in the same directory as another file.private voidprint(int i) private voidprint(int i, int tab) private voidprivate voidprintln()private voidprintln(int i) private voidprivate voidprivate voidprivate voidSet up EOF code section according to scanner.eofcodestatic StringsourceFileString(File file)
-
Field Details
-
FINAL
private static final int FINAL- See Also:
-
NOLOOK
private static final int NOLOOK- See Also:
-
inputFile
-
outputFileName
-
out
-
skel
-
scanner
-
parser
-
dfa
-
isTransition
private boolean[] isTransition -
rowMap
private int[] rowMap -
rowKilled
private boolean[] rowKilled -
numCols
private int numCols -
colMap
private int[] colMap -
colKilled
private boolean[] colKilled -
actionTable
maps actions to their switch label -
visibility
-
eofCode
-
eofThrow
-
-
Constructor Details
-
Method Details
-
getBaseName
Computes base name of the class name. Needs to take into account generics.- Parameters:
className- Class name for which to construct the base name
-
normalize
Constructs a file in Options.getDir() or in the same directory as another file. Makes a backup if the file already exists.- Parameters:
name- the name (without path) of the fileinput- fall back location ifpath = null(expected to be a file in the directory to write to)- Returns:
- The constructed File
-
println
private void println() -
println
-
println
private void println(int i) -
print
-
print
private void print(int i) -
print
private void print(int i, int tab) -
hasGenLookAhead
private boolean hasGenLookAhead() -
emitLookBuffer
private void emitLookBuffer() -
emitScanError
private void emitScanError() -
emitMain
-
emitNoMatch
private void emitNoMatch() -
emitNextInput
private void emitNextInput() -
sourceFileString
-
emitHeader
private void emitHeader() -
emitUserCode
private void emitUserCode() -
emitClassName
private void emitClassName() -
emitLexicalStates
private void emitLexicalStates() -
emitDynamicInit
private void emitDynamicInit() -
emitCharMapArrayUnPacked
private void emitCharMapArrayUnPacked() -
mapColMap
private void mapColMap(int[] blocks) Performs an in-place update to map the colMap translation over the char classes in the second-level cmap table. -
emitCharMapTables
private void emitCharMapTables()Emits two-level character translation tables. The translation is from raw input codepoint to the column in the generated DFA table.For maxCharCode invalid input: '<' 256, a single-level unpacked array is used instead.
-
emitRowMapArray
private void emitRowMapArray() -
emitAttributes
private void emitAttributes() -
emitClassCode
private void emitClassCode() -
emitConstructorDecl
private void emitConstructorDecl() -
emitConstructorDecl
private void emitConstructorDecl(boolean printCtorArgs) -
emitCtorArgs
private void emitCtorArgs() -
emitDoEOF
private void emitDoEOF() -
emitLexFunctHeader
-
emitCMapAccess
private void emitCMapAccess() -
emitGetRowMapNext
private void emitGetRowMapNext() -
escapify
Escapes all " ' \ tabs and newlines- Parameters:
s- The string to escape- Returns:
- The escaped string
-
emitActionTable
private void emitActionTable()emitActionTable. -
emitTokenSizeLimit
-
emitActions
private void emitActions() -
emitEOFVal
private void emitEOFVal() -
findActionStates
private void findActionStates() -
reduceColumns
private void reduceColumns() -
reduceRows
private void reduceRows() -
setupEOFCode
private void setupEOFCode()Set up EOF code section according to scanner.eofcode -
emitVarDefs
private void emitVarDefs()Emityychar,yycolumn,zzAtBOL,zzEOFDonewith warning suppression when needed. -
emit
public void emit()Main Emitter method.
-