|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fife.rsta.ac.common.CodeBlock
public class CodeBlock
A block of code. This can be used to implement very simple
parsing for languages that have some concept of code blocks, such as C,
Perl, Java, etc. Currently, using CodeBlocks provides a
means of remembering where variables are defined, as well as their scopes.
VariableDeclaration| Constructor Summary | |
|---|---|
CodeBlock(int start)
Constructor. |
|
| Method Summary | |
|---|---|
CodeBlock |
addChildCodeBlock(int start)
Creates and returns a child (nested) code block. |
void |
addVariable(VariableDeclaration varDec)
Adds a variable declaration. |
boolean |
contains(int offset)
Returns whether this code block contains a given offset. |
CodeBlock |
getChildCodeBlock(int index)
Returns a child code block. |
int |
getChildCodeBlockCount()
Returns the number of child code blocks. |
int |
getEndOffset()
Returns the end offset of this code block. |
CodeBlock |
getParent()
Returns the parent code block. |
int |
getStartOffset()
Returns the start offset of this code block. |
VariableDeclaration |
getVariableDeclaration(int index)
Returns a variable declaration. |
int |
getVariableDeclarationCount()
Returns the number of variable declarations in this code block. |
void |
setEndOffset(int end)
Sets the end offset of this code block. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CodeBlock(int start)
start - The starting offset of the code block.| Method Detail |
|---|
public CodeBlock addChildCodeBlock(int start)
start - The starting offset of the nested code block.
public void addVariable(VariableDeclaration varDec)
varDec - The variable declaration.public boolean contains(int offset)
offset - The offset.
public CodeBlock getChildCodeBlock(int index)
index - The index of the child code block.
getChildCodeBlockCount()public int getChildCodeBlockCount()
getChildCodeBlock(int)public int getEndOffset()
getStartOffset(),
setEndOffset(int)public CodeBlock getParent()
null if there isn't one.public int getStartOffset()
getEndOffset()public VariableDeclaration getVariableDeclaration(int index)
index - The index of the declaration.
getVariableDeclarationCount()public int getVariableDeclarationCount()
getVariableDeclaration(int)public void setEndOffset(int end)
end - The end offset.getEndOffset()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||