anchor.diff:  %%
   
   do_parse_flow_scalar([C | Rest], Line, Col, Delta, Parser,
  -  #flow_scalar_ctx{style = plain, output = "", next_escaped = false,
  -  surrogate = undefined} = Ctx) when ?IS_SPACE(C) ->
  +  #flow_scalar_ctx{style = plain, output = "", surrogate = undefined} = Ctx)
  +  when ?IS_SPACE(C) ->
       %% Skip leading white spaces in a plain scalar. We must update the
       %% position of beginning of the scalar and thus the implicit key.
       {Col1, Delta1} = next_col(Col, Delta, 1),
  
positive.code: 
  %% The next character is escaped.
  do_parse_flow_scalar([$\\ | Rest], Line, Col, Delta, Parser,
    #flow_scalar_ctx{style = double_quoted, next_escaped = false,
    spaces = Spaces} = Ctx) ->
      {Col1, Delta1} = next_col(Col, Delta, 1),
      Ctx1 = Ctx#flow_scalar_ctx{
        next_escaped = true,
        spaces       = "",
        newline      = false,
        output       = Spaces ++ Ctx#flow_scalar_ctx.output
      },
      do_parse_flow_scalar(Rest, Line, Col1, Delta1, Parser, Ctx1);
  
  %% Escaped 16-bit Unicode character, \uFFFF [60].
  do_parse_flow_scalar([$u | _] = 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) < 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([$u | _] = Chars, Line, Col, Delta,
    #yaml_parser{chars_len = Len} = Parser,
    #flow_scalar_ctx{next_escaped = true} = 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/6, Ctx);
  do_parse_flow_scalar([$u, O1, O2, O3, O4 | Rest], Line, Col, Delta, Parser,
    #flow_scalar_ctx{next_escaped = true, 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,
      Ctx2 = Ctx1#flow_scalar_ctx{
        next_escaped = false
      },
      do_parse_flow_scalar(Rest, Line, Col1, Delta1, Parser, Ctx2);
  do_parse_flow_scalar([$u | _] = 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 32-bit Unicode character, \UFFFFFFFF [61].
  do_parse_flow_scalar([$U | _] = 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) < 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([$U | _] = Chars, Line, Col, Delta,
    #yaml_parser{chars_len = Len} = Parser,
    #flow_scalar_ctx{next_escaped = true} = 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/6, Ctx);
  do_parse_flow_scalar([$U, O1, O2, O3, O4, O5, O6, O7, O8 | Rest], Line, Col,
    Delta, Parser,
    #flow_scalar_ctx{next_escaped = true, 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,
      Ctx2 = Ctx1#flow_scalar_ctx{
        next_escaped = false
      },
      do_parse_flow_scalar(Rest, Line, Col1, Delta1, Parser, Ctx2);
  do_parse_flow_scalar([$U | _] = 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);
  
  %% Invalid surrogate pair.
  do_parse_flow_scalar([_ | _] = Chars, Line, Col, Delta, Parser,
  
negative.code:     col          = 1     :: position(), %% Column where the token starts.
      endline      = 1     :: position(), %% Line where the token ends.
      endcol       = 1     :: position(), %% Column where the token ends.
      surrogate            :: 16#d800..16#dbff | undefined, %% High surrogate.
      newline      = false :: boolean(),  %% Met a newline character.
      spaces       = ""    :: string(),   %% Last white spaces seen.
  