company logo

OSI statement definition

Statements can be defined in ODL as well (e.g. defining the source for a transient member) . Mainly, however, statements are part of OSI scripts.

// The OSI Statement BNF provides entry points for syntactical expression units:

//    statement

//    syntax elements

//    block

//    ...

OSIStatement          := '$@'                    // defined for providing the bnf class name

if_block              := _if condition bstatement [ else_stmt ]  

else_stmt             := _else bstatement

while_block           := _while condition bstatement  

for_block             := _for for_condition bstatement  

for_condition         := '(' basic_stmt basic_stmt stmt_operlist ')'

case_block            := _switch condition  '{' [ case_stmt(*) ] [ other_stmt ] '}'

case_stmt             := [debug_opt] _case simple_op ':' [statement(*)]

other_stmt            := [debug_opt] _default ':' statement(*)

condition             := '(' doperand ')'                   // condition sollte operand_list sein, mehrere Werte zulassen

bstatement            := block | statement

statement             |= [debug_opt] istatement

istatement            := basic_stmt | if_block | case_block | while_block | for_block | syntax_op | ';'

basic_stmt            := stmt_operlist ';'

stmt_operlist         := doperand [stoplist_ext(*)]

stoplist_ext          := ',' doperand

doperand              := [debug_opt] operand

// common

debug_opt             := '#' [ auto_run ]

auto_run              := ':' identifier

syntax_op             := return_op | error_op | leave_op | continue_op | break_op | exception_op | nv_op | eh_op

return_op             := _return [operand] ';'

error_op              := _error  [operand] ';'

eh_op                 := _exceptions [err_handling] ';'

nv_op                 := _null_value [err_handling] ';'

err_handling          := _accept | _ignore | _exception

exception_op          := _exception [operand] ';'

leave_op              := _leave_ ';'

break_op              := _break ';'

continue_op           := _continue ';'

// block und expr_code müssen hier liegen, damit statement nicht zu früh kommt

block                 := '{' [ statement(*) ] '}'

//   standard key words

_exception            := 'exception'    | __exception

__exception           :: 'EXCEPTION'

// OQL keywords

_if                   :: 'if'         | 'IF'

_else                 :: 'else'       | 'ELSE'

_while                :: 'while'      | 'WHILE'

_for                  :: 'for'        | 'FOR'

_continue             :: 'continue'   | 'CONTINUE'

_leave_               :: 'leave'      | 'LEAVE'

_break                :: 'break'      | 'BREAK'

_error                :: 'error'      | 'ERROR'

_return               :: 'return'     | 'RETURN'

_null_value           :: '#NullValue' | '#NULLVALUE'

_exceptions           :: '#Exceptions'| '#EXCEPTIONS'

_ignore               := 'ignore'     | 'IGNORE'

_accept               := 'accept'     | 'ACCEPT'

// OQL specifications END

// comment line characters

CC                    := '//'

// bnf references

common_symbols       ::= class(OSICommon)

identifier           ::= ref(identifier)  

_switch              ::= ref(_switch)

_case                ::= ref(_case)

_default             ::= ref(_default)

oper_symbols         ::= class(OSIOperand)

operand              ::= ref(operand)

simple_op            ::= ref(simple_op)