|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.Emit
public abstract class Emit
An abstract class for emitting code sequences.
$Id: Emit.java,v 1.17 2005-02-07 21:28:20 burrill Exp $
Copyright 2005 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
The interface supports indentation.
Field Summary | |
---|---|
protected int |
currentColumn
The current output column. |
protected int |
currentLine
The current line number in the generated output. |
protected boolean |
lineStart
true if we are at the start of a line in the generated output. |
protected int |
numIndent
Number of indentation levels - used to record the amount of identatation. |
protected int |
spaces
The amount of indentation spaces per indentation level. |
Constructor Summary | |
---|---|
Emit(int indent)
Create a class to use in writing out generated code. |
|
Emit(int currentLine,
int currentColumn,
int indent)
Create a class to use in writing out generated code. |
Method Summary | |
---|---|
void |
decIndLevel()
Decrease the amount of space for indentation |
abstract void |
emit(char c)
Print a character to the output. |
abstract void |
emit(int n)
Print an integer to the output. |
abstract void |
emit(long n)
Print a long to the output. |
abstract void |
emit(java.lang.String s)
Print a string to the output. |
void |
endLine()
Signal the end of the current line and start a new one. |
int |
getCurrentColumn()
Return the current output column. |
int |
getCurrentLine()
Return the current line number of the line being generated. |
void |
incIndLevel()
Increment the number of spaces to indent |
protected void |
indent()
Add indentation to output |
protected void |
newLine()
Specify that a new line has been started. |
void |
setIndentation(int n)
Set the amount of indentation space for each level. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean lineStart
true
if we are at the start of a line in the generated output.
protected int currentLine
protected int numIndent
protected int spaces
protected int currentColumn
Constructor Detail |
---|
public Emit(int indent)
indent
- is the number of spaces to indentpublic Emit(int currentLine, int currentColumn, int indent)
currentLine
- is the current output line numbercurrentColumn
- is the current output column numberindent
- is the number of spaces to indentMethod Detail |
---|
public abstract void emit(java.lang.String s)
public abstract void emit(int n)
public abstract void emit(long n)
public abstract void emit(char c)
public void endLine()
protected void indent()
protected void newLine()
public void incIndLevel()
public void decIndLevel()
public void setIndentation(int n)
public int getCurrentLine()
public int getCurrentColumn()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |