================================================================================
IN expression with range operator
================================================================================

codeunit 50000 "Range Test"
{
    procedure TestCharacterRange()
    var
        ch: Char;
        isDigit: Boolean;
    begin
        isDigit := ch IN ['0' .. '9'];
    end;
}

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

(source_file
  (codeunit_declaration
    (codeunit_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (procedure
      (procedure_keyword)
      name: (identifier)
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (basic_type)))
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (basic_type))))
      (code_block
        (assignment_statement
          left: (identifier)
          left: (identifier)
          operator: (in_keyword)
          right: (list_literal
            (range_expression
              left: (string_literal)
              right: (string_literal))))))))

================================================================================
IN expression with multiple ranges
================================================================================

codeunit 50001 "Multiple Range Test"
{
    procedure TestMultipleRanges()
    var
        ch: Char;
        isAlphaNumeric: Boolean;
    begin
        isAlphaNumeric := ch IN ['A' .. 'Z', 'a' .. 'z', '0' .. '9'];
    end;
}

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

(source_file
  (codeunit_declaration
    (codeunit_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (procedure
      (procedure_keyword)
      name: (identifier)
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (basic_type)))
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (basic_type))))
      (code_block
        (assignment_statement
          left: (identifier)
          left: (identifier)
          operator: (in_keyword)
          right: (list_literal
            (range_expression
              left: (string_literal)
              right: (string_literal))
            (range_expression
              left: (string_literal)
              right: (string_literal))
            (range_expression
              left: (string_literal)
              right: (string_literal))))))))

================================================================================
IN expression with individual values
================================================================================

codeunit 50002 "Value List Test"
{
    procedure TestValueList()
    var
        value: Integer;
        isValid: Boolean;
    begin
        isValid := value IN [1, 5, 10, 15, 20];
    end;
}

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

(source_file
  (codeunit_declaration
    (codeunit_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (procedure
      (procedure_keyword)
      name: (identifier)
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (basic_type)))
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (basic_type))))
      (code_block
        (assignment_statement
          left: (identifier)
          left: (identifier)
          operator: (in_keyword)
          right: (list_literal
            (integer)
            (integer)
            (integer)
            (integer)
            (integer)))))))

================================================================================
Range operator in other contexts
================================================================================

codeunit 50003 "Range Context Test"
{
    procedure TestRangeInForLoop()
    var
        i: Integer;
        sum: Integer;
    begin
        sum := 0;
        for i := 1 to 10 do
            sum := sum + i;
    end;
    
    procedure TestRangeAsExpression()
    var
        range: Text;
    begin
        range := '1 .. 10';
    end;
}

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

(source_file
  (codeunit_declaration
    (codeunit_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (procedure
      (procedure_keyword)
      name: (identifier)
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (basic_type)))
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (basic_type))))
      (code_block
        (assignment_statement
          left: (identifier)
          right: (integer))
        (for_statement
          (for_keyword)
          variable: (identifier)
          start: (integer)
          direction: (to_keyword)
          end: (integer)
          (do_keyword)
          body: (assignment_statement
            left: (identifier)
            right: (additive_expression
              left: (identifier)
              right: (identifier))))))
    (procedure
      (procedure_keyword)
      name: (identifier)
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (text_type))))
      (code_block
        (assignment_statement
          left: (identifier)
          right: (string_literal))))))

================================================================================
Complex IN expression with field access
================================================================================

codeunit 50004 "Field Access Test"
{
    procedure TestFieldAccess()
    var
        Customer: Record Customer;
        isValidStatus: Boolean;
    begin
        isValidStatus := Customer.Status IN ['A' .. 'C', 'Z'];
    end;
}

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

(source_file
  (codeunit_declaration
    (codeunit_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (procedure
      (procedure_keyword)
      name: (identifier)
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (record_type
              reference: (identifier))))
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (basic_type))))
      (code_block
        (assignment_statement
          left: (identifier)
          left: (member_expression
            object: (identifier)
            member: (identifier))
          operator: (in_keyword)
          right: (list_literal
            (range_expression
              left: (string_literal)
              right: (string_literal))
            (string_literal)))))))
