All Packages Class Hierarchy This Package Previous Next Index
Class parse.Unparser
java.lang.Object
|
+----parse.Unparser
- public class Unparser
- extends Object
Allows Parsable objects to output a description of themselves in
a format such that the Parser can later read them in and recreate
them. Every parsable object has an unparse() method.
This code is (c) 1996 Leemon Baird
<leemon@cs.cmu.edu>,
http://www.cs.cmu.edu/~baird
The source and object code may be redistributed freely.
If the code is modified, please state so in the comments.
- Version:
- 1.0, 10 March 96
- Author:
- Leemon Baird
- See Also:
- Parser
-
currCol
-
-
currIndent
-
-
indent
-
-
labels
-
-
labelUnparsed
-
-
maxIndent
-
-
maxLen
-
-
out
-
-
Unparser(PrintStream, int, int, int, Hashtable)
- Unparse with each indent being ind spaces, up to a maximum of max spaces.
-
close()
- Close the output file.
-
emit(boolean)
- Output "true" or "false".
-
emit(char)
- Output x.
-
emit(double)
- Output x.
-
emit(float)
- Output x.
-
emit(int)
- Output x.
-
emit(long)
- Output x.
-
emit(Object)
- Output a string representing this object.
-
emit(String)
- Output the string to whatever output is being unparsed to
-
emitLine()
- End the current line and indent the next line appropriately.
-
emitLine(boolean)
- Output x and start a new line.
-
emitLine(char)
- Output x and start a new line.
-
emitLine(double)
- Output x and start a new line.
-
emitLine(float)
- Output x and start a new line.
-
emitLine(int)
- Output x and start a new line.
-
emitLine(long)
- Output x and start a new line.
-
emitLine(Object)
- Output x and start a new line.
-
emitLine(String)
- Output x and start a new line.
-
emitUnparse(Parsable, int)
- unparse a class by calling its unparse method.
-
emitUnparseWithClassName(Parsable, int, boolean)
- Output the class name of the object, then unparse it.
-
indent()
- Cause all following emitLine() calls to indent the following line more.
-
indent(int)
- Indent all future lines, and also emit n less than a normal indent right now.
-
unindent()
- Cause all following emitLine() calls to indent the following line less.
indent
protected int indent
currIndent
protected int currIndent
maxIndent
protected int maxIndent
maxLen
protected int maxLen
out
protected PrintStream out
currCol
protected int currCol
labels
protected Hashtable labels
labelUnparsed
protected Hashtable labelUnparsed
Unparser
public Unparser(PrintStream s,
int ind,
int max,
int len,
Hashtable defUseLabels)
- Unparse with each indent being ind spaces, up to a maximum of max spaces.
If max=-1, then there is no limit on how far it can indent.
Lines wrap after len columns. If len=-1, then lines do not automatically
wrap. defUseLabels is the hash table created by the parser that tells
about when #DEF and #USE were used.
emit
public void emit(String x)
- Output the string to whatever output is being unparsed to
emitLine
public void emitLine()
- End the current line and indent the next line appropriately.
close
public void close()
- Close the output file.
indent
public void indent(int n)
- Indent all future lines, and also emit n less than a normal indent right now.
indent
public void indent()
- Cause all following emitLine() calls to indent the following line more.
unindent
public void unindent()
- Cause all following emitLine() calls to indent the following line less.
emit
public void emit(int x)
- Output x.
emit
public void emit(long x)
- Output x.
emit
public void emit(float x)
- Output x.
emit
public void emit(double x)
- Output x.
emit
public void emit(char x)
- Output x.
emit
public void emit(boolean x)
- Output "true" or "false".
emit
public void emit(Object x)
- Output a string representing this object.
emitLine
public void emitLine(int x)
- Output x and start a new line.
emitLine
public void emitLine(long x)
- Output x and start a new line.
emitLine
public void emitLine(float x)
- Output x and start a new line.
emitLine
public void emitLine(double x)
- Output x and start a new line.
emitLine
public void emitLine(char x)
- Output x and start a new line.
emitLine
public void emitLine(boolean x)
- Output x and start a new line.
emitLine
public void emitLine(String x)
- Output x and start a new line.
emitLine
public void emitLine(Object x)
- Output x and start a new line.
emitUnparseWithClassName
public void emitUnparseWithClassName(Parsable obj,
int lang,
boolean showPackage)
- Output the class name of the object, then unparse it.
If not showPackage, then don't output the package name prefix.
emitUnparse
public void emitUnparse(Parsable obj,
int lang)
- unparse a class by calling its unparse method. If the class was
within a #DEF or #USE statement, emit that too.
All Packages Class Hierarchy This Package Previous Next Index