anchor.diff:  do_parse_flow_scalar([] = Chars, Line, Col, Delta, Parser, Ctx) ->
       suspend_parsing(Chars, Line, Col, Delta, Parser,
         fun do_parse_flow_scalar/6, Ctx).
  +
  +%%
  +%% Escaped characters [62].
  +%% Only supported by double-quoted strings.
  +%%
  +
  +%% Escaped 16-bit Unicode character, \uFFFF [60].
  +do_parse_flow_scalar_escaped([$u | _] = Chars, Line, Col, Delta,
  +  #yaml_parser{chars_len = Len, raw_eos = true} = Parser,
  +  #flow_scalar_ctx{style = Style, line = Sc_Line, col = Sc_Col,
  +  output = Output})
  +  when (Len - Delta) < 5 ->
  +    %% Unexpected enf-of-stream.
  +    Token = #yaml_scalar{
  +      style    = flow,
  +      substyle = Style,
  +      text     = lists:reverse(Output),
  +      line     = Sc_Line,
  +      column   = Sc_Col
  +    },
  +    Token1 = set_default_tag(Token),
  +    Error  = #yaml_parsing_error{
  +      name   = unexpected_eos,
  +      token  = Token1,
  +      line   = Line,
  +      column = Col
  +    },
  +    Parser1 = add_error(Parser, Error,
  +      "Unexpected end-of-stream while parsing flow scalar", []),
  +    return(Chars, Line, Col, Delta, Parser1);
  +do_parse_flow_scalar_escaped([$u | _] = Chars, Line, Col, Delta,
  +  #yaml_parser{chars_len = Len} = Parser, Ctx)
  +  when (Len - Delta) < 5 ->
  +    %% Can't be sure it's an escaped Unicode character.
  +    suspend_parsing(Chars, Line, Col, Delta, Parser,
  +      fun do_parse_flow_scalar_escaped/6, Ctx);
  +do_parse_flow_scalar_escaped([$u, O1, O2, O3, O4 | Rest], Line, Col, Delta,
  +  Parser, #flow_scalar_ctx{surrogate = High} = Ctx) when
  +  ?IS_HEXADECIMAL(O1) andalso ?IS_HEXADECIMAL(O2) andalso
  +  ?IS_HEXADECIMAL(O3) andalso ?IS_HEXADECIMAL(O4) ->
  +    {Col1, Delta1} = next_col(Col, Delta, 5),
  +    C    = hex_to_dec([O1, O2, O3, O4], 0),
  +    Ctx1 = case High of
  +        undefined ->
  +            if
  +                ?IS_HIGH_SURROGATE(C) ->
  +                    %% This is the high part of a UTF-16 surrogate pair.
  +                    Ctx#flow_scalar_ctx{
  +                      surrogate = C
  +                    };
  +                true ->
  +                    %% Normal character.
  +                    Ctx#flow_scalar_ctx{
  +                      output = [C | Ctx#flow_scalar_ctx.output]
  +                    }
  +            end;
  +        _ ->
  +            if
  +                ?IS_LOW_SURROGATE(C) ->
  +                    %% This is the low part of a UTF-16 surrogate pair.
  +                    C1 = 16#10000 + (High - 16#d800) * 16#400 + (C - 16#dc00),
  +                    Ctx#flow_scalar_ctx{
  +                      output    = [C1 | Ctx#flow_scalar_ctx.output],
  +                      surrogate = undefined
  +                    };
  +                true ->
  +                    %% Error: high surrogate without a low surrogate.
  +                    %% The error is generated by the next clause.
  +                    Ctx
  +            end
  +    end,
  +    do_parse_flow_scalar(Rest, Line, Col1, Delta1, Parser, Ctx1);
  +do_parse_flow_scalar_escaped([$u | _] = Chars, Line, Col, Delta, Parser,
  +  #flow_scalar_ctx{line = Sc_Line, col = Sc_Col, style = Style,
  +  output = Output} = Ctx) ->
  +    %% Invalid escaped character.
  +    Token = #yaml_scalar{
  +      style    = flow,
  +      substyle = Style,
  +      text     = lists:reverse(Output),
  +      line     = Sc_Line,
  +      column   = Sc_Col
  +    },
  +    Token1 = set_default_tag(Token),
  +    Error  = #yaml_parsing_error{
  +      name   = invalid_escaped_character,
  +      type   = warning,
  +      token  = Token1,
  +      line   = Line,
  +      column = Col - 1
  +    },
  +    Parser1 = add_error(Parser, Error,
  +      "Invalid escaped character", []),
  +    do_parse_flow_scalar(Chars, Line, Col, Delta, Parser1, Ctx);
  +
  +%% Escaped 32-bit Unicode character, \UFFFFFFFF [61].
  +do_parse_flow_scalar_escaped([$U | _] = Chars, Line, Col, Delta,
  +  #yaml_parser{chars_len = Len, raw_eos = true} = Parser,
  +  #flow_scalar_ctx{style = Style, line = Sc_Line, col = Sc_Col,
  +  output = Output})
  +  when (Len - Delta) < 9 ->
  +    %% Unexpected enf-of-stream.
  +    Token = #yaml_scalar{
  +      style    = flow,
  +      substyle = Style,
  +      text     = lists:reverse(Output),
  +      line     = Sc_Line,
  +      column   = Sc_Col
  +    },
  +    Token1 = set_default_tag(Token),
  +    Error  = #yaml_parsing_error{
  +      name   = unexpected_eos,
  +      token  = Token1,
  +      line   = Line,
  +      column = Col
  +    },
  +    Parser1 = add_error(Parser, Error,
  +      "Unexpected end-of-stream while parsing flow scalar", []),
  +    return(Chars, Line, Col, Delta, Parser1);
  +do_parse_flow_scalar_escaped([$U | _] = Chars, Line, Col, Delta,
  +  #yaml_parser{chars_len = Len} = Parser, Ctx)
  +  when (Len - Delta) < 9 ->
  +    %% Can't be sure it's an escaped Unicode character.
  +    suspend_parsing(Chars, Line, Col, Delta, Parser,
  +      fun do_parse_flow_scalar_escaped/6, Ctx);
  +do_parse_flow_scalar_escaped([$U, O1, O2, O3, O4, O5, O6, O7, O8 | Rest],
  +  Line, Col, Delta, Parser, #flow_scalar_ctx{surrogate = High} = Ctx) when
  +  ?IS_HEXADECIMAL(O1) andalso ?IS_HEXADECIMAL(O2) andalso
  +  ?IS_HEXADECIMAL(O3) andalso ?IS_HEXADECIMAL(O4) andalso
  +  ?IS_HEXADECIMAL(O5) andalso ?IS_HEXADECIMAL(O6) andalso
  +  ?IS_HEXADECIMAL(O7) andalso ?IS_HEXADECIMAL(O8) ->
  +    {Col1, Delta1} = next_col(Col, Delta, 9),
  +    C    = hex_to_dec([O1, O2, O3, O4, O5, O6, O7, O8], 0),
  +    Ctx1 = case High of
  +        undefined ->
  +            if
  +                ?IS_HIGH_SURROGATE(C) ->
  +                    %% This is the high part of a UTF-16 surrogate pair.
  +                    Ctx#flow_scalar_ctx{
  +                      surrogate = C
  +                    };
  +                true ->
  +                    %% Normal character.
  +                    Ctx#flow_scalar_ctx{
  +                      output = [C | Ctx#flow_scalar_ctx.output]
  +                    }
  +            end;
  +        _ ->
  +            if
  +                ?IS_LOW_SURROGATE(C) ->
  +                    %% This is the low part of a UTF-16 surrogate pair.
  +                    C1 = 16#10000 + (High - 16#d800) * 16#400 + (C - 16#dc00),
  +                    Ctx#flow_scalar_ctx{
  +                      output    = [C1 | Ctx#flow_scalar_ctx.output],
  +                      surrogate = undefined
  +                    };
  +                true ->
  +                    %% Error: high surrogate without a low surrogate.
  +                    %% The error is generated by the next clause.
  +                    Ctx
  +            end
  +    end,
  +    do_parse_flow_scalar(Rest, Line, Col1, Delta1, Parser, Ctx1);
  +do_parse_flow_scalar_escaped([$U | _] = Chars, Line, Col, Delta, Parser,
  +  #flow_scalar_ctx{line = Sc_Line, col = Sc_Col,
  +  style = Style, output = Output} = Ctx) ->
  +    %% Invalid escaped character.
  +    Token = #yaml_scalar{
  +      style    = flow,
  +      substyle = Style,
  +      text     = lists:reverse(Output),
  +      line     = Sc_Line,
  +      column   = Sc_Col
  +    },
  +    Token1 = set_default_tag(Token),
  +    Error  = #yaml_parsing_error{
  +      name   = invalid_escaped_character,
  +      type   = warning,
  +      token  = Token1,
  +      line   = Line,
  +      column = Col - 1
  +    },
  +    Parser1 = add_error(Parser, Error,
  +      "Invalid escaped character", []),
  +    do_parse_flow_scalar(Chars, Line, Col, Delta, Parser1, Ctx);
  +
  +%% Escaped 8-bit Unicode character, \xFF [59].
  +do_parse_flow_scalar_escaped([$x | _] = Chars, Line, Col, Delta,
  +  #yaml_parser{chars_len = Len, raw_eos = true} = Parser,
  +  #flow_scalar_ctx{style = Style, line = Sc_Line, col = Sc_Col,
  +  output = Output})
  +  when (Len - Delta) < 3 ->
  +    %% Unexpected enf-of-stream.
  +    Token = #yaml_scalar{
  +      style    = flow,
  +      substyle = Style,
  +      text     = lists:reverse(Output),
  +      line     = Sc_Line,
  +      column   = Sc_Col
  +    },
  +    Token1 = set_default_tag(Token),
  +    Error  = #yaml_parsing_error{
  +      name   = unexpected_eos,
  +      token  = Token1,
  +      line   = Line,
  +      column = Col
  +    },
  +    Parser1 = add_error(Parser, Error,
  +      "Unexpected end-of-stream while parsing flow scalar", []),
  +    return(Chars, Line, Col, Delta, Parser1);
  +do_parse_flow_scalar_escaped([$x | _] = Chars, Line, Col, Delta,
  +  #yaml_parser{chars_len = Len} = Parser, Ctx)
  +  when (Len - Delta) < 3 ->
  +    %% Can't be sure it's an escaped Unicode character.
  +    suspend_parsing(Chars, Line, Col, Delta, Parser,
  +      fun do_parse_flow_scalar_escaped/6, Ctx);
  +do_parse_flow_scalar_escaped([$x, O1, O2 | Rest], Line, Col, Delta, Parser, Ctx)
  +  when ?IS_HEXADECIMAL(O1) andalso ?IS_HEXADECIMAL(O2) ->
  +    {Col1, Delta1} = next_col(Col, Delta, 3),
  +    C    = hex_to_dec([O1, O2], 0),
  +    Ctx1 = Ctx#flow_scalar_ctx{
  +      output       = [C | Ctx#flow_scalar_ctx.output]
  +    },
  +    do_parse_flow_scalar(Rest, Line, Col1, Delta1, Parser, Ctx1);
  +do_parse_flow_scalar_escaped([$x | _] = Chars, Line, Col, Delta, Parser,
  +  #flow_scalar_ctx{line = Sc_Line, col = Sc_Col, style = Style,
  +  output = Output} = Ctx) ->
  +    %% Invalid escaped character.
  +    Token = #yaml_scalar{
  +      style    = flow,
  +      substyle = Style,
  +      text     = lists:reverse(Output),
  +      line     = Sc_Line,
  +      column   = Sc_Col
  +    },
  +    Token1 = set_default_tag(Token),
  +    Error  = #yaml_parsing_error{
  +      name   = invalid_escaped_character,
  +      type   = warning,
  +      token  = Token1,
  +      line   = Line,
  +      column = Col - 1
  +    },
  +    Parser1 = add_error(Parser, Error,
  +      "Invalid escaped character", []),
  +    do_parse_flow_scalar(Chars, Line, Col, Delta, Parser1, Ctx);
  +
  +%% Escaped newline.
  +%% All trailing whitespaces are kept as content before an escaped
  +%% newline: this is handled in the $\\ clause above.
  +do_parse_flow_scalar_escaped([$\r] = Chars, Line, Col, Delta,
  +  #yaml_parser{raw_eos = false} = Parser, Ctx) ->
  +    %% Can't be sure it's a newline. It may be followed by a LF.
  +    suspend_parsing(Chars, Line, Col, Delta, Parser,
  +      fun do_parse_flow_scalar_escaped/6, Ctx);
  +do_parse_flow_scalar_escaped([C | _] = Chars, Line, _, Delta,
  +  #yaml_parser{doc_version = Version} = Parser,
  +  #flow_scalar_ctx{style = double_quoted} = Ctx)
  +  when ?IS_NEWLINE(C) orelse (Version == {1,1} andalso ?IS_NEWLINE_11(C)) ->
  +    {Rest, Line1, Col1, Delta1} = next_line(Chars, Line, Delta, Parser),
  +    Ctx1 = Ctx#flow_scalar_ctx{
  +      newline = true
  +    },
  +    do_parse_flow_scalar(Rest, Line1, Col1, Delta1, Parser, Ctx1);
  +
  +%% Other escaped characters.
  +do_parse_flow_scalar_escaped([C | Rest] = Chars, Line, Col, Delta, Parser,
  +  #flow_scalar_ctx{line = Sc_Line, col = Sc_Col, style = Style,
  +  output = Output} = Ctx) ->
  +    Parser1 = warn_if_non_ascii_line_break(Chars, Line, Col, Parser),
  +    case unescape_char(C) of
  +        undefined ->
  +            %% Invalid escaped character.
  +            Token = #yaml_scalar{
  +              style    = flow,
  +              substyle = Style,
  +              text     = lists:reverse(Output),
  +              line     = Sc_Line,
  +              column   = Sc_Col
  +            },
  +            Token1 = set_default_tag(Token),
  +            Error  = #yaml_parsing_error{
  +              name   = invalid_escaped_character,
  +              type   = warning,
  +              token  = Token1,
  +              line   = Line,
  +              column = Col - 1
  +            },
  +            Parser2 = add_error(Parser1, Error,
  +              "Invalid escaped character", []),
  +            do_parse_flow_scalar(Chars, Line, Col, Delta, Parser2, Ctx);
  +        C1 ->
  +            {Col1, Delta1} = next_col(Col, Delta, 1),
  +            Ctx1 = Ctx#flow_scalar_ctx{
  +              output       = [C1 | Ctx#flow_scalar_ctx.output]
  +            },
  +            do_parse_flow_scalar(Rest, Line, Col1, Delta1, Parser1, Ctx1)
  +    end;
  +
  +do_parse_flow_scalar_escaped([] = Chars, Line, Col, Delta,
  +  #yaml_parser{raw_eos = true} = Parser,
  +  #flow_scalar_ctx{style = Style, line = Sc_Line, col = Sc_Col,
  +  output = Output}) ->
  +    Token = #yaml_scalar{
  +      style    = flow,
  +      substyle = Style,
  +      text     = lists:reverse(Output),
  +      line     = Sc_Line,
  +      column   = Sc_Col
  +    },
  +    Token1 = set_default_tag(Token),
  +    Error  = #yaml_parsing_error{
  +      name   = unexpected_eos,
  +      token  = Token1,
  +      line   = Line,
  +      column = Col
  +    },
  +    Parser1 = add_error(Parser, Error,
  +      "Unexpected end-of-stream while parsing flow scalar", []),
  +    return(Chars, Line, Col, Delta, Parser1);
  +do_parse_flow_scalar_escaped([] = Chars, Line, Col, Delta, Parser, Ctx) ->
  +    suspend_parsing(Chars, Line, Col, Delta, Parser,
  +      fun do_parse_flow_scalar_escaped/6, Ctx).
   
   queue_flow_scalar_token(Chars, Line, Col, Delta, Parser,
     #flow_scalar_ctx{style = Style, output = Output, spaces = Spaces,
  
positive.code:       surrogate = undefined
      },
      do_parse_flow_scalar(Chars, Line, Col, Delta, Parser1, Ctx1);
  
  %% Escaped 8-bit Unicode character, \xFF [59].
  do_parse_flow_scalar([$x | _] = Chars, Line, Col, Delta,
    #yaml_parser{chars_len = Len, raw_eos = true} = Parser,
    #flow_scalar_ctx{next_escaped = true, style = Style,
    line = Sc_Line, col = Sc_Col, output = Output})
    when (Len - Delta) < 3 ->
      %% Unexpected enf-of-stream.
      Token = #yaml_scalar{
        style    = flow,
        substyle = Style,
        text     = lists:reverse(Output),
        line     = Sc_Line,
        column   = Sc_Col
      },
      Token1 = set_default_tag(Token),
      Error  = #yaml_parsing_error{
        name   = unexpected_eos,
        token  = Token1,
        line   = Line,
        column = Col
      },
      Parser1 = add_error(Parser, Error,
        "Unexpected end-of-stream while parsing flow scalar", []),
      return(Chars, Line, Col, Delta, Parser1);
  do_parse_flow_scalar([$x | _] = Chars, Line, Col, Delta,
    #yaml_parser{chars_len = Len} = Parser,
    #flow_scalar_ctx{next_escaped = true} = Ctx)
    when (Len - Delta) < 3 ->
      %% Can't be sure it's an escaped Unicode character.
      suspend_parsing(Chars, Line, Col, Delta, Parser,
        fun do_parse_flow_scalar/6, Ctx);
  do_parse_flow_scalar([$x, O1, O2 | Rest], Line, Col, Delta, Parser,
    #flow_scalar_ctx{next_escaped = true} = Ctx) when
    ?IS_HEXADECIMAL(O1) andalso ?IS_HEXADECIMAL(O2) ->
      {Col1, Delta1} = next_col(Col, Delta, 3),
      C    = hex_to_dec([O1, O2], 0),
      Ctx1 = Ctx#flow_scalar_ctx{
        next_escaped = false,
        output       = [C | Ctx#flow_scalar_ctx.output]
      },
      do_parse_flow_scalar(Rest, Line, Col1, Delta1, Parser, Ctx1);
  do_parse_flow_scalar([$x | _] = Chars, Line, Col, Delta, Parser,
    #flow_scalar_ctx{next_escaped = true, line = Sc_Line, col = Sc_Col,
    style = Style, output = Output} = Ctx) ->
      %% Invalid escaped character.
      Token = #yaml_scalar{
        style    = flow,
        substyle = Style,
        text     = lists:reverse(Output),
        line     = Sc_Line,
        column   = Sc_Col
      },
      Token1 = set_default_tag(Token),
      Error  = #yaml_parsing_error{
        name   = invalid_escaped_character,
        type   = warning,
        token  = Token1,
        line   = Line,
        column = Col - 1
      },
      Parser1 = add_error(Parser, Error,
        "Invalid escaped character", []),
      Ctx1 = Ctx#flow_scalar_ctx{
        next_escaped = false
      },
      do_parse_flow_scalar(Chars, Line, Col, Delta, Parser1, Ctx1);
  
  %% Escaped newline.
  %% All trailing whitespaces are kept as content before an escaped
  %% newline: this is handled in the $\\ clause above.
  do_parse_flow_scalar([C | _] = Chars, Line, _, Delta,
    #yaml_parser{doc_version = Version} = Parser,
    #flow_scalar_ctx{style = double_quoted, next_escaped = true} = Ctx)
    when ?IS_NEWLINE(C) orelse (Version == {1,1} andalso ?IS_NEWLINE_11(C)) ->
      {Rest, Line1, Col1, Delta1} = next_line(Chars, Line, Delta, Parser),
      Ctx1    = Ctx#flow_scalar_ctx{
        next_escaped = false,
        newline      = true
      },
      do_parse_flow_scalar(Rest, Line1, Col1, Delta1, Parser, Ctx1);
  
  %% Other escaped characters.
  do_parse_flow_scalar([C | Rest] = Chars, Line, Col, Delta, Parser,
    #flow_scalar_ctx{next_escaped = true, line = Sc_Line, col = Sc_Col,
    style = Style, output = Output} = Ctx) ->
      Parser1 = warn_if_non_ascii_line_break(Chars, Line, Col, Parser),
      case unescape_char(C) of
          undefined ->
              %% Invalid escaped character.
              Token = #yaml_scalar{
                style    = flow,
                substyle = Style,
                text     = lists:reverse(Output),
                line     = Sc_Line,
                column   = Sc_Col
              },
              Token1 = set_default_tag(Token),
              Error  = #yaml_parsing_error{
                name   = invalid_escaped_character,
                type   = warning,
                token  = Token1,
                line   = Line,
                column = Col - 1
              },
              Parser2 = add_error(Parser1, Error,
                "Invalid escaped character", []),
              Ctx1 = Ctx#flow_scalar_ctx{
                next_escaped = false
              },
              do_parse_flow_scalar(Chars, Line, Col, Delta, Parser2, Ctx1);
          C1 ->
              {Col1, Delta1} = next_col(Col, Delta, 1),
              Ctx1 = Ctx#flow_scalar_ctx{
                next_escaped = false,
                output       = [C1 | Ctx#flow_scalar_ctx.output]
              },
              do_parse_flow_scalar(Rest, Line, Col1, Delta1, Parser1, Ctx1)
      end;
  
  %% In a single-quoted string, a single quote is escaped by doubling
  %% it.
  
negative.code: 
  %% The next character is escaped.
  do_parse_flow_scalar([$\\ | Rest], Line, Col, Delta, Parser,
    #flow_scalar_ctx{style = double_quoted,
    spaces = Spaces} = Ctx) ->
      {Col1, Delta1} = next_col(Col, Delta, 1),
      Ctx1 = Ctx#flow_scalar_ctx{
        spaces       = "",
        newline      = false,
        output       = Spaces ++ Ctx#flow_scalar_ctx.output
      },
      do_parse_flow_scalar_escaped(Rest, Line, Col1, Delta1, Parser, Ctx1);
  
  %% Invalid surrogate pair.
  do_parse_flow_scalar([_ | _] = Chars, Line, Col, Delta, Parser,
  