================================================================================
Preprocessor directives in actions section
================================================================================

pageextension 50000 MyPageExt extends "Customer List"
{
    actions
    {
#if not CLEAN24
        addbefore(Category_Process)
        {
            actionref(MyAction_Promoted; MyAction)
            {
                Visible = false;
                ObsoleteState = Pending;
            }
        }
#endif
        addfirst(processing)
        {
            action(NewAction)
            {
                Caption = 'New Action';
                ApplicationArea = All;
            }
        }
    }
}

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

(source_file
  (pageextension_declaration
    (pageextension_keyword)
    object_id: (integer)
    object_name: (identifier)
    (extends_keyword)
    base_object: (quoted_identifier)
    (actions_section
      (actions_keyword)
      (preproc_conditional_actions
        (preproc_if
          condition: (preproc_not_expression
            (identifier)))
        (addbefore_action_modification
          target: (identifier)
          (actionref_declaration
            promoted_name: (identifier)
            action_name: (identifier)
            (property
              name: (property_name)
              value: (boolean))
            (property
              name: (property_name)
              value: (identifier))))
        (preproc_endif))
      (addfirst_action_modification
        target: (identifier)
        (action_declaration
          name: (identifier)
          (property
            name: (property_name)
            value: (string_literal))
          (property
            name: (property_name)
            value: (identifier)))))))

================================================================================
Preprocessor with else branch in actions
================================================================================

page 50001 MyPage
{
    actions
    {
#if CLEAN24
        area(processing)
        {
            action(ModernAction)
            {
                Caption = 'Modern Action';
            }
        }
#else
        area(processing)
        {
            action(LegacyAction)
            {
                Caption = 'Legacy Action';
            }
        }
#endif
    }
}

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

(source_file
  (page_declaration
    (page_keyword)
    object_id: (integer)
    object_name: (identifier)
    (actions_section
      (actions_keyword)
      (preproc_conditional_actions
        (preproc_if
          condition: (identifier))
        (action_area_section
          (area_keyword)
          (action_declaration
            name: (identifier)
            (property
              name: (property_name)
              value: (string_literal))))
        (preproc_else)
        (action_area_section
          (area_keyword)
          (action_declaration
            name: (identifier)
            (property
              name: (property_name)
              value: (string_literal))))
        (preproc_endif)))))

================================================================================
Nested action groups with preprocessor
================================================================================

pageextension 50002 ComplexActions extends "Item List"
{
    actions
    {
        area(navigation)
        {
#if not CLEAN23
            group(OldGroup)
            {
                Caption = 'Old Group';
                
                action(OldAction)
                {
                    Caption = 'Old Action';
                }
            }
#endif
            group(NewGroup)
            {
                Caption = 'New Group';
                
                action(NewAction)
                {
                    Caption = 'New Action';
                }
            }
        }
    }
}

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

(source_file
  (pageextension_declaration
    (pageextension_keyword)
    object_id: (integer)
    object_name: (identifier)
    (extends_keyword)
    base_object: (quoted_identifier)
    (actions_section
      (actions_keyword)
      (action_area_section
        (area_keyword)
        (preproc_conditional_actions
          (preproc_if
            condition: (preproc_not_expression
              (identifier)))
          (action_group_section
            (group_keyword)
            name: (identifier)
            (property
              name: (property_name)
              value: (string_literal))
            (action_declaration
              name: (identifier)
              (property
                name: (property_name)
                value: (string_literal))))
          (preproc_endif))
        (action_group_section
          (group_keyword)
          name: (identifier)
          (property
            name: (property_name)
            value: (string_literal))
          (action_declaration
            name: (identifier)
            (property
              name: (property_name)
              value: (string_literal))))))))

================================================================================
Mixed preprocessor cases in actions
================================================================================

page 50003 MixedCase
{
    actions
    {
#IF NOT TESTMODE
        area(creation)
        {
            action(Create)
            {
                Caption = 'Create';
            }
        }
#ENDIF
#if EnableBeta
        modify(SomeAction)
        {
            Visible = true;
        }
#endif
    }
}

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

(source_file
  (page_declaration
    (page_keyword)
    object_id: (integer)
    object_name: (identifier)
    (actions_section
      (actions_keyword)
      (preproc_conditional_actions
        (preproc_if
          condition: (preproc_not_expression
            (identifier)))
        (action_area_section
          (area_keyword)
          (action_declaration
            name: (identifier)
            (property
              name: (property_name)
              value: (string_literal))))
        (preproc_endif))
      (preproc_conditional_actions
        (preproc_if
          condition: (identifier))
        (modify_action_modification
          target: (identifier)
          (property
            name: (property_name)
            value: (boolean)))
        (preproc_endif)))))
