LKLoop documentation

Authors

Generated by builder

Contents -

  1. Software documentation for the LKBreak class
  2. Software documentation for the LKContinue class
  3. Software documentation for the LKLoop class
  4. Software documentation for the LKLoopFlowControl class

Software documentation for the LKBreak class

LKBreak : LKLoopFlowControl

Declared in:
LKLoop.h

AST node representing early loop termination.

If a label is specified, the LKLoop with the same label is ended. Otherwise, breaks out of the closest surrounding loop.

Method summary

breakWithLabel: 

+ (id) breakWithLabel: (NSString*)aLabel;

Return a new break statement with the given label.


Software documentation for the LKContinue class

LKContinue : LKLoopFlowControl

Declared in:
LKLoop.h

AST node representing a skip to the next loop iteration.

If a label is specified, skips to the end of the LKLoop with the same label. Otherwise, does the same for the closest surrounding loop.

Method summary

continueWithLabel: 

+ (id) continueWithLabel: (NSString*)aLabel;

Return a new continue statement with the given label.


Software documentation for the LKLoop class

LKLoop : LKAST

Declared in:
LKLoop.h

AST node representing a loop construct.

The loop may have pre- and post-conditions that will terminate the loop when evaluated to false, or one might rely on LKReturn or LKBreak to end the loop.

It is possible to set a list of statements that will be executed after each iteration, typically to increment a counter or similar. Initialization may be done from a statement list in this node as well.

Each LKLoop may be labelled to make it possible to break or continue outer loops when there are nested flows of control.


Instance Variables

Method summary

loopWithStatements: 

+ (id) loopWithStatements: (NSMutableArray*)statementList;

Return a new loop with the specified statements.


initWithStatements: 

- (id) initWithStatements: (NSMutableArray*)statementList;

Initialise a new loop with the specified statements.


label 

- (NSString*) label;

Return the label used for break or continue in nested loops.


postCondition 

- (LKAST*) postCondition;

Return expression tested for truth after each loop iteration.


preCondition 

- (LKAST*) preCondition;

Return expression tested for truth before each loop iteration.


setLabel: 

- (void) setLabel: (NSString*)aLabel;

Set a label used for break or continue in nested loops.


setPostCondition: 

- (void) setPostCondition: (LKAST*)condition;

Set expression tested for truth after each loop iteration.


setPreCondition: 

- (void) setPreCondition: (LKAST*)condition;

Set expression tested for truth before each loop iteration.


setStatements: 

- (void) setStatements: (NSMutableArray*)anArray;

Set the statements for the loop body.


setUpdateStatements: 

- (void) setUpdateStatements: (NSMutableArray*)anArray;

Set the statements executed after each iteration of the loop.


statements 

- (NSMutableArray*) statements;

Return the list of statements in the loop body.


updateStatements 

- (NSMutableArray*) updateStatements;

Return the list of statements executed after each iteration of the loop.




Instance Variables for LKLoop Class

label

@protected NSString* label;

Label used for break or continue in nested loops.


loopInitStatements

@protected NSMutableArray* loopInitStatements;

List of statements to initialize the loop.


postCondition

@protected LKAST* postCondition;

Expression to be tested for truth after each loop iteration.


preCondition

@protected LKAST* preCondition;

Expression to be tested for truth before each loop iteration.


statements

@protected NSMutableArray* statements;

List of statements in the loop body.


updateStatements

@protected NSMutableArray* updateStatements;

List of statements executed after each iteration of the loop.





Software documentation for the LKLoopFlowControl class

LKLoopFlowControl : LKAST

Declared in:
LKLoop.h

Abstract superclass for LKBreak and LKContinue, implementing shared behavior.


Instance Variables

Method summary

flowControlFlavor 

- (NSString*) flowControlFlavor;

Return string "break" or "continue" depending on type of control statement.


initWithLabel: 

- (id) initWithLabel: (NSString*)aLabel;

Initialise a new break or continue statement with the given label.




Instance Variables for LKLoopFlowControl Class

label

@protected NSString* label;
Description forthcoming.