public Parser rewriteStatement() {
        if (rewriteStatementParser == null) {
           FutureParser future = scoped("rewriteStatement");
           rewriteStatementParser = future;
           future.setParser(
               sequence(
                   token("REWRITE"),
                   recordName(),
                   optional(
                       sequence(
                           token("FROM"),
                           choice(
                               identifier(),
                               literal()
                           )
                       )
                   ),
                   optional(
                       retryPhrase()
                   ),
                   optional(
                       sequence(
                           optional(
                               token("WITH")
                           ),
                           optional(
                               token("NO")
                           ),
                           token("LOCK")
                       )
                   ),
                   optional(
                       sequence(
                           token("INVALID"),
                           optional(
                               token("KEY")
                           ),
                           nestedStatements()
                       )
                   ),
                   optional(
                       sequence(
                           token("NOT"),
                           token("INVALID"),
                           optional(
                               token("KEY")
                           ),
                           nestedStatements()
                       )
                   ),
                   optional(
                       token("END-REWRITE")
                   )
               )
           );
        }

        return rewriteStatementParser;
    }