public Parser receiveStatement() {
        if (receiveStatementParser == null) {
           FutureParser future = scoped("receiveStatement");
           receiveStatementParser = future;
           future.setParser(
               sequence(
                   token("RECEIVE"),
                   choice(
                       sequence(
                           dataName(),
                           token("FROM"),
                           choice(
                               sequence(
                                   token("THREAD"),
                                   dataName()
                               ),
                               sequence(
                                   token("LAST"),
                                   token("THREAD")
                               ),
                               sequence(
                                   token("ANY"),
                                   token("THREAD")
                               )
                           ),
                           permuted(
                               sequence(
                                   token("BEFORE"),
                                   optional(
                                       token("TIME")
                                   ),
                                   choice(
                                       numeric(),
                                       identifier()
                                   )
                               ),
                               sequence(
                                   optional(
                                       token("WITH")
                                   ),
                                   token("NO"),
                                   token("WAIT")
                               ),
                               sequence(
                                   token("THREAD"),
                                   optional(
                                       token("IN")
                                   ),
                                   dataName()
                               ),
                               sequence(
                                   token("SIZE"),
                                   optional(
                                       token("IN")
                                   ),
                                   choice(
                                       numeric(),
                                       identifier()
                                   )
                               ),
                               sequence(
                                   token("STATUS"),
                                   optional(
                                       token("IN")
                                   ),
                                   choice(
                                       alphanumericLiteral(),
                                       identifier()
                                   )
                               ),
                               onException(),
                               notOnException()
                           )
                       ),
                       sequence(
                           cdName(),
                           choice(
                               token("MESSAGE"),
                               token("SEGMENT")
                           ),
                           optional(
                               token("INTO")
                           ),
                           identifier(),
                           optional(
                               sequence(
                                   token("NO"),
                                   token("DATA"),
                                   nestedStatements()
                               )
                           ),
                           optional(
                               sequence(
                                   token("WITH"),
                                   token("DATA"),
                                   nestedStatements()
                               )
                           )
                       )
                   ),
                   optional(
                       token("END-RECEIVE")
                   )
               )
           );
        }

        return receiveStatementParser;
    }