Skip to content

Commit

Permalink
Typo indent instead of intend
Browse files Browse the repository at this point in the history
  • Loading branch information
fmabap committed Mar 21, 2022
1 parent 4d6ccbe commit 282bda7
Show file tree
Hide file tree
Showing 20 changed files with 221 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ CLASS zcl_app_rule_amdp_by IMPLEMENTATION.
adjust_prev_rule( lr_open_bracket_rule ).

super->zif_app_rule~finalize_init( ).
"respect the new line intend difference of the ORDER Rule at ORDER by for example
"respect the new line indent difference of the ORDER Rule at ORDER by for example
lv_cur_offset_end = zif_app_rule~get_cur_offset_end( ).
mr_rule_data->new_line_intend_diff = lv_cur_offset_end - mr_prev_rule->get_new_line_intend( ).
mr_rule_data->new_line_indent_diff = lv_cur_offset_end - mr_prev_rule->get_new_line_indent( ).

ENDMETHOD.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ CLASS zcl_app_rule_amdp_call IMPLEMENTATION.

METHOD set_add_indent_add_arrow.
DATA lr_arrow TYPE REF TO zif_app_rule.
DATA lv_add_intend TYPE i.
DATA lv_add_indent TYPE i.
lr_arrow = get_arrow_of_parameter( ir_parameter ).
IF lr_arrow IS INITIAL.
RETURN.
ENDIF.

lv_add_intend = iv_max_parameter_length - zcl_app_utilities=>get_token_length_wo_delimiter( ir_parameter ).
lr_arrow->set_additional_intend( iv_intend = lv_add_intend ).
lv_add_indent = iv_max_parameter_length - zcl_app_utilities=>get_token_length_wo_delimiter( ir_parameter ).
lr_arrow->set_additional_indent( iv_indent = lv_add_indent ).

ENDMETHOD.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CLASS zcl_app_rule_amdp_clse_bracket DEFINITION
PUBLIC SECTION.
METHODS zif_app_rule~get_cur_row REDEFINITION.
METHODS zif_app_rule~get_cur_offset_start REDEFINITION.
METHODS zif_app_rule~get_new_line_intend REDEFINITION.
METHODS zif_app_rule~get_new_line_indent REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
METHODS find_prev_open_bracket_rule
Expand Down Expand Up @@ -70,27 +70,27 @@ CLASS zcl_app_rule_amdp_clse_bracket IMPLEMENTATION.
lr_open_bracket_rule ?= find_prev_open_bracket_rule( ).
IF lr_open_bracket_rule->get_mv_special_logic( ) <> zif_app_amdp_rule_definitions=>cos_open_bracket_special_logic-call_statement
AND lr_open_bracket_rule->zif_app_rule~get_end_row( ) <> zif_app_rule~get_cur_row( ).
rv_result = lr_open_bracket_rule->zif_app_rule~get_cur_offset_start( ) + mv_add_intend.
rv_result = lr_open_bracket_rule->zif_app_rule~get_cur_offset_start( ) + mv_add_indent.
zif_app_rule~set_cur_offset_start( rv_result ).
ELSE.
rv_result = super->zif_app_rule~get_cur_offset_start( ).
ENDIF.

ENDMETHOD.

METHOD zif_app_rule~get_new_line_intend.
METHOD zif_app_rule~get_new_line_indent.
DATA lr_rule TYPE REF TO zif_app_rule.

IF is_logic_active( ) = abap_false OR zif_app_rule~is_end_of_statement( ) = abap_true.
rv_result = super->zif_app_rule~get_new_line_intend( ).
rv_result = super->zif_app_rule~get_new_line_indent( ).
RETURN.
ENDIF.

lr_rule = find_prev_open_bracket_rule( ).
IF lr_rule->get_prev_rule( ) IS INITIAL.
rv_result = mv_default_line_intend.
rv_result = mv_default_line_indent.
ELSE.
rv_result = lr_rule->get_prev_rule( )->get_new_line_intend( ).
rv_result = lr_rule->get_prev_rule( )->get_new_line_indent( ).
ENDIF.
ENDMETHOD.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ CLASS zcl_app_rule_amdp_control_stru IMPLEMENTATION.
METHOD finalize_init_end.
DATA lr_next_rule TYPE REF TO zif_app_rule.
lr_next_rule = zif_app_rule~get_next_rule( ).
mr_rule_data->add_intend = -4.
mv_add_intend = mr_rule_data->add_intend.
mr_rule_data->add_indent = -4.
mv_add_indent = mr_rule_data->add_indent.
IF lr_next_rule IS NOT INITIAL.
CASE lr_next_rule->get_token_up( ).
WHEN 'IF' OR 'FOR' OR 'WHILE'.
RETURN.
ENDCASE.
ENDIF.
mr_rule_data->new_line_intend_diff = -4.
mr_rule_data->new_statement_intend_diff = -4.
mr_rule_data->new_line_indent_diff = -4.
mr_rule_data->new_statement_indent_diff = -4.
ENDMETHOD.

METHOD finalize_init_others.
Expand All @@ -67,14 +67,14 @@ CLASS zcl_app_rule_amdp_control_stru IMPLEMENTATION.
IF lr_prev_rule IS NOT INITIAL
AND lr_prev_rule->get_token_up( ) = 'END'
AND lr_prev_rule->is_end_of_statement( ) = abap_false.
mr_rule_data->new_line_intend_diff = -4.
mr_rule_data->new_statement_intend_diff = -4.
mr_rule_data->new_line_indent_diff = -4.
mr_rule_data->new_statement_indent_diff = -4.
mv_logic_active = abap_false.
RETURN.
ENDIF.

mr_rule_data->new_line_intend_diff = 4.
mr_rule_data->new_statement_intend_diff = 4.
mr_rule_data->new_line_indent_diff = 4.
mr_rule_data->new_statement_indent_diff = 4.
ENDMETHOD.

METHOD finalize_init_then.
Expand All @@ -83,24 +83,24 @@ CLASS zcl_app_rule_amdp_control_stru IMPLEMENTATION.
ENDMETHOD.

METHOD finalize_init_when.
mr_rule_data->add_intend = -2.
mv_add_intend = mr_rule_data->add_intend.
mr_rule_data->add_indent = -2.
mv_add_indent = mr_rule_data->add_indent.
ENDMETHOD.

METHOD finalize_init_else.
mr_rule_data->add_intend = -2.
mv_add_intend = mr_rule_data->add_intend.
mr_rule_data->add_indent = -2.
mv_add_indent = mr_rule_data->add_indent.
mr_rule_data->is_new_line_req = abap_true.
ENDMETHOD.

METHOD finalize_init_elseif.
mr_rule_data->add_intend = -2.
mv_add_intend = mr_rule_data->add_intend.
mr_rule_data->add_indent = -2.
mv_add_indent = mr_rule_data->add_indent.
ENDMETHOD.

METHOD finalize_init_case.
mr_rule_data->new_line_intend_diff = 4.
mr_rule_data->new_statement_intend_diff = 4.
mr_rule_data->new_line_indent_diff = 4.
mr_rule_data->new_statement_indent_diff = 4.
ENDMETHOD.

ENDCLASS.
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,23 @@ CLASS zcl_app_rule_amdp_default IMPLEMENTATION.
AND mr_prev_rule->get_cur_row( ) <> zif_app_rule~get_cur_row( )
).

rv_result = mv_default_line_intend + mv_add_intend.
rv_result = mv_default_line_indent + mv_add_indent.
zcl_app_utilities=>set_to_0_if_negativ( CHANGING cv_value = rv_result ).
zif_app_rule~set_cur_offset_start( rv_result ).
RETURN.
ENDIF.

