Skip to content

Commit 4fdc883

Browse files
committed
[WIP] methods fix
Signed-off-by: Saurabh Kumar <developer.saurabh@outlook.com>
1 parent 4786d68 commit 4fdc883

1 file changed

Lines changed: 45 additions & 36 deletions

File tree

cobc/parser.y

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3838,12 +3838,12 @@ instance_definition:
38383838
_dot
38393839
;
38403840

3841-
// method_definition:
3842-
// _identification_header
3843-
// method_id_header TOK_DOT method_signature _override _is_final
3844-
// _program_body
3845-
// end_method
3846-
// ;
3841+
method_definition:
3842+
_identification_header
3843+
method_id_header TOK_DOT method_signature _override _is_final TOK_DOT
3844+
_program_body
3845+
end_method
3846+
;
38473847

38483848
function_definition:
38493849
_identification_header
@@ -11357,33 +11357,21 @@ _procedure_division:
1135711357
| procedure_division
1135811358
;
1135911359

11360-
procedure_division:
11361-
PROCEDURE
11362-
{
11363-
check_area_a_of ("PROCEDURE DIVISION");
11364-
current_section = NULL;
11365-
current_paragraph = NULL;
11366-
check_pic_duplicate = 0;
11367-
check_duplicate = 0;
11368-
cobc_in_procedure = 1U;
11369-
cb_set_system_names ();
11370-
last_source_line = cb_source_line;
11360+
procedure_division_contents:
11361+
procedure_division_sections
11362+
| _method_list
11363+
;
1137111364

11372-
cb_prof_procedure_division (
11373-
current_program,
11374-
cb_source_file,
11375-
cb_source_line
11376-
);
11377-
}
11378-
DIVISION
11379-
_mnemonic_conv _conv_linkage _procedure_using_chaining _procedure_returning
11365+
procedure_division_sections:
11366+
_mnemonic_conv _conv_linkage _procedure_using_chaining _procedure_returning
1138011367
{
11381-
cb_tree call_conv = $4;
11382-
if ($5) {
11383-
call_conv = $5;
11368+
/* check $4 value, they might be incorrect */
11369+
cb_tree call_conv = $3;
11370+
if ($4) {
11371+
call_conv = $4;
1138411372
if ($4) {
1138511373
/* note: $3 is likely to be a reference to SPECIAL-NAMES */
11386-
cb_error_x ($5, _("%s and %s are mutually exclusive"),
11374+
cb_error_x ($4, _("%s and %s are mutually exclusive"),
1138711375
"CALL-CONVENTION", "WITH LINKAGE");
1138811376
}
1138911377
}
@@ -11402,11 +11390,11 @@ procedure_division:
1140211390
_procedure_declaratives
1140311391
{
1140411392
if (current_program->flag_main
11405-
&& !current_program->flag_chained && $6) {
11393+
&& !current_program->flag_chained && $5) {
1140611394
cb_error (_("executable program requested but PROCEDURE/ENTRY has USING clause"));
1140711395
}
1140811396

11409-
emit_main_entry (current_program, $6);
11397+
emit_main_entry (current_program, $5);
1141011398

1141111399
cb_check_definition_matches_prototype (current_program);
1141211400
}
@@ -11427,7 +11415,28 @@ procedure_division:
1142711415
emit_statement (cb_build_perform_exit (current_section));
1142811416
}
1142911417
}
11430-
// | _method_list
11418+
;
11419+
11420+
procedure_division:
11421+
PROCEDURE
11422+
{
11423+
check_area_a_of ("PROCEDURE DIVISION");
11424+
current_section = NULL;
11425+
current_paragraph = NULL;
11426+
check_pic_duplicate = 0;
11427+
check_duplicate = 0;
11428+
cobc_in_procedure = 1U;
11429+
cb_set_system_names ();
11430+
last_source_line = cb_source_line;
11431+
11432+
cb_prof_procedure_division (
11433+
current_program,
11434+
cb_source_file,
11435+
cb_source_line
11436+
);
11437+
}
11438+
DIVISION
11439+
procedure_division_contents
1143111440
|
1143211441
{
1143311442
cb_tree label;
@@ -11805,10 +11814,10 @@ procedure:
1180511814

1180611815
/* Method list */
1180711816

11808-
// _method_list:
11809-
// method_definition
11810-
// | _method_list method_definition
11811-
// ;
11817+
_method_list:
11818+
method_definition
11819+
| _method_list method_definition
11820+
;
1181211821

1181311822
/* Section/Paragraph */
1181411823

0 commit comments

Comments
 (0)