Documentation

LKLoop documentation

LKLoop : LKAST

AuthorsGenerated by builder
Declared inLKLoop.h

Overview

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.


Default

+ (id) loopWithStatements: (NSMutableArray *)statementList

Return a new loop with the specified statements.

    - (id) initWithStatements: (NSMutableArray *)statementList

    Initialise a new loop with the specified statements.

      - (void) setLabel: (NSString *)aLabel

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

        - (NSString *) label

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

          - (void) setStatements: (NSMutableArray *)anArray

          Set the statements for the loop body.

            - (NSMutableArray *) statements

            Return the list of statements in the loop body.

              - (void) setUpdateStatements: (NSMutableArray *)anArray

              Set the statements executed after each iteration of the loop.

                - (NSMutableArray *) updateStatements

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

                  - (void) setPreCondition: (LKAST *)condition

                  Set expression tested for truth before each loop iteration.

                    - (LKAST *) preCondition

                    Return expression tested for truth before each loop iteration.

                      - (void) setPostCondition: (LKAST *)condition

                      Set expression tested for truth after each loop iteration.

                        - (LKAST *) postCondition

                        Return expression tested for truth after each loop iteration.