CASE mr_token_ext->comment_detail.
WHEN zcl_app_scanner_comment=>cos_comment_detail-start_begin_of_line_intendable.
rv_result = mr_prev_rule->get_new_line_intend( ).
WHEN zcl_app_scanner_comment=>cos_comment_detail-start_begin_of_line_indentable.
rv_result = mr_prev_rule->get_new_line_indent( ).
zcl_app_utilities=>set_to_0_if_negativ( CHANGING cv_value = rv_result ).
rv_result = rv_result + mv_add_intend.
rv_result = rv_result + mv_add_indent.
zcl_app_utilities=>set_to_0_if_negativ( CHANGING cv_value = rv_result ).
zif_app_rule~set_cur_offset_start( rv_result ).
RETURN.
WHEN zcl_app_scanner_comment=>cos_comment_detail-start
OR zcl_app_scanner_comment=>cos_comment_detail-part.
rv_result = mr_prev_rule->get_cur_offset_end( ) + mv_add_intend.
rv_result = mr_prev_rule->get_cur_offset_end( ) + mv_add_indent.
zcl_app_utilities=>set_to_0_if_negativ( CHANGING cv_value = rv_result ).
zif_app_rule~set_cur_offset_start( rv_result ).
RETURN.
Expand All @@ -126,20 +126,20 @@ CLASS zcl_app_rule_amdp_default IMPLEMENTATION.
OR ( mr_prev_rule->is_new_line_req( ) = abap_true
AND zif_app_rule~is_line_breaking_token( ) = abap_false ).

rv_result = mr_prev_rule->get_new_line_intend( ).
rv_result = mr_prev_rule->get_new_line_indent( ).
ELSE.
rv_result = mr_prev_rule->get_cur_offset_end( ).
ENDIF.

zcl_app_utilities=>set_to_0_if_negativ( CHANGING cv_value = rv_result ).
rv_result = rv_result + mv_add_intend.
rv_result = rv_result + mv_add_indent.
zcl_app_utilities=>set_to_0_if_negativ( CHANGING cv_value = rv_result ).
zif_app_rule~set_cur_offset_start( rv_result ).
ENDMETHOD.


METHOD zif_app_rule~init.
mv_default_line_intend = 4.
mv_default_line_indent = 4.

IF zcl_app_utilities=>is_sqlscript_token( ir_token_ext->sqlscript ) = abap_false.
RAISE EXCEPTION TYPE zcx_app_exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ENDCLASS.



CLASS ZCL_APP_RULE_AMDP_DEFAULT_NO_C IMPLEMENTATION.
CLASS zcl_app_rule_amdp_default_no_c IMPLEMENTATION.


METHOD is_logic_active.
Expand Down Expand Up @@ -51,10 +51,10 @@ CLASS ZCL_APP_RULE_AMDP_DEFAULT_NO_C IMPLEMENTATION.

METHOD zif_app_rule~finalize_init.
super->zif_app_rule~finalize_init( ).
set_logic_active( ).
set_logic_active( ).

IF is_logic_active( ) = abap_true.
mv_add_intend = mr_rule_data->add_intend.
mv_add_indent = mr_rule_data->add_indent.
ENDIF.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ CLASS zcl_app_rule_amdp_new_line IMPLEMENTATION.
ENDIF.

IF has_prev_rule_same_type( ) = abap_false.
rv_result = mv_default_line_intend.
rv_result = mv_default_line_indent.
ELSE.
rv_result = mr_prev_rule->get_new_line_intend( ).
rv_result = mr_prev_rule->get_new_line_indent( ).
ENDIF.
zcl_app_utilities=>set_to_0_if_negativ( CHANGING cv_value = rv_result ).
rv_result = rv_result + mv_add_intend.
rv_result = rv_result + mv_add_indent.
zcl_app_utilities=>set_to_0_if_negativ( CHANGING cv_value = rv_result ).


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CLASS ZCL_APP_RULE_AMDP_NEW_LINE_LFT DEFINITION
CLASS zcl_app_rule_amdp_new_line_lft DEFINITION
PUBLIC
INHERITING FROM zcl_app_rule_amdp_new_line
CREATE PUBLIC .
Expand All @@ -7,14 +7,14 @@ CLASS ZCL_APP_RULE_AMDP_NEW_LINE_LFT DEFINITION
METHODS zif_app_rule~get_cur_offset_start REDEFINITION.

PROTECTED SECTION.
METHODS set_add_intend
METHODS set_add_indent
RAISING zcx_app_exception.
PRIVATE SECTION.
ENDCLASS.



CLASS ZCL_APP_RULE_AMDP_NEW_LINE_LFT IMPLEMENTATION.
CLASS zcl_app_rule_amdp_new_line_lft IMPLEMENTATION.

METHOD zif_app_rule~get_cur_offset_start.

Expand All @@ -26,28 +26,28 @@ CLASS ZCL_APP_RULE_AMDP_NEW_LINE_LFT IMPLEMENTATION.
RETURN.
ENDIF.

