Package jflex
Class Skeleton
- java.lang.Object
-
- jflex.Skeleton
-
public class Skeleton extends java.lang.Object
This class stores the skeleton of generated scanners.The skeleton consists of several parts that can be emitted to a file. Usually there is a portion of generated code (produced in class Emitter) between every two parts of skeleton code.
There is a static part (the skeleton code) and state based iterator part to this class. The iterator part is used to emit consecutive skeleton sections to some
PrintWriter
.- Version:
- JFlex 1.7.0
- See Also:
Emitter
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
DEFAULT_LOC
location of default skeletonstatic java.lang.String[]
line
The skeletonprivate static java.lang.String
NL
platform specific newlineprivate java.io.PrintWriter
out
The writer to write the skeleton-parts toprivate int
pos
The current part of the skeleton (an index of nextStop[])private static int
size
expected number of sections in the skeleton file
-
Constructor Summary
Constructors Constructor Description Skeleton(java.io.PrintWriter out)
Creates a new skeleton (iterator) instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
emitNext()
Emits the next part of the skeletonstatic void
makePrivate()
Make the skeleton private.static void
readDefault()
(Re)load the default skeleton.static void
readSkel(java.io.BufferedReader reader)
Reads an external skeleton file from a BufferedReader.static void
readSkelFile(java.io.File skeletonFile)
Reads an external skeleton file for later use with this class.static java.lang.String
replace(java.lang.String a, java.lang.String b, java.lang.String c)
Replaces a with b in c.
-
-
-
Field Detail
-
DEFAULT_LOC
private static final java.lang.String DEFAULT_LOC
location of default skeleton- See Also:
- Constant Field Values
-
size
private static final int size
expected number of sections in the skeleton file- See Also:
- Constant Field Values
-
NL
private static final java.lang.String NL
platform specific newline
-
line
public static java.lang.String[] line
The skeleton
-
pos
private int pos
The current part of the skeleton (an index of nextStop[])
-
out
private java.io.PrintWriter out
The writer to write the skeleton-parts to
-
-
Method Detail
-
emitNext
public void emitNext()
Emits the next part of the skeleton
-
makePrivate
public static void makePrivate()
Make the skeleton private.Replaces all occurrences of " public " in the skeleton with " private ".
-
readSkelFile
public static void readSkelFile(java.io.File skeletonFile)
Reads an external skeleton file for later use with this class.- Parameters:
skeletonFile
- the file to read (must be != null and readable)
-
readSkel
public static void readSkel(java.io.BufferedReader reader) throws java.io.IOException
Reads an external skeleton file from a BufferedReader.- Parameters:
reader
- the reader to read from (must be != null)- Throws:
java.io.IOException
- if an IO error occursGeneratorException
- if the number of skeleton sections does not match
-
replace
public static java.lang.String replace(java.lang.String a, java.lang.String b, java.lang.String c)
Replaces a with b in c.- Parameters:
a
- the String to be replacedb
- the replacementc
- the String in which to replace a by b- Returns:
- a String object with a replaced by b in c
-
readDefault
public static void readDefault()
(Re)load the default skeleton. Looks in the current system class path.
-
-