[NAME]
ALL.dao.grammar.routine

[TITLE]
Routines (Functions)

[DESCRIPTION]


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