[NAME]
ALL.dao.grammar.routine

[TITLE]
Routines (Functions)

[DESCRIPTION]


     
   1  ParamItem1 ::= Identifier [ ':' Type ]
   2  ParamItem2 ::= Identifier [ ':' Type ] '=' ConstExpression
   3  
   4  ParamList1 ::= ParamItem1 { ',' ParamItem1 }
   5  ParamList2 ::= ParamList1 { ',' ParamItem2 } [ ',' '...' ]
   6  ParamList3 ::= ParamItem2 { ',' ParamItem2 } [ ',' '...' ]
   7  ParamList  ::= ( ParamList2 | ParamList3 | '...' ) [ 'as' Identifier ]
   8  
   9  OverloadableOperator ::= Operator | 'cast' | '.' Identifier [ '=' ] | '[' ']' [ '=' ]
  10  
  11  ParamReturn ::= '(' [ ParamList ] ')' [ '=>' Type ]
  12  
  13  RoutineSig   ::= Identifier '(' [ ParamList ] ')' [ '=>' Type ]
  14  CodeBlockSig ::= Identifier '(' [ ParamList ] ')' '[' [ ParamList1 ] ']' [ '=>' Type ]
  15  DecoratorSig ::= TypeHolder '(' Identifier '(' Identifier ')' [ ',' ParamList ] ')'
  16  
  17  RoutineDecl1 ::= 'routine' { Identifier '::' } ( RoutineSig | CodeBlockSig | DecoratorSig )
  18  RoutineDecl2 ::= 'operator' { Identifier '::' } OverloadableOperator ParamReturn
  19  
  20  RoutineDecl ::= RoutineDecl1 | RoutineDecl2
  21  
  22  Routine ::= RoutineDecl '{' StatementBlock '}'