Skip to content

Commit

Permalink
cobc: fixing warnings in parser.y and pplex.l which got in by the las…
Browse files Browse the repository at this point in the history
…t commits
  • Loading branch information
sf-mensch committed Jul 8, 2023
1 parent 8bc9fed commit 4e7a61d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
11 changes: 6 additions & 5 deletions cobc/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ setup_external_definition_type (cb_tree x)

/* verifies that no conflicting clauses are used and
inherits the definition of the original field specified
by SAME AS or by type_name */
by SAME AS or by type_name into the current_field */
static void
inherit_external_definition (const int lvl)
{
Expand Down Expand Up @@ -1788,9 +1788,9 @@ get_finalized_description_tree (void)
{
struct cb_field *p;

/* finalize last field if target of SAME AS / TYPEDEF */
/* finalize last field if target of SAME AS / TYPEDEF */
if (current_field && !CB_INVALID_TREE (current_field->external_definition)) {
inherit_external_definition (0);
inherit_external_definition (0);
}

/* validate the complete current "block" */
Expand Down Expand Up @@ -3576,7 +3576,8 @@ start:
;

compilation_group:
simple_prog /* extension: single program without PROCEDURE DIVISION */
simple_prog /* extension: single program
without PROGRAM-ID, possibly also without PROCEDURE DIVISION */
| nested_list
;

Expand Down Expand Up @@ -14566,7 +14567,7 @@ else:
$$ = cb_build_comment ("ELSE");
}

if_else_statements, :
if_else_statements:
if_true statement_list else if_false statement_list
{
if (is_valid_statement_tree ($5)) {
Expand Down
31 changes: 18 additions & 13 deletions cobc/pplex.l
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static struct plex_stack plex_cond_stack[PLEX_COND_DEPTH];

/* Function declarations */
static int ppinput (char *, const size_t);
static void ppecho (const char *text, const char *token );
static void ppecho (const char *text, const char *token );

static void switch_to_buffer (const int, const char *,
const YY_BUFFER_STATE);
Expand Down Expand Up @@ -548,9 +548,9 @@ SUBSTITUTION_SECTION_STATE>{
ppecho (yytext, NULL);
}
[,;]?\n {
ECHO;
check_listing (yytext, 0);
cb_source_line++;
ECHO;
check_listing (yytext, 0);
cb_source_line++;
}
[,;]?[ ]+ { /* ignore */ }
}
Expand Down Expand Up @@ -1015,18 +1015,20 @@ ENDIF_DIRECTIVE_STATE>{
"REPLACING" { yy_push_state (REPLACING_STATE); return REPLACING; }
"ALSO" { return ALSO; }
"LAST" { return LAST; }

/* for error handling only, only used in REPLACING state */
"LEADING" { return LEADING; }
"TRAILING" { return TRAILING; }
"==" { return EQEQ; }
"BY" { return BY; }

{WORD} |
{NUMRIC_LITERAL} |
{ALNUM_LITERAL} |
. {
pplval.s = cobc_plex_strdup (yytext);
return TOKEN;
}
/* for error handling only, only used in REPLACING state */
"LEADING" { return LEADING; }
"TRAILING" { return TRAILING; }
"==" { return EQEQ; }
"BY" { return BY; }
}

<REPLACING_STATE>{
Expand All @@ -1039,6 +1041,7 @@ ENDIF_DIRECTIVE_STATE>{

"LEADING" { return LEADING; }
"TRAILING" { return TRAILING; }
"==" { yy_push_state (PSEUDO_STATE); return EQEQ; }
"BY" { return BY; }
\. {
yy_pop_state ();
Expand All @@ -1050,7 +1053,7 @@ ENDIF_DIRECTIVE_STATE>{
"OF" { return OF; }
"(" { return '('; }
")" { return ')'; }
"==" { yy_push_state (PSEUDO_STATE); return EQEQ; }

/* for error handling only, only used in COPY state */
"REPLACING" { return REPLACING; }

Expand Down Expand Up @@ -1105,13 +1108,15 @@ ENDIF_DIRECTIVE_STATE>{
"OF" { return OF; }
"(" { return '('; }
")" { return ')'; }
"==" { yy_push_state (PSEUDO_STATE); return EQEQ; }
"BY" { return BY; }

"LEADING" { return LEADING; }
"TRAILING" { return TRAILING; }
"==" { yy_push_state (PSEUDO_STATE); return EQEQ; }
"BY" { return BY; }
"ALSO" { return ALSO; }
"LAST" { return LAST; }
"OFF" { return OFF; }

{WORD} |
{NUMRIC_LITERAL} |
{ALNUM_LITERAL} |
Expand Down Expand Up @@ -1144,7 +1149,7 @@ ENDIF_DIRECTIVE_STATE>{
newline_count = 0;
inside_bracket = 0;
comment_allowed = 1;
cb_free_replace ();
cb_free_replace ();
copy_stack = NULL;
quotation_mark = 0;
consecutive_quotation = 0;
Expand Down

0 comments on commit 4e7a61d

Please sign in to comment.