Skip to content

Commit

Permalink
Merge SVN 4745
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jul 15, 2024
1 parent ac550ba commit bee0c45
Showing 1 changed file with 35 additions and 31 deletions.
66 changes: 35 additions & 31 deletions cobc/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -7545,48 +7545,51 @@ picture_clause:
}
_pic_locale_format_or_depending_on
{
if ((!current_field->pic || current_field->pic->variable_length) &&
!current_field->flag_picture_l) {
/* Current field with PIC L was not translated */
cb_error_x (CB_TREE (current_field->pic),
if ((!current_field->pic || current_field->pic->variable_length) &&
!current_field->flag_picture_l) {
/* Current field with PIC L was not translated */
cb_error_x (CB_TREE (current_field->pic),
_("%s requires DEPENDING clause"),
_("variable-length PICTURE"));
}
}
}
;

_pic_locale_format_or_depending_on:
/* empty */
| LOCALE _is_locale_name SIZE _is integer
{
/* $2 -> optional locale-name to be used */
if ((current_field->pic->category != CB_CATEGORY_NUMERIC &&
current_field->pic->category != CB_CATEGORY_NUMERIC_EDITED) ||
strpbrk (current_field->pic->orig, " CRDBL-*") /* the standard seems to forbid also ',' */) {
cb_error_x (CB_TREE (current_field->pic),
/* $2 -> optional locale-name to be used */
if ( (current_field->pic->category != CB_CATEGORY_NUMERIC
&& current_field->pic->category != CB_CATEGORY_NUMERIC_EDITED)
|| strpbrk (current_field->pic->orig, " CRDBL-*")) {
/* CHECKME: the standard seems to forbid additional ',' */
cb_error_x (CB_TREE (current_field->pic),
_("a locale-format PICTURE string must only consist of '9', '.', '+', 'Z' and the currency-sign"));
} else {
/* TODO: check that not we're not within a CONSTANT RECORD */
CB_PENDING_X (CB_TREE (current_field->pic), "locale-format PICTURE");
}
} else {
/* TODO: check that not we're not within a CONSTANT RECORD */
CB_PENDING_X (CB_TREE (current_field->pic), "locale-format PICTURE");
}
}
| DEPENDING _on reference
{
cb_tree depending = $3;
if (!current_field->pic->variable_length) {
cb_error_x ($3, _("DEPENDING clause needs either an "
cb_tree depending = $3;
if (!current_field->pic->variable_length) {
cb_error_x ($3, _("DEPENDING clause needs either an "
"OCCURS clause or a variable-length "
"PICTURE"));
} else if (current_field->pic->category != CB_CATEGORY_ALPHABETIC &&
current_field->pic->category != CB_CATEGORY_ALPHANUMERIC) {
cb_error_x ($3, _("only USAGE DISPLAY may specify a "
} else
if (current_field->pic->category != CB_CATEGORY_ALPHABETIC
&& current_field->pic->category != CB_CATEGORY_ALPHANUMERIC) {
cb_error_x ($3, _("only USAGE DISPLAY may specify a "
"variable-length PICTURE"));
} else if (current_storage == CB_STORAGE_SCREEN ||
current_storage == CB_STORAGE_REPORT) {
cb_error_x ($3, _("%s not allowed in %s"),
} else
if (current_storage == CB_STORAGE_SCREEN
|| current_storage == CB_STORAGE_REPORT) {
cb_error_x ($3, _("%s not allowed in %s"),
_("variable-length PICTURE"),
enum_explain_storage (current_storage));
} else {
} else {
/* Implicitly translate `PIC Lc... DEPENDING N` (where
`c` may actually only be `X` or `A`) into a group
with a single sub-field `PIC c OCCURS 1 TO N`. */
Expand All @@ -7603,11 +7606,11 @@ _pic_locale_format_or_depending_on:
current_field->children = chld;
cobc_parse_free (current_field->pic);
current_field->pic = NULL;
}
/* Raise this flag in the error cases above, to avoid unrelated
warning or error messages upon tentative validation of
redefines. */
current_field->flag_picture_l = 1;
}
/* Raise this flag in the error cases above, to avoid unrelated
warning or error messages upon tentative validation of
redefines. */
current_field->flag_picture_l = 1;
}
;

Expand Down Expand Up @@ -17336,8 +17339,9 @@ _returning_national:
;

_validating_with:
/* empty */ { $$ = NULL; }
| VALIDATING _with schema_file_or_record_name { $$ = $3; }
/* empty */ { $$ = NULL; }
| VALIDATING _with
schema_file_or_record_name { $$ = $3; }
;

schema_file_or_record_name:
Expand Down

0 comments on commit bee0c45

Please sign in to comment.