@@ -574,8 +574,10 @@ fn get_top_level_reserved_token_no_indent(input: &str) -> IResult<&str, Token<'_
574574 Err ( Err :: Error ( Error :: new ( input, ErrorKind :: Alt ) ) )
575575 }
576576}
577-
578577fn get_plain_reserved_token ( input : & str ) -> IResult < & str , Token < ' _ > > {
578+ alt ( ( get_plain_reserved_two_token, get_plain_reserved_one_token) ) ( input)
579+ }
580+ fn get_plain_reserved_one_token ( input : & str ) -> IResult < & str , Token < ' _ > > {
579581 let uc_input = get_uc_words ( input, 1 ) ;
580582 let result: IResult < & str , & str > = alt ( (
581583 terminated ( tag ( "ACCESSIBLE" ) , end_of_word) ,
@@ -600,7 +602,6 @@ fn get_plain_reserved_token(input: &str) -> IResult<&str, Token<'_>> {
600602 alt ( (
601603 terminated ( tag ( "CHANGE" ) , end_of_word) ,
602604 terminated ( tag ( "CHANGED" ) , end_of_word) ,
603- terminated ( tag ( "CHARACTER SET" ) , end_of_word) ,
604605 terminated ( tag ( "CHARSET" ) , end_of_word) ,
605606 terminated ( tag ( "CHECK" ) , end_of_word) ,
606607 terminated ( tag ( "CHECKSUM" ) , end_of_word) ,
@@ -741,8 +742,6 @@ fn get_plain_reserved_token(input: &str) -> IResult<&str, Token<'_>> {
741742 terminated ( tag ( "NOW()" ) , end_of_word) ,
742743 terminated ( tag ( "NULL" ) , end_of_word) ,
743744 terminated ( tag ( "OFFSET" ) , end_of_word) ,
744- terminated ( tag ( "ON DELETE" ) , end_of_word) ,
745- terminated ( tag ( "ON UPDATE" ) , end_of_word) ,
746745 alt ( (
747746 terminated ( tag ( "ON" ) , end_of_word) ,
748747 terminated ( tag ( "ONLY" ) , end_of_word) ,
@@ -934,6 +933,29 @@ fn get_plain_reserved_token(input: &str) -> IResult<&str, Token<'_>> {
934933 }
935934}
936935
936+ fn get_plain_reserved_two_token ( input : & str ) -> IResult < & str , Token < ' _ > > {
937+ let uc_input = get_uc_words ( input, 2 ) ;
938+ let result: IResult < & str , & str > = alt ( (
939+ terminated ( tag ( "CHARACTER SET" ) , end_of_word) ,
940+ terminated ( tag ( "ON DELETE" ) , end_of_word) ,
941+ terminated ( tag ( "ON UPDATE" ) , end_of_word) ,
942+ ) ) ( & uc_input) ;
943+ if let Ok ( ( _, token) ) = result {
944+ let input_end_pos = token. len ( ) ;
945+ let ( token, input) = input. split_at ( input_end_pos) ;
946+ Ok ( (
947+ input,
948+ Token {
949+ kind : TokenKind :: Reserved ,
950+ value : token,
951+ key : None ,
952+ } ,
953+ ) )
954+ } else {
955+ Err ( Err :: Error ( Error :: new ( input, ErrorKind :: Alt ) ) )
956+ }
957+ }
958+
937959fn get_word_token ( input : & str ) -> IResult < & str , Token < ' _ > > {
938960 take_while1 ( is_word_character) ( input) . map ( |( input, token) | {
939961 (
0 commit comments