set_add_intend( ).
set_add_indent( ).

rv_result = super->zif_app_rule~get_cur_offset_start( ).

ENDMETHOD.

METHOD set_add_intend.
METHOD set_add_indent.
DATA lt_text TYPE sourcetable.
DATA lr_text TYPE REF TO string.

IF is_logic_active( ) = abap_true.
IF mr_rule_data->add_intend is INITIAL.
IF mr_rule_data->add_indent IS INITIAL.

lt_text = zif_app_rule~get_text( ).

READ TABLE lt_text REFERENCE INTO lr_text
INDEX 1.
IF sy-subrc = 0.
mv_add_intend = strlen( lr_text->* ) * -1.
mv_add_indent = strlen( lr_text->* ) * -1.
ENDIF.
ELSE.
mv_add_intend = mr_rule_data->add_intend.
mv_add_indent = mr_rule_data->add_indent.
ENDIF.
ENDIF.
ENDMETHOD.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
CLASS zcl_app_rule_amdp_nl_lft_cond DEFINITION
PUBLIC
INHERITING FROM ZCL_APP_RULE_AMDP_NEW_LINE_LFT
INHERITING FROM zcl_app_rule_amdp_new_line_lft
CREATE PUBLIC .

PUBLIC SECTION.

PROTECTED SECTION.
METHODS set_add_intend REDEFINITION.
METHODS set_add_indent REDEFINITION.
DATA mv_cond_fulfilled_set TYPE abap_bool.
DATA mv_cond_fulfilled TYPE abap_bool.
PRIVATE SECTION.
Expand All @@ -18,10 +18,10 @@ ENDCLASS.
CLASS zcl_app_rule_amdp_nl_lft_cond IMPLEMENTATION.


METHOD set_add_intend.
METHOD set_add_indent.
DATA lr_rule_cond TYPE REF TO zif_app_rule_condition.

CLEAR mv_add_intend.
CLEAR mv_add_indent.
IF is_logic_active( ) = abap_false.
RETURN.
ENDIF.
Expand All @@ -40,7 +40,7 @@ CLASS zcl_app_rule_amdp_nl_lft_cond IMPLEMENTATION.
RETURN.
ENDIF.

super->set_add_intend( ).
super->set_add_indent( ).
ENDMETHOD.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CLASS zcl_app_rule_amdp_opn_bracket DEFINITION
CREATE PUBLIC .

PUBLIC SECTION.
METHODS zif_app_rule~get_new_line_intend REDEFINITION.
METHODS zif_app_rule~get_new_line_indent REDEFINITION.
METHODS zif_app_rule~finalize_init REDEFINITION.
METHODS zif_app_rule~get_cur_row REDEFINITION.
METHODS zif_app_rule~is_new_line_req REDEFINITION.
Expand All @@ -22,7 +22,7 @@ ENDCLASS.

CLASS zcl_app_rule_amdp_opn_bracket IMPLEMENTATION.

METHOD zif_app_rule~get_new_line_intend.
METHOD zif_app_rule~get_new_line_indent.


IF is_logic_active( ) = abap_true.
Expand All @@ -33,7 +33,7 @@ CLASS zcl_app_rule_amdp_opn_bracket IMPLEMENTATION.
rv_result = zif_app_rule~get_cur_offset_end( ).
ENDIF.
ELSE.
rv_result = super->zif_app_rule~get_new_line_intend( ).
rv_result = super->zif_app_rule~get_new_line_indent( ).
ENDIF.
ENDMETHOD.

Expand Down Expand Up @@ -116,14 +116,14 @@ CLASS zcl_app_rule_amdp_opn_bracket IMPLEMENTATION.
DO.
lr_rule = lr_rule->get_next_rule( ).
IF lr_rule IS INITIAL.
return.
RETURN.
ENDIF.
IF zcl_app_utilities=>is_sqlscript_rule( lr_rule ) = abap_false.
return.
RETURN.
ENDIF.

IF lr_rule->is_end_of_statement( ) = abap_true.
return.
RETURN.
ENDIF.

IF lr_rule->is_comment( ) = abap_true.
Expand Down
Loading

0 comments on commit 282bda7

Please sign in to comment.