docs: public FunctionDescr function( PackageDescrBuilder pkg ) throws RecognitionException {
          FunctionDescrBuilder function = null;
          try {
              function = helper.start( pkg,
                                       FunctionDescrBuilder.class,
                                       null );
  
              // 'function'
              match( input,
                     DRL5Lexer.ID,
                     DroolsSoftKeywords.FUNCTION,
                     null,
                     DroolsEditorType.KEYWORD );
              if ( state.failed ) return null;
  
              if ( input.LA( 1 ) != DRL5Lexer.ID || input.LA( 2 ) != DRL5Lexer.LEFT_PAREN ) {
                  // type
                  String type = type();
                  if ( state.failed ) return null;
                  if ( state.backtracking == 0 ) function.returnType( type );
              }
  
              // name
              Token id = match( input,
                                DRL5Lexer.ID,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER );
              if ( state.failed ) return null;
              if ( state.backtracking == 0 ) {
                  function.name( id.getText() );
                  helper.setParaphrasesValue( DroolsParaphraseTypes.FUNCTION,
                                              "\"" + id.getText() + "\"" );
              }
  
              // arguments
              parameters( function,
                          true );
              if ( state.failed ) return null;
  
              // body
              String body = chunk( DRL5Lexer.LEFT_CURLY,
                                   DRL5Lexer.RIGHT_CURLY,
                                   -1 );
              if ( state.failed ) return null;
              if ( state.backtracking == 0 ) function.body( body );
  
          } catch ( RecognitionException re ) {
              reportError( re );
          } finally {
              helper.end( FunctionDescrBuilder.class,
                          function );
          }
          return (function != null) ? function.getDescr() : null;
      }