|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sc3d.apt.sss.v3.Indentation
public class Indentation
Represents an indentation analysis of a Sentence.
Field Summary | |
---|---|
int |
numLines
The number of lines in 'sentence' to which the indentation rules apply. |
Sentence |
sentence
The Sentence of which this is the indentation analysis. |
Constructor Summary | |
---|---|
Indentation(Lex lex)
Constructs an Indentation analysis of 'lex.sentence', and annotates 'lex.sentence' with error messages if the indentation rules are not obeyed. |
Method Summary | |
---|---|
void |
addIndentationError(java.lang.String message,
int line)
Attaches an error message to 'sentence' about the indentation at the beginning of line 'line'. |
int |
getLineDepth(int line)
Returns the nesting depth of a line. |
int |
getLineIndentation(int line)
Returns the indentation of a line. |
int |
getLineStart(int line)
Returns the index into 'sentence' of the first character of a line. |
static void |
main(java.lang.String[] args)
Takes one argument: a filename. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final Sentence sentence
public final int numLines
Constructor Detail |
---|
public Indentation(Lex lex)
Method Detail |
---|
public int getLineStart(int line)
line
- the line number. Lines are numbered from '0' to 'numLines-1'. This numbering differs from that used in error messages, which is chosen to match the behaviour of text editors.
public int getLineIndentation(int line)
line
- the line number. Lines are numbered from '0' to 'numLines-1'.
public int getLineDepth(int line)
This method actually uses a different definition which coincides with the proper one when the brackets match correctly. The depth of a line is the smallest depth of any of the characters on the line. The depth of a character is the number of open brackets, open square brackets and open braces before it minus the number of close brackets, close square brackets and close braces before it.
line
- the line number, from '0' to 'numLines-1'.
public void addIndentationError(java.lang.String message, int line)
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |