================================================================================
String literals with backslash characters
================================================================================

codeunit 123 TestBackslash
{
    procedure ConvertToURL(Path: Text): Text
    begin
        EXIT(CONVERTSTR(Path, '\', '/'));
    end;

    procedure ConvertToUNC(Path: Text): Text
    begin
        EXIT(CONVERTSTR(Path, '/', '\'));
    end;
}

--------------------------------------------------------------------------------

(source_file
  (codeunit_declaration
    (codeunit_keyword)
    object_id: (integer)
    object_name: (identifier)
    (procedure
      (procedure_keyword)
      name: (identifier)
      (parameter_list
        (parameter
          name: (identifier)
          type: (type_specification
            (text_type))))
      return_type: (type_specification
        (text_type))
      (code_block
        (exit_statement
          (exit_keyword)
          return_value: (call_expression
            function: (identifier)
            arguments: (argument_list
              (identifier)
              (string_literal)
              (string_literal))))))
    (procedure
      (procedure_keyword)
      name: (identifier)
      (parameter_list
        (parameter
          name: (identifier)
          type: (type_specification
            (text_type))))
      return_type: (type_specification
        (text_type))
      (code_block
        (exit_statement
          (exit_keyword)
          return_value: (call_expression
            function: (identifier)
            arguments: (argument_list
              (identifier)
              (string_literal)
              (string_literal))))))))

================================================================================
String literals with various special characters
================================================================================

codeunit 456 TestSpecialChars
{
    procedure TestChars()
    begin
        Message('\');
        Message('/');
        Message('"');
        Message('|');
        Message('*');
        Message('?');
        Message('<');
        Message('>');
    end;
}

--------------------------------------------------------------------------------

(source_file
  (codeunit_declaration
    (codeunit_keyword)
    object_id: (integer)
    object_name: (identifier)
    (procedure
      (procedure_keyword)
      name: (identifier)
      (code_block
        (call_expression
          function: (identifier)
          arguments: (argument_list
            (string_literal)))
        (call_expression
          function: (identifier)
          arguments: (argument_list
            (string_literal)))
        (call_expression
          function: (identifier)
          arguments: (argument_list
            (string_literal)))
        (call_expression
          function: (identifier)
          arguments: (argument_list
            (string_literal)))
        (call_expression
          function: (identifier)
          arguments: (argument_list
            (string_literal)))
        (call_expression
          function: (identifier)
          arguments: (argument_list
            (string_literal)))
        (call_expression
          function: (identifier)
          arguments: (argument_list
            (string_literal)))
        (call_expression
          function: (identifier)
          arguments: (argument_list
            (string_literal)))))))

================================================================================
String literals in complex expressions
================================================================================

codeunit 789 TestComplexStrings
{
    procedure ProcessFilePaths(InputPath: Text): Text
    begin
        InputPath := DELCHR(InputPath, '=', '\');
        InputPath := CONVERTSTR(InputPath, '\', '/');
        if STRPOS(InputPath, '\') > 0 then
            EXIT(CONVERTSTR(InputPath, '\', '/'))
        else
            EXIT(InputPath);
    end;
}

--------------------------------------------------------------------------------

(source_file
  (codeunit_declaration
    (codeunit_keyword)
    object_id: (integer)
    object_name: (identifier)
    (procedure
      (procedure_keyword)
      name: (identifier)
      (parameter_list
        (parameter
          name: (identifier)
          type: (type_specification
            (text_type))))
      return_type: (type_specification
        (text_type))
      (code_block
        (assignment_statement
          left: (identifier)
          right: (call_expression
            function: (identifier)
            arguments: (argument_list
              (identifier)
              (string_literal)
              (string_literal))))
        (assignment_statement
          left: (identifier)
          right: (call_expression
            function: (identifier)
            arguments: (argument_list
              (identifier)
              (string_literal)
              (string_literal))))
        (if_statement
          (if_keyword)
          condition: (comparison_expression
            left: (call_expression
              function: (identifier)
              arguments: (argument_list
                (identifier)
                (string_literal)))
            operator: (comparison_operator)
            right: (integer))
          (then_keyword)
          then_branch: (exit_statement
            (exit_keyword)
            return_value: (call_expression
              function: (identifier)
              arguments: (argument_list
                (identifier)
                (string_literal)
                (string_literal))))
          (else_keyword)
          else_branch: (exit_statement
            (exit_keyword)
            return_value: (identifier)))))))

================================================================================
Mixed string literals and function calls
================================================================================

codeunit 999 TestMixed
{
    procedure TestMixedUsage(): Text
    begin
        EXIT(Format('%1%2%3', 'before', '\', 'after'));
    end;
}

--------------------------------------------------------------------------------

(source_file
  (codeunit_declaration
    (codeunit_keyword)
    object_id: (integer)
    object_name: (identifier)
    (procedure
      (procedure_keyword)
      name: (identifier)
      return_type: (type_specification
        (text_type))
      (code_block
        (exit_statement
          (exit_keyword)
          return_value: (call_expression
            function: (identifier)
            arguments: (argument_list
              (string_literal)
              (string_literal)
              (string_literal)
              (string_literal))))))))
